Skip to content

Commit

Permalink
feat: update mcms lib with new timelock converter and update BuildPro…
Browse files Browse the repository at this point in the history
…posalFromBatches() for solana chain metadata (#16528)

* feat: update mcms lib with new timelock converter and update BuildProposalFromBatchesV2() to accept env for extracting solana metadata.

* feat: update go mod to new mcms and ccip-solana version

* feat: update go mod to new mcms and ccip-solana version

* fix: go mod

* fix: go mod

* fix: go mod core scripts

* chore: add changeset

* fix: update tx field name to RawData

* fix: more cleanup

- update tests
- go mod tidy
- delete comments
- other bug fixes

* fix: break dep cycle

for state package, stop relying on proposalutils package so the `buildProposalMetadataV2` can call `MaybeLoadMCMSWithTimelockChainStateSolana`

* fix: merge conflicts develop

* fix: go sum

* fix: update lib

* fix: upgrade ccip solana

* fix: downgrade ccip solana for rest of core packages and chainlink/deployment

* fix: go mod core scripts add replace

* fix: downgrade solana from mcms lib

* fix: merge conflicts develop

* fix: merge conflicts develop

* fix: go mod deps

* fix: params in solana utils

---------

Co-authored-by: Graham Goh <[email protected]>
  • Loading branch information
ecPablo and graham-chainlink authored Feb 26, 2025
1 parent 6dbafa7 commit 396fe0a
Show file tree
Hide file tree
Showing 42 changed files with 238 additions and 141 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-geese-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#updated update mcms lib dependency.
3 changes: 1 addition & 2 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ require (
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250213203720-e15b1333a14a // indirect
github.com/smartcontractkit/chainlink-testing-framework/framework v0.5.3 // indirect
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect
github.com/smartcontractkit/mcms v0.10.0 // indirect
github.com/smartcontractkit/mcms v0.12.2 // indirect
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de // indirect
github.com/smartcontractkit/wsrpc v0.8.3 // indirect
Expand Down Expand Up @@ -454,6 +454,5 @@ replace (
github.com/btcsuite/btcd/btcec/v2 => github.com/btcsuite/btcd/btcec/v2 v2.3.2
// replicating the replace directive on cosmos SDK
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

github.com/sourcegraph/sourcegraph/lib => github.com/sourcegraph/sourcegraph-public-snapshot/lib v0.0.0-20240822153003-c864f15af264
)
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,8 @@ github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12i
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA=
github.com/smartcontractkit/libocr v0.0.0-20250220133800-f3b940c4f298 h1:PKiqnVOTChlH4a4ljJKL3OKGRgYfIpJS4YD1daAIKks=
github.com/smartcontractkit/libocr v0.0.0-20250220133800-f3b940c4f298/go.mod h1:Mb7+/LC4edz7HyHxX4QkE42pSuov4AV68+AxBXAap0o=
github.com/smartcontractkit/mcms v0.10.0 h1:wkBAr8HLyHKwejdwsDOMvIwmzT83tKr3jjB9senLahM=
github.com/smartcontractkit/mcms v0.10.0/go.mod h1:3N7+yvkO3hIFXYRYm3hxKCE6qDWdOC/rZdvIrwzlLKk=
github.com/smartcontractkit/mcms v0.12.2 h1:CTeQmtdYOdqWLuiGHNS67qqEdtJO8r8AygOYN/VpaZM=
github.com/smartcontractkit/mcms v0.12.2/go.mod h1:RKo4v2ClzKPHyllstwVeqdPP7Bb5v+qMMPgO8iMq0Qc=
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de h1:n0w0rKF+SVM+S3WNlup6uabXj2zFlFNfrlsKCMMb/co=
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de/go.mod h1:Sl2MF/Fp3fgJIVzhdGhmZZX2BlnM0oUUyBP4s4xYb6o=
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de h1:66VQxXx3lvTaAZrMBkIcdH9VEjujUEvmBQdnyOJnkOc=
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/deployer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (d *DeployerGroup) enactMcms() (deployment.ChangesetOutput, error) {
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
d.e.GetContext(),
d.e,
timelocks,
proposerMcms,
inspectors,
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/solana/cs_deploy_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func DeployChainContractsChangeset(e deployment.Environment, c DeployChainContra

if len(batches) > 0 {
proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func TransferCCIPToMCMSWithTimelockSolana(
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/solana/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func BuildProposalsForTxns(
Transactions: txns,
})
proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/v1_5/cs_rmn.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func PermaBlessCommitStoreChangeset(env deployment.Environment, c PermaBlessComm
}

timelockProposal, err := proposalutils.BuildProposalFromBatchesV2(
env.GetContext(),
env,
timelocks,
proposerMcms,
inspectors,
Expand Down
10 changes: 5 additions & 5 deletions deployment/ccip/changeset/v1_6/cs_ccip_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ func PromoteCandidateChangeset(
batches := []mcmstypes.BatchOperation{{ChainSelector: mcmstypes.ChainSelector(cfg.HomeChainSelector), Transactions: mcmsTxs}}

prop, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -686,7 +686,7 @@ func AddDonAndSetCandidateChangeset(
batches := []mcmstypes.BatchOperation{{ChainSelector: mcmstypes.ChainSelector(cfg.HomeChainSelector), Transactions: donMcmsTxs}}

prop, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -875,7 +875,7 @@ func SetCandidateChangeset(
batches := []mcmstypes.BatchOperation{{ChainSelector: mcmstypes.ChainSelector(cfg.HomeChainSelector), Transactions: setCandidateMcmsTxs}}

prop, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -1163,7 +1163,7 @@ func RevokeCandidateChangeset(e deployment.Environment, cfg RevokeCandidateChang
batches := []mcmstypes.BatchOperation{{ChainSelector: mcmstypes.ChainSelector(cfg.HomeChainSelector), Transactions: ops}}

prop, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -1369,7 +1369,7 @@ func UpdateChainConfigChangeset(e deployment.Environment, cfg UpdateChainConfigC
}

prop, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down
30 changes: 15 additions & 15 deletions deployment/ccip/changeset/v1_6/cs_chain_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func UpdateNonceManagersChangeset(e deployment.Environment, cfg UpdateNonceManag
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -393,7 +393,7 @@ func UpdateOnRampsDestsChangeset(e deployment.Environment, cfg UpdateOnRampDests
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -508,7 +508,7 @@ func UpdateOnRampDynamicConfigChangeset(e deployment.Environment, cfg UpdateOnRa
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(), timelocks, proposers, inspectors, batches,
e, timelocks, proposers, inspectors, batches,
"update onramp dynamic config",
cfg.MCMS.MinDelay)
if err != nil {
Expand Down Expand Up @@ -666,7 +666,7 @@ func UpdateOnRampAllowListChangeset(e deployment.Environment, cfg UpdateOnRampAl
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -768,7 +768,7 @@ func WithdrawOnRampFeeTokensChangeset(e deployment.Environment, cfg WithdrawOnRa
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -935,7 +935,7 @@ func UpdateFeeQuoterPricesChangeset(e deployment.Environment, cfg UpdateFeeQuote
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -1056,7 +1056,7 @@ func UpdateFeeQuoterDestsChangeset(e deployment.Environment, cfg UpdateFeeQuoter
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -1196,7 +1196,7 @@ func UpdateOffRampSourcesChangeset(e deployment.Environment, cfg UpdateOffRampSo
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -1376,7 +1376,7 @@ func UpdateRouterRampsChangeset(e deployment.Environment, cfg UpdateRouterRampsC
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -1518,7 +1518,7 @@ func SetOCR3OffRampChangeset(e deployment.Environment, cfg SetOCR3OffRampConfig)
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -1632,7 +1632,7 @@ func UpdateDynamicConfigOffRampChangeset(e deployment.Environment, cfg UpdateDyn
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down Expand Up @@ -1854,7 +1854,7 @@ func ApplyFeeTokensUpdatesFeeQuoterChangeset(e deployment.Environment, cfg Apply
return deployment.ChangesetOutput{}, nil
}
p, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectorPerChain,
Expand Down Expand Up @@ -2007,7 +2007,7 @@ func UpdateTokenPriceFeedsFeeQuoterChangeset(e deployment.Environment, cfg Updat
return deployment.ChangesetOutput{}, nil
}
p, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectorPerChain,
Expand Down Expand Up @@ -2131,7 +2131,7 @@ func ApplyPremiumMultiplierWeiPerEthUpdatesFeeQuoterChangeset(e deployment.Envir
return deployment.ChangesetOutput{}, nil
}
p, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectorPerChain,
Expand Down Expand Up @@ -2311,7 +2311,7 @@ func ApplyTokenTransferFeeConfigUpdatesFeeQuoterChangeset(e deployment.Environme
return deployment.ChangesetOutput{}, nil
}
p, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectorPerChain,
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/v1_6/cs_home_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func RemoveDONs(e deployment.Environment, cfg RemoveDONsConfig) (deployment.Chan
inspectors := map[uint64]mcmssdk.Inspector{cfg.HomeChainSel: mcmsevmsdk.NewInspector(homeChain.Client)}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposerMcms,
inspectors,
Expand Down
8 changes: 4 additions & 4 deletions deployment/ccip/changeset/v1_6/cs_update_rmn_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func SetRMNRemoteOnRMNProxyChangeset(e deployment.Environment, cfg SetRMNRemoteO
}

prop, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposerMcms,
inspectors,
Expand Down Expand Up @@ -381,7 +381,7 @@ func SetRMNHomeCandidateConfigChangeset(e deployment.Environment, config SetRMNH
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposerMcms,
inspectors,
Expand Down Expand Up @@ -460,7 +460,7 @@ func PromoteRMNHomeCandidateConfigChangeset(e deployment.Environment, config Pro
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposerMcms,
inspectors,
Expand Down Expand Up @@ -757,7 +757,7 @@ func SetRMNRemoteConfigChangeset(e deployment.Environment, config SetRMNRemoteCo
}

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposerMcms,
inspectors,
Expand Down
17 changes: 2 additions & 15 deletions deployment/common/changeset/deploy_mcms_with_timelock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"go.uber.org/zap/zapcore"

timelockBindings "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/timelock"

"github.com/smartcontractkit/chainlink/deployment"
commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset"
mcmschangesetstate "github.com/smartcontractkit/chainlink/deployment/common/changeset/state"
Expand Down Expand Up @@ -127,7 +128,7 @@ func TestDeployMCMSWithTimelockV2(t *testing.T) {
deployment.CreateLegacyChangeSet(commonchangeset.DeployMCMSWithTimelockV2),
changesetConfig,
)
setPreloadedSolanaAddresses(t, env, solanaSelectors[0])
commonchangeset.SetPreloadedSolanaAddresses(t, env, solanaSelectors[0])

// --- act ---
updatedEnv, err := commonchangeset.Apply(t, env, nil, configuredChangeset)
Expand Down Expand Up @@ -275,20 +276,6 @@ func timelockSignerPDA(programID solana.PublicKey, seed mcmschangesetstate.PDASe
return mcmschangesetstate.GetTimelockSignerPDA(programID, seed).String()
}

func setPreloadedSolanaAddresses(t *testing.T, env deployment.Environment, selector uint64) {
typeAndVersion := deployment.NewTypeAndVersion(commontypes.ManyChainMultisigProgram, deployment.Version1_0_0)
err := env.ExistingAddresses.Save(selector, memory.SolanaProgramIDs["mcm"], typeAndVersion)
require.NoError(t, err)

typeAndVersion = deployment.NewTypeAndVersion(commontypes.AccessControllerProgram, deployment.Version1_0_0)
err = env.ExistingAddresses.Save(selector, memory.SolanaProgramIDs["access_controller"], typeAndVersion)
require.NoError(t, err)

typeAndVersion = deployment.NewTypeAndVersion(commontypes.RBACTimelockProgram, deployment.Version1_0_0)
err = env.ExistingAddresses.Save(selector, memory.SolanaProgramIDs["timelock"], typeAndVersion)
require.NoError(t, err)
}

func solanaTimelockConfig(
ctx context.Context, t *testing.T, chain deployment.SolChain, programID solana.PublicKey, seed mcmschangesetstate.PDASeed,
) timelockBindings.Config {
Expand Down
2 changes: 1 addition & 1 deletion deployment/common/changeset/example/link_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func LinkTransferV2(e deployment.Environment, cfg *LinkTransferConfig) (deployme

if cfg.McmsConfig != nil {
proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelockAddressesPerChain,
proposerAddressPerChain,
inspectorPerChain,
Expand Down
2 changes: 1 addition & 1 deletion deployment/common/changeset/example/solana_transfer_mcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (f TransferFromTimelock) Apply(e deployment.Environment, config TransferFro
})
}
proposal, err := proposalutils.BuildProposalFromBatchesV2(
e.GetContext(),
e,
timelocks,
proposers,
inspectors,
Expand Down
4 changes: 2 additions & 2 deletions deployment/common/changeset/set_config_mcms.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func setConfigOrTxDataV2(ctx context.Context, lggr logger.Logger, chain deployme
return nil, err
}

transaction := res.RawTransaction.(*types.Transaction)
transaction := res.RawData.(*types.Transaction)
if !useMCMS {
_, err = deployment.ConfirmIfNoErrorWithABI(chain, transaction, gethwrappers.ManyChainMultiSigABI, err)
if err != nil {
Expand Down Expand Up @@ -357,7 +357,7 @@ func SetConfigMCMSV2(e deployment.Environment, cfg MCMSConfigV2) (deployment.Cha
}

if useMCMS {
proposal, err := proposalutils.BuildProposalFromBatchesV2(e.GetContext(), timelockAddressesPerChain,
proposal, err := proposalutils.BuildProposalFromBatchesV2(e, timelockAddressesPerChain,
proposerMcmsPerChain, inspectorPerChain, batches, "Set config proposal", cfg.ProposalConfig.MinDelay)
if err != nil {
return deployment.ChangesetOutput{}, fmt.Errorf("failed to build proposal from batch: %w", err)
Expand Down
Loading

0 comments on commit 396fe0a

Please sign in to comment.