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

sns-testing: SNS lifecycle #2

Merged
merged 4 commits into from
Feb 5, 2025
Merged

Conversation

rvem
Copy link
Member

@rvem rvem commented Jan 28, 2025

No description provided.

@rvem rvem requested a review from sras January 28, 2025 15:27
@rvem rvem force-pushed the rvem/sns-testing-sns-cycle branch from fe1bd22 to 65bea14 Compare January 29, 2025 13:20
@rvem rvem changed the base branch from rvem/sns-testing to serokell/sns-testing January 29, 2025 13:21
@rvem rvem force-pushed the rvem/sns-testing-sns-cycle branch from ae0ca5d to fc71de3 Compare January 30, 2025 09:21
@rvem rvem marked this pull request as ready for review January 30, 2025 09:24
@rvem rvem force-pushed the rvem/sns-testing-sns-cycle branch 3 times, most recently from 704dbac to 4899f0c Compare January 31, 2025 07:44
},
swap::{await_swap_lifecycle, smoke_test_participate_and_finalize},
},
},
Copy link
Member

Choose a reason for hiding this comment

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

Seems like nesting is a bit too much here in these imports.

/// 5. `install_index_canister` - a flag indicating whether the Index canister for ICP Ledger should be installed.
/// 6. `install_cmc` - a flag indicating whether the Cycles minting canister should be installed.
/// 4. `custom_initial_registry_mutations` are custom mutations for the inital Registry. These
/// should mutations should comply with Registry invariants, otherwise this function will fail.
Copy link
Member

Choose a reason for hiding this comment

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

it seems that "should" is redundant

Copy link
Member Author

Choose a reason for hiding this comment

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

FWIW, this typo was there before my changes, but I'll fix it

custom_initial_registry_mutations: Option<Vec<RegistryAtomicMutateRequest>>,
neurons_fund_hotkeys: Vec<PrincipalId>,
install_index_canister: bool,
install_cmc: bool,
) -> Vec<PrincipalId> {
assert!(
!(with_mainnet_nns_canister_versions && with_test_nns_governance_canister),
"Cannot mainnet canister version together wit NNS governance test canister version"
Copy link
Member

Choose a reason for hiding this comment

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

"Cannot mainnet canister version together wit NNS governance test canister version"

Did you mean "Cannot use mainnet" ?

wit

Typo?

let (sns, proposal_id) =
propose_to_deploy_sns_and_wait(pocket_ic, create_service_nervous_system, sns_proposal_id)
.await;
await_swap_lifecycle(pocket_ic, sns.swap.canister_id, Lifecycle::Open)
Copy link
Member

Choose a reason for hiding this comment

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

The issue seem to require this

sns-testing scenario should close the swap using a sufficient amount of test participants with a sufficient amount of ICPs.

Do we know that it works like this in this await_swap_lifecycle? Or is it done somewhere else?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or is it done somewhere else?

The swap is handled in smoke_test_participate_and_finalize slightly below. This helper considers required parameters in order to correctly close the swap

@rvem rvem force-pushed the serokell/sns-testing branch from 4214bb7 to 018ddc3 Compare February 3, 2025 08:13
@rvem rvem force-pushed the rvem/sns-testing-sns-cycle branch from e263103 to 3763b44 Compare February 3, 2025 09:48
Comment on lines +16 to +26
match x {
None => (),
Some(x) => {
match x.greeting {
None => (),
Some(g) => {
STR.with(|s| *s.borrow_mut() = g);
}
};
}
}
Copy link
Member

Choose a reason for hiding this comment

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

May be using if let is better here..

Copy link
Member

@sras sras left a comment

Choose a reason for hiding this comment

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

LGTM

rvem added 4 commits February 5, 2025 14:34
1) Add a simple test canister that will be decentralized as a part of
   newly created SNS
2) Add helpers to install this canister and run it as the new SNS
3) Complete the SNS swap to finalize SNS adoption
Add helpers to upgrade the test canister.
Currently, the helper will reuse the same WASM module, but it's possible
to provide the new state value as a 'post_upgrade' hook argument.

Test scenario as well as CLI now perform canister upgrade. The former
also allows to see the SNS voting procedure in the NNS dapp web UI.
Problem: Currently, helpers from 'pocket_ic_helpers' module use
'advance_time' pocket-ic method to artificially advance time in order to
wait for certain events to happen.
However, using 'advance_time' in live mode breaks agent certificates
checking since pocket-ic time becomes larger than the real time.

Solution:
1) When pocket-ic is running in live mode, run 'std::thread::sleep()'
   instead of 'advance_time()'.
2) Avoid waiting two days for SNS swap to start in live mode.
3) Allow to use the test version of NNS Governance
   canister which is capable of starting SNS swap immediately after SNS
   proposal adoption.
Problem: We want to be able to run pocket-ic in live mode. However, this
is not viable with non-test version of NNS Governance canister because
it postpones the SNS swap start.

Solution: Use test version of NNS Governance canister. Ensure that swap
start_time is 'None' to start the swap immediately after SNS creation
proposal adoption.
@rvem rvem force-pushed the rvem/sns-testing-sns-cycle branch from 529a00b to 9d4a80e Compare February 5, 2025 13:34
@rvem rvem merged commit f4f6bc4 into serokell/sns-testing Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants