Where can I find the code for ic_nns_constants?

Was looking into the NNS app and found this code that uses ic_nns_constants.

I’m arguably not comfortable with Rust, but from a code search I can’t find where ic_nns_constants is defined. So my question is - where is it? :sweat_smile: Is it private, or in a different repo?

My reason for asking is I want to know how these constants get updated (i.e. manually, etc.). I know that the cycles exchange rate gets automagically updated through NNS proposals, but am wondering how that might be done for other IC constants, such as the NNS proposal rejection cost.

Rust is pretty tidy with its imports and usually keeps them in the cargo.toml file of a project. So if you go here you can take a look and see where that crate comes from.

ic-nns-common = { git = "https://github.com/dfinity/ic", rev = "42a4bc4b7917a44c58c9cf907d84b9fd8e908ed9" }
ic-nns-constants = { git = "https://github.com/dfinity/ic", rev = "42a4bc4b7917a44c58c9cf907d84b9fd8e908ed9" }
ic-nns-governance = { git = "https://github.com/dfinity/ic", rev = "42a4bc4b7917a44c58c9cf907d84b9fd8e908ed9" }

So the crate called ic_nns_constants is taken from the repo at https://github.com/dfinity/ic

Going to that link and clicking on the “rs” folder, we get another Cargo.toml

members = [
...
"nns/constants",
"nns/common",

And if you go to that nns/constants folder, you finally get here.

Alternatively, depending on your IDE you can hover, click, control/cmd + click, etc. on a crate and it will open up the source file of that crate, and you can check for constants that way.

4 Likes