Skip to content

Conversation

@fspreiss
Copy link
Contributor

@fspreiss fspreiss commented Jan 7, 2026

Adds a data migration in the registry canister that modifies the pre_signatures_to_create_in_advance field for vetKD keys in certain subnets from Some(0) to None so as to align with the new/correct representation for keys that do not have pre-signatures.

…eld for vetKD keys to correct representation
@github-actions github-actions bot added the feat label Jan 7, 2026
@fspreiss fspreiss changed the title feat(registry): CRP-2618 migrate pre_signatures_to_create_in_advance field for vetKD keys to correct representation feat(registry): CRP-2618 migrate pre_signatures_to_create_in_advance field for vetKD keys Jan 7, 2026
@fspreiss fspreiss marked this pull request as ready for review January 7, 2026 08:18
@fspreiss fspreiss requested a review from a team as a code owner January 7, 2026 08:18
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@fspreiss fspreiss dismissed github-actions[bot]’s stale review January 7, 2026 08:20
  1. Changelog updated.
  2. No breaking changes.
  3. This PR performs data migration.
  4. No security review needed.
Comment on lines 241 to 248
// Check if this is a vetKD key
let is_vetkd_key = if let Some(key_id_pb) = &key_config.key_id {
matches!(key_id_pb.key_id, Some(KeyId::Vetkd(_)))
} else {
false
};

if is_vetkd_key && key_config.pre_signatures_to_create_in_advance == Some(0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do as you see fit.

continue is a more explicit way to skip, rather than setting is_vetkd_key to false.

Suggested change
// Check if this is a vetKD key
let is_vetkd_key = if let Some(key_id_pb) = &key_config.key_id {
matches!(key_id_pb.key_id, Some(KeyId::Vetkd(_)))
} else {
false
};
if is_vetkd_key && key_config.pre_signatures_to_create_in_advance == Some(0) {
// Skip if not vetkd.
let key_id = match &key_config.key_id {
None => continue, // Maybe log here? I assume that this is bad data.
Some(ok) => ok,
};
match key_id.key_id {
Some(KeyId::Vetkd(_ok)) => (),
_ => continue,
}
if key_config.pre_signatures_to_create_in_advance == Some(0) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adapted to use continue-based approach, including logs for unexpected data.

.as_ref()
.unwrap()
.key_configs[0];
assert_eq!(key_config_1.pre_signatures_to_create_in_advance, None);
Copy link
Contributor

Choose a reason for hiding this comment

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

Even better would be if you take the original SubnetRecord, modify (a copy of) it by setting pre_signatures_to_create_in_advance to None, and comparing subnet_record_1_after to that expected value.

Ditto elsewhere, except you don't even need to modify the original to derive the expected value, because the original IS the expected value!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is much better, thanks! Done.

mutations
}

fn fix_vetkd_pre_signatures_field(registry: &Registry) -> Vec<RegistryMutation> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn fix_vetkd_pre_signatures_field(registry: &Registry) -> Vec<RegistryMutation> {
// TODO(${JIRA_TICKET_ID}): Delete this after it has been released.
// (Deletion need not take place right away.)
fn fix_vetkd_pre_signatures_field(registry: &Registry) -> Vec<RegistryMutation> {

Copy link
Contributor Author

@fspreiss fspreiss Jan 8, 2026

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants