Skip to content

Commit b3f5ffd

Browse files
authored
chore: replace mcms helpers usages [OPT-1911] (#22019)
chore: replace MCMS helper usages with cldf imports
1 parent b8c8ec2 commit b3f5ffd

76 files changed

Lines changed: 314 additions & 595 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

deployment/ccip/changeset/aptos/adapters/mcmsreader.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import (
77
aptosmcms "github.com/smartcontractkit/mcms/sdk/aptos"
88
mcmstypes "github.com/smartcontractkit/mcms/types"
99

10+
cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils"
11+
1012
mcms_utils "github.com/smartcontractkit/chainlink-ccip/deployment/utils/mcms"
1113
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
1214
"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
1315

1416
"github.com/smartcontractkit/chainlink/deployment/ccip/shared/stateview/aptos"
15-
"github.com/smartcontractkit/chainlink/deployment/common/proposalutils"
1617
)
1718

1819
// AptosCurseMCMSReader implements changesets.MCMSReader for the Aptos family,
@@ -37,7 +38,7 @@ func (r *AptosCurseMCMSReader) GetChainMetadata(e deployment.Environment, chainS
3738
}
3839
curseMCMSAddr := state.CurseMCMSAddress
3940

40-
role, err := proposalutils.GetAptosRoleFromAction(input.TimelockAction)
41+
role, err := cldfproposalutils.GetAptosRoleFromAction(input.TimelockAction)
4142
if err != nil {
4243
return mcmstypes.ChainMetadata{}, fmt.Errorf("failed to get role from action: %w", err)
4344
}

deployment/ccip/changeset/aptos/cs_deploy_aptos_chain_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/smartcontractkit/chainlink-deployments-framework/chain"
2020
aptoschain "github.com/smartcontractkit/chainlink-deployments-framework/chain/aptos"
2121
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
22+
cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers"
2223
"github.com/smartcontractkit/chainlink-deployments-framework/engine/test/environment"
2324
"github.com/smartcontractkit/chainlink-deployments-framework/engine/test/runtime"
2425

@@ -109,9 +110,9 @@ func TestDeployAptosChainImp_VerifyPreconditions(t *testing.T) {
109110
},
110111
MCMSDeployConfigPerChain: map[uint64]types.MCMSWithTimelockConfigV2{
111112
4457093679053095497: {
112-
Canceller: proposalutils.SingleGroupMCMSV2(t),
113-
Proposer: proposalutils.SingleGroupMCMSV2(t),
114-
Bypasser: proposalutils.SingleGroupMCMSV2(t),
113+
Canceller: cldftesthelpers.SingleGroupMCMS(t),
114+
Proposer: cldftesthelpers.SingleGroupMCMS(t),
115+
Bypasser: cldftesthelpers.SingleGroupMCMS(t),
115116
TimelockMinDelay: nil, // Invalid min delay
116117
},
117118
},
@@ -260,9 +261,9 @@ func TestDeployAptosChain_Apply(t *testing.T) {
260261
},
261262
MCMSDeployConfigPerChain: map[uint64]types.MCMSWithTimelockConfigV2{
262263
selector: {
263-
Canceller: proposalutils.SingleGroupMCMSV2(t),
264-
Proposer: proposalutils.SingleGroupMCMSV2(t),
265-
Bypasser: proposalutils.SingleGroupMCMSV2(t),
264+
Canceller: cldftesthelpers.SingleGroupMCMS(t),
265+
Proposer: cldftesthelpers.SingleGroupMCMS(t),
266+
Bypasser: cldftesthelpers.SingleGroupMCMS(t),
266267
TimelockMinDelay: big.NewInt(1),
267268
},
268269
},
@@ -277,7 +278,7 @@ func TestDeployAptosChain_Apply(t *testing.T) {
277278

278279
err = rt.Exec(
279280
runtime.ChangesetTask(DeployAptosChain{}, ccipConfig),
280-
runtime.SignAndExecuteProposalsTask([]*ecdsa.PrivateKey{proposalutils.TestXXXMCMSSigner}),
281+
runtime.SignAndExecuteProposalsTask([]*ecdsa.PrivateKey{cldftesthelpers.TestXXXMCMSSigner}),
281282
)
282283
require.NoError(t, err)
283284

deployment/ccip/changeset/aptos/test_helpers.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ import (
99
"github.com/stretchr/testify/assert"
1010
"github.com/stretchr/testify/require"
1111

12+
cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers"
13+
1214
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
15+
1316
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset/aptos/config"
1417
"github.com/smartcontractkit/chainlink/deployment/ccip/shared"
15-
"github.com/smartcontractkit/chainlink/deployment/common/proposalutils"
1618
"github.com/smartcontractkit/chainlink/deployment/common/types"
1719
)
1820

@@ -76,9 +78,9 @@ func GetMockChainContractParams(t *testing.T, chainSelector uint64) config.Chain
7678

7779
func getMockMCMSConfig(t *testing.T) types.MCMSWithTimelockConfigV2 {
7880
return types.MCMSWithTimelockConfigV2{
79-
Canceller: proposalutils.SingleGroupMCMSV2(t),
80-
Proposer: proposalutils.SingleGroupMCMSV2(t),
81-
Bypasser: proposalutils.SingleGroupMCMSV2(t),
81+
Canceller: cldftesthelpers.SingleGroupMCMS(t),
82+
Proposer: cldftesthelpers.SingleGroupMCMS(t),
83+
Bypasser: cldftesthelpers.SingleGroupMCMS(t),
8284
TimelockMinDelay: big.NewInt(1),
8385
}
8486
}

deployment/ccip/changeset/aptos/utils/mcms.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
"github.com/smartcontractkit/chainlink-aptos/bindings/compile"
1717
mcmsbind "github.com/smartcontractkit/chainlink-aptos/bindings/mcms"
1818
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
19+
cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils"
20+
1921
"github.com/smartcontractkit/chainlink/deployment/common/proposalutils"
2022
)
2123

@@ -30,7 +32,7 @@ func GenerateProposal(
3032
mcmsCfg proposalutils.TimelockConfig,
3133
) (*mcms.TimelockProposal, error) {
3234
// Get role from action
33-
role, err := proposalutils.GetAptosRoleFromAction(mcmsCfg.MCMSAction)
35+
role, err := cldfproposalutils.GetAptosRoleFromAction(mcmsCfg.MCMSAction)
3436
if err != nil {
3537
return nil, fmt.Errorf("failed to get role from action: %w", err)
3638
}
@@ -60,7 +62,7 @@ func GenerateCurseMCMSProposal(
6062
description string,
6163
mcmsCfg proposalutils.TimelockConfig,
6264
) (*mcms.TimelockProposal, error) {
63-
role, err := proposalutils.GetAptosRoleFromAction(mcmsCfg.MCMSAction)
65+
role, err := cldfproposalutils.GetAptosRoleFromAction(mcmsCfg.MCMSAction)
6466
if err != nil {
6567
return nil, fmt.Errorf("failed to get role from action: %w", err)
6668
}

deployment/ccip/changeset/crossfamily/v1_6/cs_add_evm_solana_lane_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"github.com/gagliardetto/solana-go"
1111
"github.com/stretchr/testify/require"
1212

13+
cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers"
14+
1315
chain_selectors "github.com/smartcontractkit/chain-selectors"
1416
"github.com/smartcontractkit/quarantine"
1517

@@ -149,11 +151,11 @@ func TestAddEVMSolanaLaneBidirectional(t *testing.T) {
149151
// if MCMS is enabled, we need to run the proposal
150152
if tc.mcmsEnabled {
151153
for _, prop := range out.MCMSTimelockProposals {
152-
mcmProp := proposalutils.SignMCMSTimelockProposal(t, e, &prop, false)
154+
mcmProp := cldftesthelpers.SignMCMSTimelockProposal(t, e, &prop, false)
153155
// return the error so devs can ensure expected reversions
154-
err = proposalutils.ExecuteMCMSProposalV2(t, e, mcmProp)
156+
err = cldftesthelpers.ExecuteMCMSProposalV2(t, e, mcmProp)
155157
require.NoError(t, err)
156-
err = proposalutils.ExecuteMCMSTimelockProposalV2(t, e, &prop)
158+
err = cldftesthelpers.ExecuteMCMSTimelockProposalV2(t, e, &prop)
157159
require.NoError(t, err)
158160
}
159161
}

deployment/ccip/changeset/solana_v0_1_1/transfer_ccip_to_mcms_with_timelock_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
chainselectors "github.com/smartcontractkit/chain-selectors"
1212
"github.com/stretchr/testify/require"
1313

14+
cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers"
15+
1416
"github.com/smartcontractkit/chainlink-ccip/chains/solana/contracts/tests/testutils"
1517
burnmint "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/v0_1_1/burnmint_token_pool"
1618
"github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/v0_1_1/ccip_offramp"
@@ -275,9 +277,9 @@ func prepareEnvironmentForOwnershipTransfer(t *testing.T) (cldf.Environment, sta
275277
cldf.CreateLegacyChangeSet(commonchangeset.DeployMCMSWithTimelockV2),
276278
map[uint64]commontypes.MCMSWithTimelockConfigV2{
277279
solChainSel: {
278-
Canceller: proposalutils.SingleGroupMCMSV2(t),
279-
Proposer: proposalutils.SingleGroupMCMSV2(t),
280-
Bypasser: proposalutils.SingleGroupMCMSV2(t),
280+
Canceller: cldftesthelpers.SingleGroupMCMS(t),
281+
Proposer: cldftesthelpers.SingleGroupMCMS(t),
282+
Bypasser: cldftesthelpers.SingleGroupMCMS(t),
281283
TimelockMinDelay: big.NewInt(0),
282284
},
283285
},

deployment/ccip/changeset/testhelpers/test_helpers_aptos.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
mcmstypes "github.com/smartcontractkit/mcms/types"
1818
"github.com/stretchr/testify/require"
1919

20+
cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers"
21+
2022
aptosBind "github.com/smartcontractkit/chainlink-aptos/bindings/bind"
2123
"github.com/smartcontractkit/chainlink-aptos/bindings/ccip"
2224
"github.com/smartcontractkit/chainlink-aptos/bindings/ccip_dummy_receiver"
@@ -39,6 +41,7 @@ import (
3941
"github.com/smartcontractkit/chainlink-common/pkg/logger"
4042
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
4143
"github.com/smartcontractkit/chainlink-evm/gethwrappers/shared/generated/initial/burn_mint_erc677"
44+
4245
"github.com/smartcontractkit/chainlink/deployment"
4346
aptoscs "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/aptos"
4447
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset/aptos/config"
@@ -82,9 +85,9 @@ func DeployChainContractsToAptosCS(t *testing.T, e DeployedEnv, chainSelector ui
8285
},
8386
MCMSDeployConfigPerChain: map[uint64]commontypes.MCMSWithTimelockConfigV2{
8487
chainSelector: {
85-
Canceller: proposalutils.SingleGroupMCMSV2(t),
86-
Proposer: proposalutils.SingleGroupMCMSV2(t),
87-
Bypasser: proposalutils.SingleGroupMCMSV2(t),
88+
Canceller: cldftesthelpers.SingleGroupMCMS(t),
89+
Proposer: cldftesthelpers.SingleGroupMCMS(t),
90+
Bypasser: cldftesthelpers.SingleGroupMCMS(t),
8891
TimelockMinDelay: big.NewInt(1),
8992
},
9093
},

deployment/ccip/changeset/testhelpers/test_helpers_solana_v0_1_0.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import (
2828
"github.com/stretchr/testify/require"
2929
"golang.org/x/sync/errgroup"
3030

31+
cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers"
32+
3133
aptos_fee_quoter "github.com/smartcontractkit/chainlink-aptos/bindings/ccip/fee_quoter"
3234
"github.com/smartcontractkit/chainlink-aptos/bindings/helpers"
3335
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_2_0/router"
@@ -68,6 +70,7 @@ import (
6870
tonOps "github.com/smartcontractkit/chainlink-ton/deployment/ccip"
6971
tonCfg "github.com/smartcontractkit/chainlink-ton/deployment/ccip/config"
7072
tonrouter "github.com/smartcontractkit/chainlink-ton/pkg/ccip/bindings/router"
73+
7174
"github.com/smartcontractkit/chainlink/deployment"
7275
aptoscs "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/aptos"
7376
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset/aptos/config"
@@ -2445,9 +2448,9 @@ func TransferOwnershipSolanaV0_1_0(
24452448
cldf.CreateLegacyChangeSet(commoncs.DeployMCMSWithTimelockV2),
24462449
map[uint64]commontypes.MCMSWithTimelockConfigV2{
24472450
solSelector: {
2448-
Canceller: proposalutils.SingleGroupMCMSV2(t),
2449-
Proposer: proposalutils.SingleGroupMCMSV2(t),
2450-
Bypasser: proposalutils.SingleGroupMCMSV2(t),
2451+
Canceller: cldftesthelpers.SingleGroupMCMS(t),
2452+
Proposer: cldftesthelpers.SingleGroupMCMS(t),
2453+
Bypasser: cldftesthelpers.SingleGroupMCMS(t),
24512454
TimelockMinDelay: big.NewInt(0),
24522455
},
24532456
},

deployment/ccip/changeset/testhelpers/test_helpers_solana_v0_1_1.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
"github.com/gagliardetto/solana-go/rpc"
1818
"github.com/stretchr/testify/require"
1919

20+
cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers"
21+
2022
tonOps "github.com/smartcontractkit/chainlink-ton/deployment/ccip"
2123
tonrouter "github.com/smartcontractkit/chainlink-ton/pkg/ccip/bindings/router"
2224

@@ -64,9 +66,9 @@ func TransferOwnershipSolanaV0_1_1(
6466
cldf.CreateLegacyChangeSet(commoncs.DeployMCMSWithTimelockV2),
6567
map[uint64]commontypes.MCMSWithTimelockConfigV2{
6668
solSelector: {
67-
Canceller: proposalutils.SingleGroupMCMSV2(t),
68-
Proposer: proposalutils.SingleGroupMCMSV2(t),
69-
Bypasser: proposalutils.SingleGroupMCMSV2(t),
69+
Canceller: cldftesthelpers.SingleGroupMCMS(t),
70+
Proposer: cldftesthelpers.SingleGroupMCMS(t),
71+
Bypasser: cldftesthelpers.SingleGroupMCMS(t),
7072
TimelockMinDelay: big.NewInt(0),
7173
},
7274
},

deployment/ccip/changeset/testhelpers/test_token_helpers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/smartcontractkit/chainlink-deployments-framework/engine/test/environment"
2222
"github.com/smartcontractkit/chainlink-deployments-framework/engine/test/runtime"
2323

24+
cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers"
2425
"github.com/smartcontractkit/chainlink/deployment"
2526
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset"
2627
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5_1"
@@ -140,7 +141,7 @@ func SetupTwoChainEnvironmentWithTokens(
140141
MinDelay: 0 * time.Second,
141142
},
142143
}),
143-
runtime.SignAndExecuteProposalsTask([]*ecdsa.PrivateKey{proposalutils.TestXXXMCMSSigner}),
144+
runtime.SignAndExecuteProposalsTask([]*ecdsa.PrivateKey{cldftesthelpers.TestXXXMCMSSigner}),
144145
)
145146
require.NoError(t, err)
146147
}

0 commit comments

Comments
 (0)