MCMS: increase op count before invocation#151
Open
FelixFan1992 wants to merge 1 commit into
Open
Conversation
|
Code coverage report:
|
Soroban Contract Test Coverage92.76% line coverage — 18143 / 19559 lines hit
Per-Contract Breakdown
Full file-level coverage report |
Integration Test Coverage (excl. Token Pool) |
There was a problem hiding this comment.
Pull request overview
Updates the MCMS execute flow to persist the incremented op count before making the downstream contract invocation, aligning behavior with ManyChainMultiSig’s “increment-before-call” pattern and adding a regression test to ensure reverted downstream calls do not consume the nonce.
Changes:
- Persist
EXPIRING_ROOT.op_countbeforetry_invoke_contractto prevent same-nonce re-entrancy during the downstream call. - Add a revert-only mock callee and a new regression test ensuring
CallReverteddoes not consume the nonce. - Add a new snapshot for the added test; update
Cargo.lockaccordingly.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| contracts/mcms/src/lib.rs | Moves op-count persistence before downstream invocation to prevent re-entrancy on the same nonce. |
| contracts/mcms/src/test.rs | Adds ExecRevertMock, encode_revert, and a regression test covering reverted downstream calls and nonce behavior. |
| contracts/mcms/test_snapshots/test/test_execute_reverted_call_does_not_consume_nonce.1.json | Adds the snapshot fixture corresponding to the new test. |
| Cargo.lock | Lockfile updates reflecting dependency/workspace resolution after the changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+353
to
+358
| // Persist the incremented op_count BEFORE the downstream invoke, mirroring ManyChainMultiSig | ||
| // ("increase the counter *before* execution to prevent reentrancy issues"). A reentrant | ||
| // `execute` for the same nonce then reads the already-incremented op_count from storage and | ||
| // fails the nonce check. `try_invoke_contract` surfaces callee failures as `CallReverted`; | ||
| // as the top-level invocation that fails the transaction and rolls this write back, so a | ||
| // failed call still does not consume the nonce. |
Integration Test Coverage (Token Pool) |
JohnChangUK
approved these changes
Jul 18, 2026
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.
No description provided.