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

test(sns-cli): Port UpgradeSnsControlledCanister with Large Wasm integration test to use SNS CLI with PocketIc #3696

Merged
merged 11 commits into from
Jan 31, 2025

Conversation

aterga
Copy link
Contributor

@aterga aterga commented Jan 30, 2025

This PR leverages the SNS CLI functionality to prepare and submit UpgradeSnsControlledCanister proposals for large Wasms as part of the existing integration test scenario. The goal is to have the CLI functionality tested in CI. This entails the need to generalize the CLI command upgrade-sns-controlled-canister to work with a CallCanister instance which can be instantiated not only with ic-agent, but also with PocketIc instances.

@github-actions github-actions bot added the test label Jan 30, 2025
@aterga aterga force-pushed the arshavir/test-new-cli-3 branch from b9e6575 to 5c97ccf Compare January 31, 2025 12:12
@aterga aterga marked this pull request as ready for review January 31, 2025 12:15
@aterga aterga requested review from a team as code owners January 31, 2025 12:15
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.

If this pull request affects the behavior of any canister owned by
the Governance team, remember to update the corresponding
unreleased_changes.md file(s).

To acknowldge this reminder (and unblock the PR), dismiss this
code review by going to the bottom of the pull request page, and
supply one of the following reasons:

  1. Done.

  2. No canister behavior changes.

@aterga aterga enabled auto-merge January 31, 2025 12:36
@aterga aterga dismissed github-actions[bot]’s stale review January 31, 2025 16:59

No canister behavior changes.

@aterga aterga added this pull request to the merge queue Jan 31, 2025
Merged via the queue into master with commit 340f17d Jan 31, 2025
26 checks passed
@aterga aterga deleted the arshavir/test-new-cli-3 branch January 31, 2025 21:08
let controllers = self.pocket_ic.get_controllers(canister_id).await;

let Some(controller) = controllers.into_iter().last() else {
return Err(Self::Error::BlackHole);
Copy link
Contributor

@max-dfinity max-dfinity Jan 31, 2025

Choose a reason for hiding this comment

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

doesn't a blackholed canister still have a visible module_hash? Should this be treated as an error?

There should be a way, in the same way that we can query the IC mainnet canisters, to get that information without being a controller

Copy link
Contributor

Choose a reason for hiding this comment

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

The name "blackhole" could be a bit misleading as a blackhole canister typically still has a controller, e.g., itself, to fetch the module hash. This case is about a canister with no controller at all: in this case, we cannot use the mgmt canister to retrieve the module hash (only controllers can call the mgmt canister) and thus we can only make a read state request which is possible, but substantially more complex (see an example of getting subnet metrics which can only be retrieved by read state requests and thus the complexity is unavoidable). Yet another alternative would be to retrieve the module hash from the raw state directly (analogously to controllers).

@@ -30,7 +30,12 @@ async fn main() -> Result<()> {
SubCommand::List(args) => list::exec(args, &agent).await,
SubCommand::Health(args) => health::exec(args, &agent).await,
SubCommand::UpgradeSnsControlledCanister(args) => {
upgrade_sns_controlled_canister::exec(args, &agent).await
match upgrade_sns_controlled_canister::exec(args, &agent).await {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think with a little restructuring, you could have main only pass 'std::env::args()' into a function that parses and runs the function.

Then you could test, in unit tests, everything else (assuming you have a little bit of dependency injection for things with side effects you don't want to run in tests).

NCR, obviously, just an observation for future PRs

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.

4 participants