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

feat(sns): Create test-only function that can be used to advance the target version directly (rather than through a proposal) #1743

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anchpop
Copy link
Contributor

@anchpop anchpop commented Sep 30, 2024

This will be useful for testing the new SNS upgrade flow, because we will be able to easily trigger the process at arbitrary times without the complexity of going through the (relatively more complex) proposal mechanism.

This PR also creates a target_version field in SNS Go's proto. I'm not 100% sure this is the right choice though.

@github-actions github-actions bot added the feat label Sep 30, 2024
@@ -733,6 +734,14 @@ fn add_maturity_(request: AddMaturityRequest) -> AddMaturityResponse {
governance_mut().add_maturity(request)
}

#[cfg(feature = "test")]
#[export_name = "canister_update advance_target_version"]
fn advance_target_version(request: AdvanceTargetVersionRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why didn't this function end up in rs/sns/governance/canister/governance_test.did?

Copy link
Contributor Author

@anchpop anchpop Oct 1, 2024

Choose a reason for hiding this comment

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

Hmm, seems like it's not enforced by the candid type enforcement in CI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the candid type enforecment seems to specifically reject it, not sure what's going on here

#[export_name = "canister_update advance_target_version"]
fn advance_target_version(request: AdvanceTargetVersionRequest) {
over(candid_one, |request: AdvanceTargetVersionRequest| {
AdvanceTargetVersionResponse {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not implement this function in the same PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is the plan, however the scope of this PR has unfortunately grown and I may have to start splitting it up before merging it

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, let's keep this PR just for bumping the target in testing.

Note that it should still only be possible to advance the target using new_target, not go back to an older version (I recommend implementing that logic in this PR as well).

@anchpop
Copy link
Contributor Author

anchpop commented Oct 1, 2024

The scope of this PR has expanded, to the point where it is now starting to implement Periodic Task A. I think that should be brought into a separate PR, with this one just keeping the AdvanceSnsVersion endpoint.

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