Skip to content

Commit a25ed4b

Browse files
committed
Change logic on setKeeperRegistryAddress to use new proposal builder
1 parent 45d7569 commit a25ed4b

1 file changed

Lines changed: 22 additions & 15 deletions

File tree

deployment/vault/changeset/ethbalmon_setKeeperRegistryAddress.go

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ import (
1010
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
1111
"github.com/smartcontractkit/chainlink-deployments-framework/operations"
1212
"github.com/smartcontractkit/chainlink-evm/gethwrappers/generated/eth_balance_monitor_wrapper"
13+
"github.com/smartcontractkit/chainlink/deployment/common/proposalutils"
1314
commontypes "github.com/smartcontractkit/chainlink/deployment/common/types"
1415
vaulttypes "github.com/smartcontractkit/chainlink/deployment/vault/changeset/types"
1516
"github.com/smartcontractkit/mcms"
17+
mcmssdk "github.com/smartcontractkit/mcms/sdk"
18+
mcmsevmsdk "github.com/smartcontractkit/mcms/sdk/evm"
1619
mcmstypes "github.com/smartcontractkit/mcms/types"
1720
)
1821

@@ -93,8 +96,9 @@ var SetKeeperRegistrySequence = operations.NewSequence(
9396
}
9497

9598
var batches []mcmstypes.BatchOperation
96-
timelockAddresses := make(map[mcmstypes.ChainSelector]string)
97-
chainMetadata := make(map[mcmstypes.ChainSelector]mcmstypes.ChainMetadata)
99+
timelockAddresses := make(map[uint64]string)
100+
mcmAddressByChain := make(map[uint64]string)
101+
inspectorPerChain := make(map[uint64]mcmssdk.Inspector)
98102

99103
for chainSelector, chainConfig := range input.Chains {
100104
opReport, err := operations.ExecuteOperation(
@@ -114,21 +118,20 @@ var SetKeeperRegistrySequence = operations.NewSequence(
114118
opOut := opReport.Output
115119

116120
batches = append(batches, opOut.BatchOperation)
117-
timelockAddresses[mcmstypes.ChainSelector(chainSelector)] = opOut.TimelockAddress
118-
chainMetadata[mcmstypes.ChainSelector(chainSelector)] = mcmstypes.ChainMetadata{
119-
StartingOpCount: 0,
120-
MCMAddress: opOut.MCMSAddress,
121-
}
121+
timelockAddresses[chainSelector] = opOut.TimelockAddress
122+
mcmAddressByChain[chainSelector] = opOut.MCMSAddress
123+
inspectorPerChain[chainSelector] = opOut.Inspector
122124
}
123125

124-
proposal, err := mcms.NewTimelockProposalBuilder().
125-
SetVersion("v1").
126-
SetAction(mcmstypes.TimelockActionBypass).
127-
SetTimelockAddresses(timelockAddresses).
128-
SetChainMetadata(chainMetadata).
129-
SetOperations(batches).
130-
SetDescription("Set Keeper Registry address on EthBalanceMonitor across chains").
131-
Build()
126+
proposal, err := proposalutils.BuildProposalFromBatchesV2(
127+
deps.Environment,
128+
timelockAddresses,
129+
mcmAddressByChain,
130+
inspectorPerChain,
131+
batches,
132+
"EthBalMon SetKeeperRegistryAddress",
133+
proposalutils.TimelockConfig{MinDelay: 0},
134+
)
132135
if err != nil {
133136
return EthBalMonSetKeeperRegistryAddressSequenceOutput{},
134137
fmt.Errorf("failed to build timelock proposal: %w", err)
@@ -155,6 +158,7 @@ type SetKeeperRegistryOperationOutput struct {
155158
BatchOperation mcmstypes.BatchOperation `json:"batch_operation"`
156159
TimelockAddress string `json:"timelock_address"`
157160
MCMSAddress string `json:"mcms_address"`
161+
Inspector *mcmsevmsdk.Inspector `json:"inspector"`
158162
}
159163

160164
var SetKeeperRegistryOperation = operations.NewOperation(
@@ -236,6 +240,8 @@ var SetKeeperRegistryOperation = operations.NewOperation(
236240
},
237241
}
238242

243+
chainInspector := mcmsevmsdk.NewInspector(chain.Client)
244+
239245
b.Logger.Infow("Generated EthBalMon set keeper registry batch",
240246
"chainSelector", input.ChainSelector,
241247
"ethBalMon", ethBalMonAddr,
@@ -247,6 +253,7 @@ var SetKeeperRegistryOperation = operations.NewOperation(
247253
BatchOperation: batch,
248254
TimelockAddress: timelockAddr,
249255
MCMSAddress: mcmsAddr,
256+
Inspector: chainInspector,
250257
}, nil
251258
},
252259
)

0 commit comments

Comments
 (0)