Skip to content

chore: port mcms helpers from chainlink/deployment#923

Open
ecPablo wants to merge 2 commits intomainfrom
ecpablo/port-mcms-helpers-core
Open

chore: port mcms helpers from chainlink/deployment#923
ecPablo wants to merge 2 commits intomainfrom
ecpablo/port-mcms-helpers-core

Conversation

@ecPablo
Copy link
Copy Markdown
Contributor

@ecPablo ecPablo commented Apr 10, 2026

We are porting the code in https://github.com/smartcontractkit/chainlink/blob/develop/deployment/common/proposalutils/mcms_helpers.go to CLDF in order to remove deps on core repo for some downstream consumers. The functions were splitted in separate files to keep them under semantically meaningful names. Also added unit tests and fixed some obvious issues pointed out by copilot, but in general keeping the logic as close as possible to what we have in core today.

  1. McmsInspectorForChain in core repo -> moved to experimental/proposalutils/inspectors.go in CLDF.
  2. BatchOperationForChain and TransactionForChain moved to experimental/proposalutils/operations.goin CLDF
  3. test_helpers.go and types.go are moved as is from core repo to CLDF

Followup PRs in core will attempt to replace usages with these. So we can delete the mcms_helpers.go from core

AI Summary

This pull request ports the proposalutils helpers from the chainlink/deployment repository into the chainlink-deployments-framework, making them part of the framework and improving proposal creation, inspection, and testing across multiple blockchain environments. The main changes include adding utility functions for proposal operations, inspectors, and test helpers, as well as defining relevant types and constants for MCMS (Many Chain Multisig) and timelock configurations.

New proposal utilities and helpers:

  • Added experimental/proposalutils/inspectors.go providing functions to build MCMS inspectors for different chains, supporting optional timelock actions and mass inspector creation.
  • Added experimental/proposalutils/operations.go with helpers to create transactions and batch operations for different chain families (EVM, Solana), abstracting over chain-specific details.

Testing support:

  • Added experimental/proposalutils/test_helpers.go containing test helpers for signing and executing MCMS proposals and timelock proposals, as well as generating single-group configs and finding call proxy addresses for tests.

Types and constants:

  • Added experimental/proposalutils/types.go defining types and constants for MCMS roles, contract types, and configuration structures (including gas boost config), supporting both legacy and new MCMS config formats.

Changelog:

  • Updated the changeset to document the addition of proposalutils helpers to the framework.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: fcb9b90

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
chainlink-deployments-framework Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as low quality.

@ecPablo ecPablo force-pushed the ecpablo/port-mcms-helpers-core branch from 1302167 to 4dc6446 Compare April 10, 2026 20:17
@cl-sonarqube-production
Copy link
Copy Markdown

@ecPablo ecPablo marked this pull request as ready for review April 13, 2026 14:19
@ecPablo ecPablo requested a review from a team as a code owner April 13, 2026 14:19
Copilot AI review requested due to automatic review settings April 13, 2026 14:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.


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

Comment on lines +154 to +158
family, err := chainsel.GetSelectorFamily(uint64(chainSelector))
if err != nil {
return fmt.Errorf("[ExecuteMCMSProposalV2] failed to get chain family for selector %d: %w", chainSelector, err)
}

Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

ExecuteMCMSProposalV2 determines the chain family but only confirms transactions for EVM and Aptos; all other families (e.g., TON, TRON, Sui) will silently skip confirmation, which can leave tests in an incorrect state (transactions unconfirmed) while still returning nil. Consider switching on family with an explicit default error, or routing confirmation through a shared helper similar to engine/test/internal/mcmsutils/executor.go:360-392 so each supported family is handled intentionally (including NOOP where appropriate, e.g., Solana).

Copilot uses AI. Check for mistakes.
Comment on lines +192 to +196
family, err := chainsel.GetSelectorFamily(uint64(op.ChainSelector))
if err != nil {
return fmt.Errorf("[ExecuteMCMSProposalV2] failed to get chain family for selector %d: %w", op.ChainSelector, err)
}

Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Same issue as the SetRoot loop: after computing family, the code only has confirmation branches for EVM and Aptos. For any other chain family present in the proposal, the operation tx will not be confirmed and the helper may still report success. Add an explicit default branch (or shared confirmation helper) so non-(EVM/Aptos/Solana) families don’t get silently skipped.

Copilot uses AI. Check for mistakes.
return string(role)
}

type MCMSWithTimelockConfig struct {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We still have code using this old one?


if tt.wantErr != "" {
require.Error(t, err)
assert.Contains(t, err.Error(), tt.wantErr)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can use ErrorContains


if tt.wantErr != "" {
require.Error(t, err)
assert.Contains(t, err.Error(), tt.wantErr)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can use ErrorContains

mcmstypes "github.com/smartcontractkit/mcms/types"
)

func TransactionForChain(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

should we add some godoc comments for this and BatchOperationForChain? Can include info such as chain supported?


if tt.wantErr != "" {
require.Error(t, err)
assert.Contains(t, err.Error(), tt.wantErr)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can use ErrorContains


var opts mcmsInspectorOptions
WithTimelockAction(tt.action)(&opts)
assert.Equal(t, tt.wantAction, opts.TimelockAction)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i wonder if we can just get rid of wantAction and use action ?

Suggested change
assert.Equal(t, tt.wantAction, opts.TimelockAction)
assert.Equal(t, tt.action, opts.TimelockAction)


type MCMSInspectorOption func(*mcmsInspectorOptions)

func WithTimelockAction(action mcmstypes.TimelockAction) MCMSInspectorOption {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

some go docs for these exported methods would be helpful?

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.

4 participants