Skip to content
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

chore: Let PocketIC library depend on public ic-management-canister-types #3986

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

michael-weigelt
Copy link
Contributor

@michael-weigelt michael-weigelt commented Feb 17, 2025

This is an imperfect step in the right direction.

Follow-ups and explanations:

  • The public types have a typo in a field name which will lead to breakage when it is fixed.
  • Some of the names of mgmt types that the PocketIC library defined in its management_canister module are different from the ones in the public crate. For now, they are imported as their old name, in order to reduce changes in this PR. They should probably be consistently renamed. Depending on whether these types are exposed to PocketIC users, this might be a breaking change, hence this PR does not perform this renaming step.
  • The module management_canister still contains a few types, because they are not defined YET in the current version of the public crate, or they are more recent versions of those types (e.g., with an additional field). As the public crate is upgraded and contains all necessary types, this module will hopefully disappear, and all necessary management canister types can be imported via the public crate. For experimental pre-releases, the ic-management-canister-types crate and the pocket-ic crate have to both publish beta-releases on crates.io.

This PR changes more crates in ic/rs/... than it should, because

  • These crates depended on pocket-ic (more or less directly) for certain management canister types. Now that PocketIC does not define these itself anymore, all these consumers need to depend on the real dependency, some with renaming as the old name.

To the codeowners of these crates:

If you have only imported PocketIC for the management canister types, please remove the dependency and depend on the public crate. If you find yourself depending on ic-management-canister-types-private or "//rs/types/management_canister_types", please also move to the public crate.

@github-actions github-actions bot added the chore label Feb 17, 2025
@michael-weigelt michael-weigelt added the CI_ALL_BAZEL_TARGETS Runs all bazel targets and uploads them to S3 label Feb 17, 2025
Comment on lines -184 to -195
fn candid_equality_test() {
let declared_interface_str =
std::fs::read_to_string(std::env::var_os("IC_DID").unwrap()).unwrap();
let declared_interface = CandidSource::Text(&declared_interface_str);

candid::export_service!();
let implemented_interface_str = __export_service();
let implemented_interface = CandidSource::Text(&implemented_interface_str);

let result = service_equal(declared_interface, implemented_interface);
assert!(result.is_ok(), "{:?}\n\n", result.unwrap_err());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have this test somewhere?

Comment on lines +88 to 125
/// Types of curves that can be used for threshold key derivation (vetKD).
/// ```text
/// (variant { bls12_381_g2; })
/// ```
#[derive(
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Hash,
Debug,
CandidType,
Deserialize,
EnumIter,
Serialize,
)]
pub enum VetKdCurve {
#[serde(rename = "bls12_381_g2")]
#[allow(non_camel_case_types)]
Bls12_381_G2,
}

/// Unique identifier for a key that can be used for threshold key derivation
/// (vetKD). The name is just an identifier, but it may be used to convey
/// some information about the key (e.g. that the key is meant to be used for
/// testing purposes).
/// ```text
/// (record { curve: vetkd_curve; name: text})
/// ```
#[derive(
Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, CandidType, Deserialize, Serialize,
)]
pub struct VetKdKeyId {
pub curve: VetKdCurve,
pub name: String,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not publicly released yet (dfinity/portal#3763)

Comment on lines +145 to 149
pub enum MasterPublicKeyId {
Ecdsa(EcdsaKeyId),
Schnorr(SchnorrKeyId),
VetKd(VetKdKeyId),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who uses that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore CI_ALL_BAZEL_TARGETS Runs all bazel targets and uploads them to S3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants