diff --git a/ccv/chains/evm/deployment/v2_0_0/sequences/fee_quoter.go b/ccv/chains/evm/deployment/v2_0_0/sequences/fee_quoter.go index addc188b4d..1ec5374617 100644 --- a/ccv/chains/evm/deployment/v2_0_0/sequences/fee_quoter.go +++ b/ccv/chains/evm/deployment/v2_0_0/sequences/fee_quoter.go @@ -219,7 +219,7 @@ var ( fqops.Version, "", ) - isNewFQ17Deployment := datastore_utils.IsAddressRefEmpty(feeQuoterRef) + isNewFQ20Deployment := datastore_utils.IsAddressRefEmpty(feeQuoterRef) tokenTransferFeeConfigArgs := make([]fqops.TokenTransferFeeConfigArgs, 0) allDestChainConfigs := make([]fqops.DestChainConfigArgs, 0) for remoteChain, cfg := range fqOutput.RemoteChainCfgs { @@ -264,25 +264,21 @@ var ( }) allDestChainConfigs = append(allDestChainConfigs, outDestchainCfg) } - if isNewFQ17Deployment { + if isNewFQ20Deployment { output.ConstructorArgs = fqops.ConstructorArgs{ StaticConfig: fqops.StaticConfig{ LinkToken: fqOutput.StaticCfg.LinkToken, MaxFeeJuelsPerMsg: fqOutput.StaticCfg.MaxFeeJuelsPerMsg, }, - PriceUpdaters: fqOutput.PriceUpdaters, - TokenTransferFeeConfigArgs: tokenTransferFeeConfigArgs, - DestChainConfigArgs: allDestChainConfigs, } - } else { - output.AuthorizedCallerUpdates = fqops.AuthorizedCallerArgs{ - AddedCallers: fqOutput.PriceUpdaters, - } - output.TokenTransferFeeConfigUpdates = fqops.ApplyTokenTransferFeeConfigUpdatesArgs{ - TokenTransferFeeConfigArgs: tokenTransferFeeConfigArgs, - } - output.DestChainConfigs = allDestChainConfigs } + output.AuthorizedCallerUpdates = fqops.AuthorizedCallerArgs{ + AddedCallers: fqOutput.PriceUpdaters, + } + output.TokenTransferFeeConfigUpdates = fqops.ApplyTokenTransferFeeConfigUpdatesArgs{ + TokenTransferFeeConfigArgs: tokenTransferFeeConfigArgs, + } + output.DestChainConfigs = allDestChainConfigs return output, nil }) @@ -346,7 +342,7 @@ var ( fqops.Version, "", ) - isNewFQ17Deployment := datastore_utils.IsAddressRefEmpty(feeQuoter17Ref) + isNewFQ20Deployment := datastore_utils.IsAddressRefEmpty(feeQuoter17Ref) var staticCfg fqops.StaticConfig var destChainCfgs []fqops.DestChainConfigArgs var tokenTransferFeeConfigArgs []fqops.TokenTransferFeeConfigSingleTokenArgs @@ -403,23 +399,19 @@ var ( TokenTransferFeeConfigs: tokenTransferFeeConfigArgs, }) } - if isNewFQ17Deployment { + if isNewFQ20Deployment { output.ConstructorArgs = fqops.ConstructorArgs{ StaticConfig: fqops.StaticConfig{ LinkToken: staticCfg.LinkToken, MaxFeeJuelsPerMsg: staticCfg.MaxFeeJuelsPerMsg, }, - DestChainConfigArgs: destChainCfgs, - TokenTransferFeeConfigArgs: tokenTransferFeeConfigArgsForAll, - PriceUpdaters: priceUpdaters, - } - } else { - output.DestChainConfigs = destChainCfgs - output.TokenTransferFeeConfigUpdates.TokenTransferFeeConfigArgs = tokenTransferFeeConfigArgsForAll - output.AuthorizedCallerUpdates = fqops.AuthorizedCallerArgs{ - AddedCallers: priceUpdaters, } } + output.DestChainConfigs = destChainCfgs + output.TokenTransferFeeConfigUpdates.TokenTransferFeeConfigArgs = tokenTransferFeeConfigArgsForAll + output.AuthorizedCallerUpdates = fqops.AuthorizedCallerArgs{ + AddedCallers: priceUpdaters, + } return output, nil }) ) @@ -538,6 +530,9 @@ func mergePriceUpdaters(updaters1, updaters2 fqops.AuthorizedCallerArgs) fqops.A } func mergeDestChainConfigs(cfgs1, cfgs2 []fqops.DestChainConfigArgs) []fqops.DestChainConfigArgs { + if len(cfgs1) == 0 { + return cfgs2 + } // Create a map of dest chain selectors from cfgs1 destChainMap := make(map[uint64]fqops.DestChainConfigArgs) for _, cfg := range cfgs1 { @@ -551,9 +546,6 @@ func mergeDestChainConfigs(cfgs1, cfgs2 []fqops.DestChainConfigArgs) []fqops.Des } // If it exists in both, cfgs1's value is already used (takes precedence) } - if len(destChainMap) == 0 { - return nil - } return result } diff --git a/ccv/chains/evm/deployment/v2_0_0/sequences/sequence_fee_quoter_input_creation_test.go b/ccv/chains/evm/deployment/v2_0_0/sequences/sequence_fee_quoter_input_creation_test.go index bb66287e25..7a4b8a5363 100644 --- a/ccv/chains/evm/deployment/v2_0_0/sequences/sequence_fee_quoter_input_creation_test.go +++ b/ccv/chains/evm/deployment/v2_0_0/sequences/sequence_fee_quoter_input_creation_test.go @@ -468,7 +468,7 @@ func getExpectedOutput() map[uint64]sequences.FeeQuoterUpdate { expected := make(map[uint64]sequences.FeeQuoterUpdate) // Chain 5009297550715157269: Has FeeQuoter v1.6.3 + OnRamp v1.5.0 - // Since no FeeQuoter v2.0.0 exists, it's a new deployment (ConstructorArgs populated) + // Since no FeeQuoter v2.0.0 exists, it's a new deployment (ConstructorArgs has StaticConfig only) expected[5009297550715157269] = sequences.FeeQuoterUpdate{ ChainSelector: 5009297550715157269, ConstructorArgs: fqops.ConstructorArgs{ @@ -476,45 +476,49 @@ func getExpectedOutput() map[uint64]sequences.FeeQuoterUpdate { LinkToken: linkToken, MaxFeeJuelsPerMsg: maxFeeJuels, }, - PriceUpdaters: []common.Address{ + }, + AuthorizedCallerUpdates: fqops.AuthorizedCallerArgs{ + AddedCallers: []common.Address{ common.HexToAddress("0x4444444444444444444444444444444444444444"), common.HexToAddress("0x5555555555555555555555555555555555555555"), common.HexToAddress("0x2222222222222222222222222222222222222221"), }, - DestChainConfigArgs: []fqops.DestChainConfigArgs{ - { - DestChainSelector: 15971525489660198786, - DestChainConfig: fqops.DestChainConfig{ - IsEnabled: true, - MaxDataBytes: 8000, - MaxPerMsgGasLimit: 4000000, - DestGasOverhead: 80000, - DestGasPerPayloadByteBase: 14, - ChainFamilySelector: [4]byte(utils.GetSelectorHex(15971525489660198786)), - DefaultTokenFeeUSDCents: 8, - DefaultTokenDestGasOverhead: 40000, - DefaultTxGasLimit: 180000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, - }, + }, + DestChainConfigs: []fqops.DestChainConfigArgs{ + { + DestChainSelector: 15971525489660198786, + DestChainConfig: fqops.DestChainConfig{ + IsEnabled: true, + MaxDataBytes: 8000, + MaxPerMsgGasLimit: 4000000, + DestGasOverhead: 80000, + DestGasPerPayloadByteBase: 14, + ChainFamilySelector: [4]byte(utils.GetSelectorHex(15971525489660198786)), + DefaultTokenFeeUSDCents: 8, + DefaultTokenDestGasOverhead: 40000, + DefaultTxGasLimit: 180000, + NetworkFeeUSDCents: 10, + LinkFeeMultiplierPercent: 90, }, - { - DestChainSelector: 4949039107694359620, - DestChainConfig: fqops.DestChainConfig{ - IsEnabled: true, - MaxDataBytes: 10000, - MaxPerMsgGasLimit: 5000000, - DestGasOverhead: 100000, - DestGasPerPayloadByteBase: 16, - ChainFamilySelector: [4]byte(utils.GetSelectorHex(4949039107694359620)), - DefaultTokenFeeUSDCents: 0, - DefaultTokenDestGasOverhead: 0, - DefaultTxGasLimit: 200000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, - }, + }, + { + DestChainSelector: 4949039107694359620, + DestChainConfig: fqops.DestChainConfig{ + IsEnabled: true, + MaxDataBytes: 10000, + MaxPerMsgGasLimit: 5000000, + DestGasOverhead: 100000, + DestGasPerPayloadByteBase: 16, + ChainFamilySelector: [4]byte(utils.GetSelectorHex(4949039107694359620)), + DefaultTokenFeeUSDCents: 0, + DefaultTokenDestGasOverhead: 0, + DefaultTxGasLimit: 200000, + NetworkFeeUSDCents: 10, + LinkFeeMultiplierPercent: 90, }, }, + }, + TokenTransferFeeConfigUpdates: fqops.ApplyTokenTransferFeeConfigUpdatesArgs{ TokenTransferFeeConfigArgs: []fqops.TokenTransferFeeConfigArgs{ { DestChainSelector: 15971525489660198786, @@ -565,46 +569,50 @@ func getExpectedOutput() map[uint64]sequences.FeeQuoterUpdate { LinkToken: linkToken, MaxFeeJuelsPerMsg: maxFeeJuels, }, - PriceUpdaters: []common.Address{ + }, + AuthorizedCallerUpdates: fqops.AuthorizedCallerArgs{ + AddedCallers: []common.Address{ common.HexToAddress("0x4444444444444444444444444444444444444444"), common.HexToAddress("0x5555555555555555555555555555555555555555"), common.HexToAddress("0x3333333333333333333333333333333333333333"), common.HexToAddress("0x9999999999999999999999999999999999999999"), }, - DestChainConfigArgs: []fqops.DestChainConfigArgs{ - { - DestChainSelector: 15971525489660198786, - DestChainConfig: fqops.DestChainConfig{ - IsEnabled: true, - MaxDataBytes: 8000, - MaxPerMsgGasLimit: 4000000, - DestGasOverhead: 80000, - DestGasPerPayloadByteBase: 14, - ChainFamilySelector: [4]byte(utils.GetSelectorHex(15971525489660198786)), - DefaultTokenFeeUSDCents: 8, - DefaultTokenDestGasOverhead: 40000, - DefaultTxGasLimit: 180000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, - }, + }, + DestChainConfigs: []fqops.DestChainConfigArgs{ + { + DestChainSelector: 15971525489660198786, + DestChainConfig: fqops.DestChainConfig{ + IsEnabled: true, + MaxDataBytes: 8000, + MaxPerMsgGasLimit: 4000000, + DestGasOverhead: 80000, + DestGasPerPayloadByteBase: 14, + ChainFamilySelector: [4]byte(utils.GetSelectorHex(15971525489660198786)), + DefaultTokenFeeUSDCents: 8, + DefaultTokenDestGasOverhead: 40000, + DefaultTxGasLimit: 180000, + NetworkFeeUSDCents: 10, + LinkFeeMultiplierPercent: 90, }, - { - DestChainSelector: 5009297550715157269, - DestChainConfig: fqops.DestChainConfig{ - IsEnabled: true, - MaxDataBytes: 10000, - MaxPerMsgGasLimit: 5000000, - DestGasOverhead: 100000, - DestGasPerPayloadByteBase: 16, - ChainFamilySelector: [4]byte(utils.GetSelectorHex(5009297550715157269)), - DefaultTokenFeeUSDCents: 0, - DefaultTokenDestGasOverhead: 0, - DefaultTxGasLimit: 200000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, - }, + }, + { + DestChainSelector: 5009297550715157269, + DestChainConfig: fqops.DestChainConfig{ + IsEnabled: true, + MaxDataBytes: 10000, + MaxPerMsgGasLimit: 5000000, + DestGasOverhead: 100000, + DestGasPerPayloadByteBase: 16, + ChainFamilySelector: [4]byte(utils.GetSelectorHex(5009297550715157269)), + DefaultTokenFeeUSDCents: 0, + DefaultTokenDestGasOverhead: 0, + DefaultTxGasLimit: 200000, + NetworkFeeUSDCents: 10, + LinkFeeMultiplierPercent: 90, }, }, + }, + TokenTransferFeeConfigUpdates: fqops.ApplyTokenTransferFeeConfigUpdatesArgs{ TokenTransferFeeConfigArgs: []fqops.TokenTransferFeeConfigArgs{ { DestChainSelector: 15971525489660198786, @@ -647,24 +655,26 @@ func getExpectedOutput() map[uint64]sequences.FeeQuoterUpdate { LinkToken: linkToken, MaxFeeJuelsPerMsg: maxFeeJuels159, }, - DestChainConfigArgs: []fqops.DestChainConfigArgs{ - { - DestChainSelector: 5009297550715157269, - DestChainConfig: fqops.DestChainConfig{ - IsEnabled: true, - MaxDataBytes: 10000, - MaxPerMsgGasLimit: 5000000, - DestGasOverhead: 100000, - DestGasPerPayloadByteBase: 16, - ChainFamilySelector: [4]byte(utils.GetSelectorHex(5009297550715157269)), - DefaultTokenFeeUSDCents: 0, - DefaultTokenDestGasOverhead: 0, - DefaultTxGasLimit: 200000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, - }, + }, + DestChainConfigs: []fqops.DestChainConfigArgs{ + { + DestChainSelector: 5009297550715157269, + DestChainConfig: fqops.DestChainConfig{ + IsEnabled: true, + MaxDataBytes: 10000, + MaxPerMsgGasLimit: 5000000, + DestGasOverhead: 100000, + DestGasPerPayloadByteBase: 16, + ChainFamilySelector: [4]byte(utils.GetSelectorHex(5009297550715157269)), + DefaultTokenFeeUSDCents: 0, + DefaultTokenDestGasOverhead: 0, + DefaultTxGasLimit: 200000, + NetworkFeeUSDCents: 10, + LinkFeeMultiplierPercent: 90, }, }, + }, + TokenTransferFeeConfigUpdates: fqops.ApplyTokenTransferFeeConfigUpdatesArgs{ TokenTransferFeeConfigArgs: []fqops.TokenTransferFeeConfigArgs{ { DestChainSelector: 5009297550715157269, @@ -690,7 +700,9 @@ func getExpectedOutput() map[uint64]sequences.FeeQuoterUpdate { }, }, }, - PriceUpdaters: []common.Address{ + }, + AuthorizedCallerUpdates: fqops.AuthorizedCallerArgs{ + AddedCallers: []common.Address{ common.HexToAddress("0x4444444444444444444444444444444444444444"), }, }, @@ -704,61 +716,65 @@ func getExpectedOutput() map[uint64]sequences.FeeQuoterUpdate { LinkToken: linkToken, MaxFeeJuelsPerMsg: maxFeeJuels, }, - PriceUpdaters: []common.Address{ + }, + AuthorizedCallerUpdates: fqops.AuthorizedCallerArgs{ + AddedCallers: []common.Address{ common.HexToAddress("0x4444444444444444444444444444444444444444"), common.HexToAddress("0x5555555555555555555555555555555555555555"), common.HexToAddress("0x5555555555555555555555555555555555555551"), }, - DestChainConfigArgs: []fqops.DestChainConfigArgs{ - { - DestChainSelector: 5009297550715157269, - DestChainConfig: fqops.DestChainConfig{ - IsEnabled: true, - MaxDataBytes: 10000, - MaxPerMsgGasLimit: 5000000, - DestGasOverhead: 100000, - DestGasPerPayloadByteBase: 16, - ChainFamilySelector: [4]byte(utils.GetSelectorHex(5009297550715157269)), - DefaultTokenFeeUSDCents: 10, - DefaultTokenDestGasOverhead: 50000, - DefaultTxGasLimit: 200000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, - }, + }, + DestChainConfigs: []fqops.DestChainConfigArgs{ + { + DestChainSelector: 5009297550715157269, + DestChainConfig: fqops.DestChainConfig{ + IsEnabled: true, + MaxDataBytes: 10000, + MaxPerMsgGasLimit: 5000000, + DestGasOverhead: 100000, + DestGasPerPayloadByteBase: 16, + ChainFamilySelector: [4]byte(utils.GetSelectorHex(5009297550715157269)), + DefaultTokenFeeUSDCents: 10, + DefaultTokenDestGasOverhead: 50000, + DefaultTxGasLimit: 200000, + NetworkFeeUSDCents: 10, + LinkFeeMultiplierPercent: 90, }, - { - DestChainSelector: 4949039107694359620, - DestChainConfig: fqops.DestChainConfig{ - IsEnabled: true, - MaxDataBytes: 9000, - MaxPerMsgGasLimit: 4500000, - DestGasOverhead: 90000, - DestGasPerPayloadByteBase: 15, - ChainFamilySelector: [4]byte(utils.GetSelectorHex(4949039107694359620)), - DefaultTokenFeeUSDCents: 9, - DefaultTokenDestGasOverhead: 45000, - DefaultTxGasLimit: 190000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, - }, + }, + { + DestChainSelector: 4949039107694359620, + DestChainConfig: fqops.DestChainConfig{ + IsEnabled: true, + MaxDataBytes: 9000, + MaxPerMsgGasLimit: 4500000, + DestGasOverhead: 90000, + DestGasPerPayloadByteBase: 15, + ChainFamilySelector: [4]byte(utils.GetSelectorHex(4949039107694359620)), + DefaultTokenFeeUSDCents: 9, + DefaultTokenDestGasOverhead: 45000, + DefaultTxGasLimit: 190000, + NetworkFeeUSDCents: 10, + LinkFeeMultiplierPercent: 90, }, - { - DestChainSelector: 15971525489660198786, - DestChainConfig: fqops.DestChainConfig{ - IsEnabled: true, - MaxDataBytes: 8000, - MaxPerMsgGasLimit: 4000000, - DestGasOverhead: 80000, - DestGasPerPayloadByteBase: 14, - ChainFamilySelector: [4]byte(utils.GetSelectorHex(15971525489660198786)), - DefaultTokenFeeUSDCents: 0, - DefaultTokenDestGasOverhead: 0, - DefaultTxGasLimit: 180000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, - }, + }, + { + DestChainSelector: 15971525489660198786, + DestChainConfig: fqops.DestChainConfig{ + IsEnabled: true, + MaxDataBytes: 8000, + MaxPerMsgGasLimit: 4000000, + DestGasOverhead: 80000, + DestGasPerPayloadByteBase: 14, + ChainFamilySelector: [4]byte(utils.GetSelectorHex(15971525489660198786)), + DefaultTokenFeeUSDCents: 0, + DefaultTokenDestGasOverhead: 0, + DefaultTxGasLimit: 180000, + NetworkFeeUSDCents: 10, + LinkFeeMultiplierPercent: 90, }, }, + }, + TokenTransferFeeConfigUpdates: fqops.ApplyTokenTransferFeeConfigUpdatesArgs{ TokenTransferFeeConfigArgs: []fqops.TokenTransferFeeConfigArgs{ { DestChainSelector: 5009297550715157269, @@ -933,10 +949,7 @@ func TestSequenceFeeQuoterInputCreation(t *testing.T) { "DestChainSelector %d on chain %d", destChainCfg.DestChainSelector, chainSelector) } } - for _, cfg := range expected.ConstructorArgs.DestChainConfigArgs { - expectedDestChainConfigsMap[cfg.DestChainSelector] = cfg - } - require.Len(t, output.ConstructorArgs.DestChainConfigArgs, len(expectedDestChainConfigsMap), + require.Len(t, output.ConstructorArgs.DestChainConfigArgs, len(expected.ConstructorArgs.DestChainConfigArgs), "Number of Constructor DestChainConfigArgs should match expected value for chain %d", chainSelector) for _, destChainCfg := range output.ConstructorArgs.DestChainConfigArgs {