Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisAmora committed Mar 12, 2025
1 parent 0af508b commit 50a1fd3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func promoteStagingConfigPrecondition(_ deployment.Environment, cc PromoteStagin
if err := cc.Validate(); err != nil {
return fmt.Errorf("invalid DeployConfiguratorConfig: %w", err)
}

return nil
}

Expand All @@ -60,19 +59,16 @@ func promoteStagingConfigLogic(e deployment.Environment, cfg PromoteStagingConfi
return deployment.ChangesetOutput{}, err
}

chainSelectors := make([]uint64, 0, len(cfg.PromotionsByChain))
for chainSelector := range cfg.PromotionsByChain {
chainSelectors = append(chainSelectors, chainSelector)
}

allBatches := []mcmstypes.BatchOperation{}

var (
timelockAddressPerChain map[uint64]string
proposerAddressPerChain map[uint64]string
inspectorPerChain map[uint64]mcmssdk.Inspector
timelockAddressesPerChain map[uint64]string
)
var timelockAddressesPerChain map[uint64]string
var proposerAddressPerChain map[uint64]string
var inspectorPerChain map[uint64]mcmssdk.Inspector
if cfg.MCMSConfig != nil {
timelockAddressesPerChain = make(map[uint64]string)
proposerAddressPerChain = make(map[uint64]string)
inspectorPerChain = make(map[uint64]mcmssdk.Inspector)
}

for chainSelector, promotions := range cfg.PromotionsByChain {
chain, chainExists := e.Chains[chainSelector]
Expand All @@ -87,10 +83,8 @@ func promoteStagingConfigLogic(e deployment.Environment, cfg PromoteStagingConfi

if cfg.MCMSConfig != nil {
chainState := state.Chains[chainSelector]

timelockAddressPerChain[chainSelector] = chainState.Timelock.Address().String()
timelockAddressesPerChain[chainSelector] = chainState.Timelock.Address().String()
proposerAddressPerChain[chainSelector] = chainState.ProposerMcm.Address().String()
timelockAddressPerChain[chainSelector] = chainState.Timelock.Address().String()
inspectorPerChain[chainSelector] = evm.NewInspector(chain.Client)
}

Expand All @@ -106,16 +100,20 @@ func promoteStagingConfigLogic(e deployment.Environment, cfg PromoteStagingConfi
return deployment.ChangesetOutput{}, err
}

op := evm.NewTransaction(promotion.ConfiguratorAddress, tx.Data(), big.NewInt(0), string(types.Configurator), []string{})

op := evm.NewTransaction(
promotion.ConfiguratorAddress,
tx.Data(),
big.NewInt(0),
string(types.Configurator),
[]string{},
)
batch.Transactions = append(batch.Transactions, op)
}

allBatches = append(allBatches, batch)
}

if cfg.MCMSConfig != nil {

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e,
timelockAddressesPerChain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func TestCallPromoteStagingConfig(t *testing.T) {
require.Len(t, ab, 1)

configuratorAddrHex, err := deployment.SearchAddressBook(e.ExistingAddresses, testutil.TestChain.Selector, types.Configurator)
require.NoError(t, err)

configuratorAddr := common.HexToAddress(configuratorAddrHex)

// Prepare a production onchain config (64 bytes):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,9 @@ func callSetConfigCommon[T ConfiguratorConfig](
return deployment.ChangesetOutput{}, err
}

chainSelectors := make([]uint64, 0, len(configurationsByChain))
for chainSelector := range configurationsByChain {
chainSelectors = append(chainSelectors, chainSelector)
}

var (
timelockAddressPerChain map[uint64]string
proposerAddressPerChain map[uint64]string
inspectorPerChain map[uint64]mcmssdk.Inspector
timelockAddressesPerChain map[uint64]string
)
timelockAddressesPerChain := make(map[uint64]string)
proposerAddressPerChain := make(map[uint64]string)
inspectorPerChain := make(map[uint64]mcmssdk.Inspector)

allBatches := []mcmstypes.BatchOperation{}

Expand All @@ -100,9 +92,8 @@ func callSetConfigCommon[T ConfiguratorConfig](
if mcmsConfig != nil {
chainState := state.Chains[chainSelector]

timelockAddressPerChain[chainSelector] = chainState.Timelock.Address().String()
timelockAddressesPerChain[chainSelector] = chainState.Timelock.Address().String()
proposerAddressPerChain[chainSelector] = chainState.ProposerMcm.Address().String()
timelockAddressPerChain[chainSelector] = chainState.Timelock.Address().String()
inspectorPerChain[chainSelector] = evm.NewInspector(chain.Client)
}

Expand All @@ -127,7 +118,6 @@ func callSetConfigCommon[T ConfiguratorConfig](
}

if mcmsConfig != nil {

proposal, err := proposalutils.BuildProposalFromBatchesV2(
e,
timelockAddressesPerChain,
Expand Down

0 comments on commit 50a1fd3

Please sign in to comment.