Skip to content

fix(registry): Ensure subnet features can be changed for subnets without any features#3044

Merged
aterga merged 3 commits intomasterfrom
arshavir/fix-sev-validation-during-change-subnet
Dec 9, 2024
Merged

fix(registry): Ensure subnet features can be changed for subnets without any features#3044
aterga merged 3 commits intomasterfrom
arshavir/fix-sev-validation-during-change-subnet

Conversation

@aterga
Copy link
Copy Markdown
Contributor

@aterga aterga commented Dec 9, 2024

This PR fixes the validation of the SEV (AMD Secure Encrypted Virtualization) feature that prevented change-subnet proposals that attempted to set a (non-SEV-related) feature for the first time (i.e., when the subnet doesn't yet have any features).

@github-actions github-actions Bot added the fix label Dec 9, 2024
@aterga aterga marked this pull request as ready for review December 9, 2024 14:11
@aterga aterga requested a review from a team as a code owner December 9, 2024 14:11
@aterga aterga enabled auto-merge December 9, 2024 14:17
@daniel-wong-dfinity-org
Copy link
Copy Markdown
Contributor

Please, expand SEV acronym in description.

@aterga
Copy link
Copy Markdown
Contributor Author

aterga commented Dec 9, 2024

Please, expand SEV acronym in description.

Done

Copy link
Copy Markdown
Contributor

@daniel-wong-dfinity-org daniel-wong-dfinity-org left a comment

Choose a reason for hiding this comment

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

My main concern (non-blocking) is that it seems you made a small change to the intended behavior. Before, I think you were allowed to set sev_enabled to its current value. Now, you are not allowed to do this. This new approach is valid and safer (and therefore, arguably superior). OTOH, when fixing bugs, I think we normally just get rid of bad thing, not try to make a more general improvement. But anyway, I do not seriously object, and this is maybe what should have been done in the first place -> I preemptively approve, but I just bring this up to make sure we are changing intentionally.

Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs Outdated
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs Outdated
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs Outdated
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs Outdated
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs Outdated
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs Outdated
Comment thread rs/registry/canister/src/mutations/do_update_subnet.rs
@aterga aterga added this pull request to the merge queue Dec 9, 2024
@aterga aterga removed this pull request from the merge queue due to a manual request Dec 9, 2024
@aterga
Copy link
Copy Markdown
Contributor Author

aterga commented Dec 9, 2024

My main concern (non-blocking) is that it seems you made a small change to the intended behavior. Before, I think you were allowed to set sev_enabled to its current value. Now, you are not allowed to do this. This new approach is valid and safer (and therefore, arguably superior). OTOH, when fixing bugs, I think we normally just get rid of bad thing, not try to make a more general improvement. But anyway, I do not seriously object, and this is maybe what should have been done in the first place -> I preemptively approve, but I just bring this up to make sure we are changing intentionally.

Yes, this is intentional. I don't see a reason why someone needs to propose to set the SEV feature flag to the same value as it's been set form the moment the subnet was created. This seems to indicate fundamental misunderstanding of how this feature flag works, and thus I think it should be rejected. Note that there were no unit tests to specify this behavior, thus one could see this as a (less significant) bug, not a novel behavioral change (which would justify a feat in the PR title).

@aterga aterga enabled auto-merge December 9, 2024 16:08
@aterga aterga added this pull request to the merge queue Dec 9, 2024
Merged via the queue into master with commit c2e11ca Dec 9, 2024
@aterga aterga deleted the arshavir/fix-sev-validation-during-change-subnet branch December 9, 2024 16:38
r-birkner added a commit that referenced this pull request May 7, 2026
Per @jasonz-dfinity's review on #9956: because `merge_subnet_record`
wholesale-replaces `subnet_record.features` via `maybe_set_option!`, a
proposal could disable SEV on an SEV-enabled subnet by setting
`features = Some(SubnetFeatures { ..., sev_enabled: None })`. The
restored strict check (introduced in #3044) only panicked when
`payload.features.sev_enabled` was explicitly `Some(_)`, so this
implicit transition slipped through.

Compare the effective `sev_enabled` (post-replacement) against the
existing record via the rust-level `SubnetFeatures`, which collapses
`None` and `Some(false)` to `false`. This catches both explicit and
implicit changes while still permitting no-op updates (the case #3044
originally fixed).

Adds two regression tests (explicit and implicit disable) plus a
no-op test, against an SEV-enabled fixture seeded with chip-ID'd
nodes so the SEV invariant stays satisfied.
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