-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: embedding well known canisters at build time #3872
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a note to the changelog. This PR should probably also include migration notes, for projects that define these as remote canisters. Migration notes go here: https://github.com/dfinity/sdk/tree/master/docs/migration
Also, I imagine that ideally this kind of change would make it unnecessary to manually define well-known canisters as remote canisters in dfx.json. Does this PR go that far?
const WELL_KNOWN_CANISTERS: &[(&str, &str)] = &[ | ||
{} | ||
]; | ||
|
||
pub fn map_wellknown_canisters() -> HashMap<CanisterName, Principal> {{ | ||
WELL_KNOWN_CANISTERS.iter().map(|(key, value)| (key.to_string(), (*value).try_into().unwrap())).collect() | ||
}} | ||
", | ||
well_known_canisters | ||
.map(|(key, val)| format!("(\"{}\", \"{}\")", key, val)) | ||
.join(",\n") | ||
) | ||
.as_bytes(), | ||
) | ||
.unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a global mapping of well-known canister ids, could we initialize this into a LazyLock
rather than adding it as a member to CanisterIdStore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version of rust used by sdk
doesn't have LazyLock
stabilized.
Not sure how I would go about migrations docs for this. Do you have some proposals? |
Description
DRE team would highly benefit if we could have a feature like this for well known canisters. Probably others as well. This PR adds a
build.rs
for dfx-core which creates a file at build time for well known canisters.Fixes # (issue)
How Has This Been Tested?
This was mostly tested during development with:
Added two tests to
canister sign
andcanister call
scriptsChecklist: