Skip to content

refactor(mainnet-nns): fix regressions on testnet with mainnet state + refactor NNS recovery testnet#9721

Merged
pierugo-dfinity merged 16 commits intomasterfrom
pierugo/mainnet-nns/fixes-and-refactors
Apr 17, 2026
Merged

refactor(mainnet-nns): fix regressions on testnet with mainnet state + refactor NNS recovery testnet#9721
pierugo-dfinity merged 16 commits intomasterfrom
pierugo/mainnet-nns/fixes-and-refactors

Conversation

@pierugo-dfinity
Copy link
Copy Markdown
Contributor

@pierugo-dfinity pierugo-dfinity commented Apr 2, 2026

This PR prepares for the NNS Recovery system test with mainnet state. As preliminary steps, it performs the following refactors:

  • Moves nodes registrations, NNS membership change to unassigned nodes, backup access provisioning to the setup phase to avoid code duplication.
  • Parametrize the DKG interval of the testnet through a function argument instead of relying on the presence of an environment variable.
  • Removes printing "Working GuestOS version" in the testnet: in practice this is not used because we use a real uploaded image.

It also fixes the following introduced regressions:

  • Use env.get_path(PATH_IC_RECOVERY) instead of get_dependency_path_from_env("IC_RECOVERY_PATH") (revert of chore: look up recovery tools from environment #8518).
  • The recovery directory is set to the test environment base path to easily find it when using in conjunction with --test_tmpdir (revert of chore: look up recovery tools from environment #8518).
  • Adapt the --validate-nns-url argument to emphasize that it is not actually used.
  • Increasing the timeout for the API BN healthiness.
  • Fix ic-admin path (revert of chore: look up recovery tools from environment #8518).
  • When removing large files, delete only the working dir of the recovery folder to not also delete the binaries (containing ic-admin).
  • Rename the :mainnet_nns target to :mainnet_nns_state otherwise Bazel complains that it is a prefix of the mainnet_nns:lib target.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Prepares the NNS Recovery system test to run against mainnet state on testnet, while refactoring the nested NNS recovery testnet setup to remove duplication and address several path/cleanup regressions.

Changes:

  • Refactors nested NNS recovery setup by moving registration, NNS membership change, and backup access provisioning into the shared setup phase.
  • Makes the “mainnet NNS with mainnet state” testnet accept an optional DKG interval override (instead of hard-coding env-var logic in the library).
  • Fixes/adjusts recovery tooling integration: use env.get_path(...) for ic-recovery, retain recovery binaries while cleaning only the working directory, increase API BN health wait robustness, and rename the Bazel/Cargo target to avoid name collisions.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rs/tests/testnets/nns_recovery.rs Removes duplicated setup steps from the test body and tightens DKG interval parsing for this testnet.
rs/tests/testnets/mainnet_nns_state.rs Wraps mainnet NNS setup with an optional DKG interval override.
rs/tests/testnets/mainnet_nns/src/lib.rs Implements optional DKG override, refactors recovery paths/cleanup, and improves API BN health waiting.
rs/tests/testnets/mainnet_nns/Cargo.toml Drops ic-limits dependency after removing the hard-coded default from this crate.
rs/tests/testnets/mainnet_nns/BUILD.bazel Removes the Bazel dependency on //rs/limits accordingly.
rs/tests/testnets/Cargo.toml Renames the binary from mainnet_nns to mainnet_nns_state.
rs/tests/testnets/BUILD.bazel Updates system test target name and removes no-longer-needed deps/flags for nns_recovery.
rs/tests/nested/nns_recovery/common.rs Moves registration/membership/backup access provisioning into setup() to reduce duplication.
rs/tests/driver/src/driver/test_env_api.rs Adds a configurable health-wait helper (await_status_is_healthy_with_retries_async).
Cargo.lock Updates lockfile after dependency removal.
Comments suppressed due to low confidence (1)

rs/tests/testnets/mainnet_nns_state.rs:27

  • The usage example in this header comment still refers to ict testnet create mainnet_nns (and --test_tmpdir=./mainnet_nns), but this PR renames the testnet/bin target to mainnet_nns_state. Please update the example command (and tmpdir name if applicable) so the instructions match the new target name.

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

@pierugo-dfinity pierugo-dfinity marked this pull request as ready for review April 15, 2026 12:48
@pierugo-dfinity pierugo-dfinity requested review from a team as code owners April 15, 2026 12:48
Comment thread rs/tests/testnets/mainnet_nns/src/lib.rs Outdated
Comment thread rs/tests/testnets/mainnet_nns/src/lib.rs Outdated
Comment thread rs/tests/testnets/mainnet_nns/src/lib.rs Outdated
Comment thread rs/tests/testnets/mainnet_nns_state.rs Outdated
Comment thread rs/tests/testnets/mainnet_nns/src/lib.rs
@pierugo-dfinity pierugo-dfinity added this pull request to the merge queue Apr 17, 2026
Merged via the queue into master with commit 53b7978 Apr 17, 2026
37 checks passed
@pierugo-dfinity pierugo-dfinity deleted the pierugo/mainnet-nns/fixes-and-refactors branch April 17, 2026 14:56
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.

5 participants