Skip to content

feat: multi mcms per selector - #822

Closed
stackman27 wants to merge 1 commit into
mainfrom
sish/multi-mcms-per-selector
Closed

feat: multi mcms per selector#822
stackman27 wants to merge 1 commit into
mainfrom
sish/multi-mcms-per-selector

Conversation

@stackman27

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings August 5, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds multi-MCM instance support per chain selector (proposal version v2), enabling operation attribution to a specific MCM contract instance and ensuring Merkle metadata, op counts, nonces, and root-setting behavior are computed per instance (not just per chain).

Changes:

  • Introduces mcmAddress attribution on Operation/BatchOperation and additionalMCMs on ChainMetadata, including merge/validation helpers.
  • Updates proposal hashing, nonce derivation, timelock conversion sequencing, and executable root-setting to work per (chain selector, MCM instance).
  • Extends SDK executors/encoders with an optional per-instance root-setting path (sdk.InstanceExecutor) to ensure on-chain root metadata matches per-instance Merkle leaves.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
types/operation.go Adds optional mcmAddress to operation types for per-instance attribution.
types/chain.go Adds AdditionalMCMs plus helpers for per-instance lookup/merge/validation.
types/chain_test.go Adds unit tests for multi-MCM metadata helpers and merging.
timelock_proposal.go Gates multi-MCM features on v2; resolves per-instance metadata and timelock address.
timelock_executable.go Uses proposal helper to resolve the timelock address per batch op.
signable.go Adds per-instance quorum checking and updates signature validation across instances.
sdk/ton/executor.go Adds per-instance SetRoot path using explicit txCount for metadata encoding.
sdk/ton/encoder.go Adds ToRootMetadataWithTxCount for per-instance postOpCount derivation.
sdk/sui/executor.go Adds per-instance SetRoot path using explicit txCount.
sdk/solana/executor.go Adds per-instance SetRoot path and threads txCount into metadata input.
sdk/executor.go Introduces optional sdk.InstanceExecutor for per-instance SetRoot semantics.
sdk/evm/executor.go Adds per-instance SetRoot path using explicit txCount.
sdk/evm/encoder.go Adds ToGethRootMetadataWithTxCount for per-instance postOpCount derivation.
sdk/canton/executor.go Adds per-instance SetRoot path using explicit txCount.
sdk/aptos/executor.go Adds per-instance SetRoot path using explicit txCount.
proposal.go Implements v2 + multi-MCM validation, per-instance metadata leaves, and per-instance nonces/encoders.
proposal_multimcm_test.go Adds integration-style tests covering validation, Merkle determinism, conversion, and execution flows.
merge.go Enhances timelock proposal merging to union compatible multi-MCM instance sets deterministically.
executable.go Adds per-instance encoder usage and per-instance root-setting via sdk.InstanceExecutor.
executable_test.go Adds EVM simulated test verifying SetRoot + Execute across two MCM instances.
builder.go Adds builder helper for appending AdditionalMCMs entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread timelock_proposal.go
Comment on lines +157 to +161
if bop.McmAddress == metadata.MCMAddress {
return m.TimelockAddresses[bop.ChainSelector]
}

return bop.McmAddress
Comment thread signable.go
Comment on lines +174 to +179
metadata, ok := s.proposal.ChainMetadata[chain].GetMCM(mcmAddress)
if !ok {
return false, fmt.Errorf(
"chain %d: mcmAddress %q does not match the chain's primary MCM or any additional MCM instance",
chain, mcmAddress)
}
Comment thread signable.go
Comment on lines +216 to +220
for chain, metadata := range s.proposal.ChainMetadata {
for _, instance := range metadata.AllMCMs() {
checkQuorum, err := s.CheckQuorumForMCM(ctx, chain, instance.MCMAddress)
if err != nil {
return false, err
Comment thread builder.go
Comment on lines +54 to +56
entry := b.baseProposal.ChainMetadata[selector]
entry.AdditionalMCMs = append(entry.AdditionalMCMs, metadata)
b.baseProposal.ChainMetadata[selector] = entry
Comment thread proposal.go
Comment on lines +414 to +420
md, err := p.mcmMetadataForOp(o)
if err != nil {
counts[instanceKey{chainSelector: o.ChainSelector}]++
continue
}
counts[instanceKey{chainSelector: o.ChainSelector, mcmAddress: md.MCMAddress}]++
}
@stackman27 stackman27 closed this Aug 5, 2026
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