Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions deployment/cre/forwarder/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func (d DonConfiguration) ForwarderConfig(chainFamily string, c offchain.Client)
}

type ConfigureSeqInput struct {
DON DonConfiguration // the DON to configuration for the forwarder to accept
DON DonConfiguration // the DON to configuration for the forwarder to accept
Qualifier string // used to differentiate Forwarder contracts deployed to the same chain.

// MCMSConfig is optional. If non-nil, the changes will be proposed using MCMS.
MCMSConfig *contracts.MCMSConfig
Expand Down Expand Up @@ -96,14 +97,23 @@ var ConfigureSeq = operations.NewSequence[ConfigureSeqInput, ConfigureSeqOutput,
continue
}

addressesRefs := deps.Env.DataStore.Addresses().Filter(
filters := []datastore.FilterFunc[datastore.AddressRefKey, datastore.AddressRef]{
datastore.AddressRefByChainSelector(chain.Selector),
datastore.AddressRefByType(datastore.ContractType(contracts.KeystoneForwarder)),
)
datastore.AddressRefByType(datastore.ContractType(contracts.KeystoneForwarder))}
if input.Qualifier != "" {
filters = append(filters, datastore.AddressRefByQualifier(input.Qualifier))
}

addressesRefs := deps.Env.DataStore.Addresses().Filter(filters...)
if len(addressesRefs) == 0 {
return ConfigureSeqOutput{}, fmt.Errorf("configure-forwarders-seq failed: no KeystoneForwarder contract found for chain selector %d", chain.Selector)
}

if len(addressesRefs) > 1 {
deps.Env.Logger.Warnf(
"Found %d forwarder contracts for a chain. Config will be applied to all of them.", len(addressesRefs))
}

var mcmsContracts *changesetstate.MCMSWithTimelockState
if input.MCMSConfig != nil {
var mcmsErr error
Expand Down
Loading