NONEVM-5256: MCMS cap object transfer fix#409
Draft
FelixFan1992 wants to merge 6 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the MCMS deployer to support releasing an UpgradeCap by an explicit package address (to handle cases where the cap is re-keyed after commit_upgrade), and expands unit tests and generated Go bindings accordingly.
Changes:
- Add
release_upgrade_cap_atand refactorrelease_upgrade_capinto a wrapper (in bothmcmsandfast_mcmsMove packages). - Update MCMS deployer tests to register caps under a separate “package key” and add coverage for release behavior before/after
commit_upgrade. - Regenerate Go bindings to include
release_upgrade_cap_at.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/mcms/mcms/sources/mcms_deployer.move | Adds release_upgrade_cap_at and updates release_upgrade_cap wrapper/docs. |
| contracts/mcms/fast_mcms/sources/mcms_deployer.move | Mirrors the deployer changes in the fast_mcms package. |
| contracts/mcms/mcms/tests/mcms_deployer_test.move | Updates existing tests and adds new tests for release_upgrade_cap_at behavior. |
| contracts/mcms/fast_mcms/tests/mcms_deployer_test.move | Mirrors the test updates for fast_mcms. |
| bindings/generated/mcms/mcms_deployer/mcms_deployer.go | Adds binding support for release_upgrade_cap_at. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
169
to
173
| assert!(proof_type == expected_proof_type, EWrongProofType); | ||
|
|
||
| let package_address = address::from_ascii_bytes(&proof_account_address.into_bytes()); | ||
| assert!(state.upgrade_caps.contains(package_address), EPackageAddressNotRegistered); | ||
|
|
||
| let upgrade_cap = state.upgrade_caps.remove(package_address); |
Comment on lines
169
to
173
| assert!(proof_type == expected_proof_type, EWrongProofType); | ||
|
|
||
| let package_address = address::from_ascii_bytes(&proof_account_address.into_bytes()); | ||
| assert!(state.upgrade_caps.contains(package_address), EPackageAddressNotRegistered); | ||
|
|
||
| let upgrade_cap = state.upgrade_caps.remove(package_address); |
Comment on lines
+151
to
155
| public fun release_upgrade_cap_at<T: drop>( | ||
| state: &mut DeployerState, | ||
| registry: &Registry, | ||
| package_address: address, | ||
| _proof: T, |
Comment on lines
+151
to
155
| public fun release_upgrade_cap_at<T: drop>( | ||
| state: &mut DeployerState, | ||
| registry: &Registry, | ||
| package_address: address, | ||
| _proof: T, |
| ts::next_tx(scenario, @0xA); | ||
| let ctx = ts::ctx(scenario); | ||
| let publisher = package::test_claim(MCMS_DEPLOYER_TEST {}, ctx); | ||
| let package_address = address::from_ascii_bytes(&(*publisher.package()).into_bytes()); |
| ts::next_tx(&mut scenario, @0xA); | ||
| let ctx = ts::ctx(&mut scenario); | ||
| let publisher = package::test_claim(MCMS_DEPLOYER_TEST {}, ctx); | ||
| let package_address = address::from_ascii_bytes(&(*publisher.package()).into_bytes()); |
| ts::next_tx(scenario, @0xA); | ||
| let ctx = ts::ctx(scenario); | ||
| let publisher = package::test_claim(MCMS_DEPLOYER_TEST {}, ctx); | ||
| let package_address = address::from_ascii_bytes(&(*publisher.package()).into_bytes()); |
| ts::next_tx(&mut scenario, @0xA); | ||
| let ctx = ts::ctx(&mut scenario); | ||
| let publisher = package::test_claim(MCMS_DEPLOYER_TEST {}, ctx); | ||
| let package_address = address::from_ascii_bytes(&(*publisher.package()).into_bytes()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Issue ticket number and link
Describe highly relevant files or code snippets that are critical in the review
Are there other PRs that should be merged first?