Skip to content

feat: make reference subnet size in CyclesAccountManager configurable at runtime#10469

Draft
mraszyk wants to merge 9 commits into
masterfrom
mraszyk/dynamic-reference-subnet-size
Draft

feat: make reference subnet size in CyclesAccountManager configurable at runtime#10469
mraszyk wants to merge 9 commits into
masterfrom
mraszyk/dynamic-reference-subnet-size

Conversation

@mraszyk

@mraszyk mraszyk commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

This PR makes the reference subnet size in CyclesAccountManager configurable at runtime so that a subnet's security can be changed from None to SEV-SNP and this change is properly picked up from the registry and reflected in cycles scaling at runtime.

@github-actions github-actions Bot added the feat label Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the CyclesAccountManager’s “reference subnet size” (used for cycles cost scaling) updateable at runtime based on registry state, so that enabling/disabling SEV on a subnet is reflected in cycles scaling without restarting or rebuilding configuration.

Changes:

  • Adds reference_subnet_size to RegistryExecutionSettings and populates it when reading the registry (with SEV-aware behavior for app subnets).
  • Updates SchedulerImpl::execute_round to apply the registry-provided reference_subnet_size into CyclesAccountManager each round.
  • Refactors CyclesAccountManager to store the reference size in a shared atomic (to keep clones consistent) and updates tests/utilities accordingly.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
rs/test_utilities/execution_environment/src/lib.rs Populates the new registry execution setting field in test utilities.
rs/messaging/src/message_routing/tests.rs Updates test scaffolding for the new field and adds a regression test for SEV-driven updates.
rs/messaging/src/message_routing.rs Computes reference_subnet_size from subnet type + SEV feature and includes it in RegistryExecutionSettings.
rs/interfaces/src/execution_environment.rs Extends RegistryExecutionSettings with reference_subnet_size.
rs/execution_environment/tests/subnet_size_test.rs Adds a test asserting SEV reference size affects execution costs as expected.
rs/execution_environment/src/scheduler/threshold_signatures.rs Updates test settings construction to include reference_subnet_size.
rs/execution_environment/src/scheduler.rs Sets CyclesAccountManager reference subnet size from registry each round.
rs/execution_environment/src/hypervisor.rs Adjusts to CyclesAccountManager no longer being Copy (uses clone()).
rs/execution_environment/src/execution_environment.rs Adjusts call sites to use clones where needed and keeps fee computations working.
rs/embedders/tests/wasmtime_random_memory_writes.rs Updates test construction for non-Copy CyclesAccountManager.
rs/embedders/tests/system_api.rs Updates tests to pass cloned CyclesAccountManager.
rs/embedders/tests/sandbox_safe_system_state.rs Updates tests to pass cloned CyclesAccountManager.
rs/cycles_account_manager/src/cycles_account_manager/tests.rs Updates internal test helper to set the new shared reference size field.
rs/cycles_account_manager/src/cycles_account_manager.rs Introduces shared atomic reference subnet size, adds runtime setter, and updates scaling to use it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rs/messaging/src/message_routing/tests.rs
Comment thread rs/cycles_account_manager/src/cycles_account_manager.rs
Comment thread rs/cycles_account_manager/src/cycles_account_manager.rs Outdated
Comment thread rs/execution_environment/src/scheduler.rs
mraszyk and others added 5 commits June 15, 2026 13:39
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Comment thread rs/messaging/src/message_routing/tests.rs
Comment thread rs/execution_environment/tests/subnet_size_test.rs
Comment thread rs/cycles_account_manager/src/cycles_account_manager.rs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants