From 7e204529e527c35b27929fcee3168a997da31ce0 Mon Sep 17 00:00:00 2001 From: Matthew Romage Date: Mon, 18 May 2026 10:23:58 -0400 Subject: [PATCH 1/2] remove validation --- deployment/v2_0_0/offchain/topology.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/v2_0_0/offchain/topology.go b/deployment/v2_0_0/offchain/topology.go index 9d5c05fb95..b38f987af7 100644 --- a/deployment/v2_0_0/offchain/topology.go +++ b/deployment/v2_0_0/offchain/topology.go @@ -199,14 +199,14 @@ func (c *EnvironmentTopology) ValidateForEnvironment(envName string) error { return nil } - if err := c.NOPTopology.validateMinimumNOPsPerChain(); err != nil { + /*if err := c.NOPTopology.validateMinimumNOPsPerChain(); err != nil { return err } for poolName, pool := range c.ExecutorPools { if err := pool.validateMinimumNOPsPerChain(poolName); err != nil { return err } - } + }*/ return nil } From 683906f33111a27b29199cc72627495a39e8fb0a Mon Sep 17 00:00:00 2001 From: AnieeG Date: Tue, 19 May 2026 13:31:10 -0700 Subject: [PATCH 2/2] updating values --- .../v2_0_0/adapters/chain_family.go | 23 +-- .../sequences/configure_chain_for_lanes.go | 133 ++++++++++-------- .../configure_chain_for_lanes_test.go | 58 +++----- .../v2_0_0/testadapter/test_adapter_test.go | 22 +-- .../deployment/v2_0_0/testsetup/testsetup.go | 18 +++ deployment/v2_0_0/adapters/chain_family.go | 70 ++++----- .../v2_0_0/adapters/chain_family_test.go | 4 +- ...onfigure_chains_for_lanes_from_topology.go | 96 ++++++------- ...ure_chains_for_lanes_from_topology_test.go | 30 ++-- 9 files changed, 223 insertions(+), 231 deletions(-) diff --git a/chains/evm/deployment/v2_0_0/adapters/chain_family.go b/chains/evm/deployment/v2_0_0/adapters/chain_family.go index 1e34de19cc..479d44d110 100644 --- a/chains/evm/deployment/v2_0_0/adapters/chain_family.go +++ b/chains/evm/deployment/v2_0_0/adapters/chain_family.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "k8s.io/utils/ptr" cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain" "github.com/smartcontractkit/chainlink-deployments-framework/datastore" @@ -184,18 +185,18 @@ func (a *ChainFamilyAdapter) GetChainFamilySelector() [4]byte { return evmFamilySelector } -func (a *ChainFamilyAdapter) GetDefaultFeeQuoterDestChainConfig() ccvadapters.FeeQuoterDestChainConfig { - return ccvadapters.FeeQuoterDestChainConfig{ - IsEnabled: true, - MaxDataBytes: 32_000, - MaxPerMsgGasLimit: 8_000_000, - DestGasPerPayloadByteBase: 20, +func (a *ChainFamilyAdapter) GetDefaultFeeQuoterDestChainConfig() ccvadapters.FeeQuoterDestChainConfigOverrides { + return ccvadapters.FeeQuoterDestChainConfigOverrides{ + IsEnabled: ptr.To(true), + MaxDataBytes: ptr.To(uint32(32_000)), + MaxPerMsgGasLimit: ptr.To(uint32(8_000_000)), + DestGasPerPayloadByteBase: ptr.To(uint8(20)), ChainFamilySelector: evmFamilySelector, - DefaultTokenFeeUSDCents: 25, - DefaultTokenDestGasOverhead: 90_000, - DefaultTxGasLimit: 200_000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, + DefaultTokenFeeUSDCents: ptr.To(uint16(25)), + DefaultTokenDestGasOverhead: ptr.To(uint32(90_000)), + DefaultTxGasLimit: ptr.To(uint32(200_000)), + NetworkFeeUSDCents: ptr.To(uint16(10)), + LinkFeeMultiplierPercent: ptr.To(uint8(90)), // USDPerUnitGas is not set here to avoid doing a gas price update by default } } diff --git a/chains/evm/deployment/v2_0_0/sequences/configure_chain_for_lanes.go b/chains/evm/deployment/v2_0_0/sequences/configure_chain_for_lanes.go index 1faa1be46a..f7755ff7e7 100644 --- a/chains/evm/deployment/v2_0_0/sequences/configure_chain_for_lanes.go +++ b/chains/evm/deployment/v2_0_0/sequences/configure_chain_for_lanes.go @@ -7,6 +7,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "k8s.io/utils/ptr" mcms_types "github.com/smartcontractkit/mcms/types" @@ -20,13 +21,14 @@ import ( seqtypes "github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences" changesetadapters "github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/adapters" + fqc "github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v2_0_0/fee_quoter" + "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/operations/committee_verifier" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/operations/fee_quoter" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/operations/offramp" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/operations/onramp" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/operations/proxy" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/versioned_verifier_resolver" - fqc "github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v2_0_0/fee_quoter" ) // ConfigureChainForLanes is the canonical sequence for configuring an EVM chain to participate @@ -126,7 +128,7 @@ var ConfigureChainForLanes = cldf_ops.NewSequence( return seqtypes.OnChainOutput{}, fmt.Errorf("remote chain %d: %w", remoteSelector, err) } - if remoteConfig.FeeQuoterDestChainConfig.USDPerUnitGas != nil { + if remoteConfig.FeeQuoterDestChainConfigOverrides.USDPerUnitGas != nil { gasPriceReport, err := cldf_ops.ExecuteOperation(b, fee_quoter.GetDestinationChainGasPrice, chain, contract.FunctionInput[uint64]{ ChainSelector: chain.Selector, Address: feeQuoterAddr, @@ -135,10 +137,10 @@ var ConfigureChainForLanes = cldf_ops.NewSequence( if err != nil { return seqtypes.OnChainOutput{}, fmt.Errorf("failed to get gas prices on FeeQuoter(%s) on chain %s: %w", feeQuoterAddr, chain, err) } - if remoteConfig.FeeQuoterDestChainConfig.USDPerUnitGas.Cmp(gasPriceReport.Output.Value) != 0 { + if remoteConfig.FeeQuoterDestChainConfigOverrides.USDPerUnitGas.Cmp(gasPriceReport.Output.Value) != 0 { gasPriceUpdates = append(gasPriceUpdates, fee_quoter.GasPriceUpdate{ DestChainSelector: remoteSelector, - UsdPerUnitGas: remoteConfig.FeeQuoterDestChainConfig.USDPerUnitGas, + UsdPerUnitGas: remoteConfig.FeeQuoterDestChainConfigOverrides.USDPerUnitGas, }) } } @@ -185,8 +187,8 @@ var ConfigureChainForLanes = cldf_ops.NewSequence( // FeeQuoter dest chain config: when OverrideExistingConfig is false, we skip // chains that already have an enabled config to avoid accidentally overwriting - // production parameters. When true, we always diff and update. - if !remoteConfig.FeeQuoterDestChainConfig.OverrideExistingConfig { + // production parameters. When true, we always update. + if !remoteConfig.FeeQuoterDestChainConfigOverrides.OverrideExistingConfig { destChainCfg, err := feeQContract.GetDestChainConfig(&bind.CallOpts{Context: b.GetContext()}, remoteSelector) if err != nil { return seqtypes.OnChainOutput{}, fmt.Errorf("failed to get dest chain config for remote chain selector %d from fee quoter at address %s on chain %s: %w", remoteSelector, feeQuoterAddr, chain.String(), err) @@ -492,18 +494,58 @@ func maybeAddOnRampDestChainConfigArgOnLocalChain( // USDPerUnitGas is intentionally excluded because it is updated via a separate // FeeQuoter.UpdatePrices call (gas prices live in a different on-chain mapping). -func feeQuoterDestChainConfigEqualTo(cur fqc.FeeQuoterDestChainConfig, desired changesetadapters.FeeQuoterDestChainConfig) bool { - return cur.IsEnabled == desired.IsEnabled && - cur.MaxDataBytes == desired.MaxDataBytes && - cur.MaxPerMsgGasLimit == desired.MaxPerMsgGasLimit && - cur.DestGasOverhead == desired.DestGasOverhead && - cur.DestGasPerPayloadByteBase == desired.DestGasPerPayloadByteBase && +func feeQuoterDestChainConfigEqualTo(cur fqc.FeeQuoterDestChainConfig, desired changesetadapters.FeeQuoterDestChainConfigOverrides) bool { + return cur.IsEnabled == *desired.IsEnabled && + cur.MaxDataBytes == *desired.MaxDataBytes && + cur.MaxPerMsgGasLimit == *desired.MaxPerMsgGasLimit && + cur.DestGasOverhead == *desired.DestGasOverhead && + cur.DestGasPerPayloadByteBase == *desired.DestGasPerPayloadByteBase && cur.ChainFamilySelector == desired.ChainFamilySelector && - cur.DefaultTokenFeeUSDCents == desired.DefaultTokenFeeUSDCents && - cur.DefaultTokenDestGasOverhead == desired.DefaultTokenDestGasOverhead && - cur.DefaultTxGasLimit == desired.DefaultTxGasLimit && - cur.NetworkFeeUSDCents == desired.NetworkFeeUSDCents && - cur.LinkFeeMultiplierPercent == desired.LinkFeeMultiplierPercent + cur.DefaultTokenFeeUSDCents == *desired.DefaultTokenFeeUSDCents && + cur.DefaultTokenDestGasOverhead == *desired.DefaultTokenDestGasOverhead && + cur.DefaultTxGasLimit == *desired.DefaultTxGasLimit && + cur.NetworkFeeUSDCents == *desired.NetworkFeeUSDCents && + cur.LinkFeeMultiplierPercent == *desired.LinkFeeMultiplierPercent +} + +func fillFeeQuoterDestChainConfigOverridesFromOnChain( + desired changesetadapters.FeeQuoterDestChainConfigOverrides, + cur fqc.FeeQuoterDestChainConfig, +) changesetadapters.FeeQuoterDestChainConfigOverrides { + if desired.IsEnabled == nil { + desired.IsEnabled = ptr.To(cur.IsEnabled) + } + if desired.MaxDataBytes == nil { + desired.MaxDataBytes = ptr.To(cur.MaxDataBytes) + } + if desired.MaxPerMsgGasLimit == nil { + desired.MaxPerMsgGasLimit = ptr.To(cur.MaxPerMsgGasLimit) + } + if desired.DestGasOverhead == nil { + desired.DestGasOverhead = ptr.To(cur.DestGasOverhead) + } + if desired.DestGasPerPayloadByteBase == nil { + desired.DestGasPerPayloadByteBase = ptr.To(cur.DestGasPerPayloadByteBase) + } + if desired.ChainFamilySelector == [4]byte{} { + desired.ChainFamilySelector = cur.ChainFamilySelector + } + if desired.DefaultTokenFeeUSDCents == nil { + desired.DefaultTokenFeeUSDCents = ptr.To(cur.DefaultTokenFeeUSDCents) + } + if desired.DefaultTokenDestGasOverhead == nil { + desired.DefaultTokenDestGasOverhead = ptr.To(cur.DefaultTokenDestGasOverhead) + } + if desired.DefaultTxGasLimit == nil { + desired.DefaultTxGasLimit = ptr.To(cur.DefaultTxGasLimit) + } + if desired.NetworkFeeUSDCents == nil { + desired.NetworkFeeUSDCents = ptr.To(cur.NetworkFeeUSDCents) + } + if desired.LinkFeeMultiplierPercent == nil { + desired.LinkFeeMultiplierPercent = ptr.To(cur.LinkFeeMultiplierPercent) + } + return desired } // maybeAddFeeQuoterDestChainConfigArgOnLocalChain compares the desired FeeQuoter dest chain @@ -531,40 +573,7 @@ func maybeAddFeeQuoterDestChainConfigArgOnLocalChain( cur = fetched } - desired := remoteConfig.FeeQuoterDestChainConfig - if !desired.IsEnabled { - desired.IsEnabled = cur.IsEnabled - } - if desired.MaxDataBytes == 0 { - desired.MaxDataBytes = cur.MaxDataBytes - } - if desired.MaxPerMsgGasLimit == 0 { - desired.MaxPerMsgGasLimit = cur.MaxPerMsgGasLimit - } - if desired.DestGasOverhead == 0 { - desired.DestGasOverhead = cur.DestGasOverhead - } - if desired.DestGasPerPayloadByteBase == 0 { - desired.DestGasPerPayloadByteBase = cur.DestGasPerPayloadByteBase - } - if desired.ChainFamilySelector == [4]byte{} { - desired.ChainFamilySelector = cur.ChainFamilySelector - } - if desired.DefaultTokenFeeUSDCents == 0 { - desired.DefaultTokenFeeUSDCents = cur.DefaultTokenFeeUSDCents - } - if desired.DefaultTokenDestGasOverhead == 0 { - desired.DefaultTokenDestGasOverhead = cur.DefaultTokenDestGasOverhead - } - if desired.DefaultTxGasLimit == 0 { - desired.DefaultTxGasLimit = cur.DefaultTxGasLimit - } - if desired.NetworkFeeUSDCents == 0 { - desired.NetworkFeeUSDCents = cur.NetworkFeeUSDCents - } - if desired.LinkFeeMultiplierPercent == 0 { - desired.LinkFeeMultiplierPercent = cur.LinkFeeMultiplierPercent - } + desired := fillFeeQuoterDestChainConfigOverridesFromOnChain(remoteConfig.FeeQuoterDestChainConfigOverrides, cur) if feeQuoterDestChainConfigEqualTo(cur, desired) { return feeQuoterArgs, nil } @@ -835,19 +844,19 @@ func configureCommitteeVerifierAsDest( return writes, nil } -func adapterDestChainConfigToFeeQuoterV2(cfg changesetadapters.FeeQuoterDestChainConfig) fee_quoter.DestChainConfig { +func adapterDestChainConfigToFeeQuoterV2(cfg changesetadapters.FeeQuoterDestChainConfigOverrides) fee_quoter.DestChainConfig { return fee_quoter.DestChainConfig{ - IsEnabled: cfg.IsEnabled, - MaxDataBytes: cfg.MaxDataBytes, - MaxPerMsgGasLimit: cfg.MaxPerMsgGasLimit, - DestGasOverhead: cfg.DestGasOverhead, - DestGasPerPayloadByteBase: cfg.DestGasPerPayloadByteBase, + IsEnabled: *cfg.IsEnabled, + MaxDataBytes: *cfg.MaxDataBytes, + MaxPerMsgGasLimit: *cfg.MaxPerMsgGasLimit, + DestGasOverhead: *cfg.DestGasOverhead, + DestGasPerPayloadByteBase: *cfg.DestGasPerPayloadByteBase, ChainFamilySelector: cfg.ChainFamilySelector, - DefaultTokenFeeUSDCents: cfg.DefaultTokenFeeUSDCents, - DefaultTokenDestGasOverhead: cfg.DefaultTokenDestGasOverhead, - DefaultTxGasLimit: cfg.DefaultTxGasLimit, - NetworkFeeUSDCents: cfg.NetworkFeeUSDCents, - LinkFeeMultiplierPercent: cfg.LinkFeeMultiplierPercent, + DefaultTokenFeeUSDCents: *cfg.DefaultTokenFeeUSDCents, + DefaultTokenDestGasOverhead: *cfg.DefaultTokenDestGasOverhead, + DefaultTxGasLimit: *cfg.DefaultTxGasLimit, + NetworkFeeUSDCents: *cfg.NetworkFeeUSDCents, + LinkFeeMultiplierPercent: *cfg.LinkFeeMultiplierPercent, } } diff --git a/chains/evm/deployment/v2_0_0/sequences/configure_chain_for_lanes_test.go b/chains/evm/deployment/v2_0_0/sequences/configure_chain_for_lanes_test.go index bd94868efd..b7fe6c18da 100644 --- a/chains/evm/deployment/v2_0_0/sequences/configure_chain_for_lanes_test.go +++ b/chains/evm/deployment/v2_0_0/sequences/configure_chain_for_lanes_test.go @@ -16,6 +16,8 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/operations" chainsel "github.com/smartcontractkit/chain-selectors" + "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/operations/contract" + "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_2_0/operations/router" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/create2_factory" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/operations/committee_verifier" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/operations/executor" @@ -24,8 +26,6 @@ import ( "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/operations/onramp" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/sequences" "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v2_0_0/testsetup" - "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/operations/contract" - "github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/v1_2_0/operations/router" changesetadapters "github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/adapters" ) @@ -33,6 +33,8 @@ var evmFamilySelector = [4]byte{0x28, 0x12, 0xd5, 0x2c} func boolPtr(v bool) *bool { return &v } +func uint32Ptr(v uint32) *uint32 { return &v } + type deployedContracts struct { router string onRamp string @@ -131,19 +133,7 @@ func buildConfigureChainForLanesInput( DefaultExecutor: local.executor, DefaultInboundCCVs: []string{local.committeeVerifier}, DefaultOutboundCCVs: []string{local.committeeVerifier}, - FeeQuoterDestChainConfig: changesetadapters.FeeQuoterDestChainConfig{ - IsEnabled: true, - MaxDataBytes: 30_000, - MaxPerMsgGasLimit: 3_000_000, - DestGasOverhead: 300_000, - DefaultTokenFeeUSDCents: 25, - DestGasPerPayloadByteBase: 16, - DefaultTokenDestGasOverhead: 90_000, - DefaultTxGasLimit: 200_000, - NetworkFeeUSDCents: 10, - ChainFamilySelector: evmFamilySelector, - LinkFeeMultiplierPercent: 90, - }, + FeeQuoterDestChainConfigOverrides: testsetup.CreateBasicFeeQuoterDestChainConfigOverrides(), ExecutorDestChainConfig: changesetadapters.ExecutorDestChainConfig{ USDCentsFee: 50, Enabled: true, @@ -552,19 +542,17 @@ func TestConfigureChainForLanes_ConfiguresMultipleRemoteChainsInSingleCall(t *te DefaultExecutor: local.executor, DefaultInboundCCVs: []string{local.committeeVerifier}, DefaultOutboundCCVs: []string{local.committeeVerifier}, - FeeQuoterDestChainConfig: changesetadapters.FeeQuoterDestChainConfig{ - IsEnabled: true, - MaxDataBytes: 50_000, - MaxPerMsgGasLimit: 5_000_000, - DestGasOverhead: 400_000, - DefaultTokenFeeUSDCents: 30, - DestGasPerPayloadByteBase: 16, - DefaultTokenDestGasOverhead: 100_000, - DefaultTxGasLimit: 250_000, - NetworkFeeUSDCents: 20, - ChainFamilySelector: evmFamilySelector, - LinkFeeMultiplierPercent: 90, - }, + FeeQuoterDestChainConfigOverrides: func() changesetadapters.FeeQuoterDestChainConfigOverrides { + cfg := testsetup.CreateBasicFeeQuoterDestChainConfigOverrides() + cfg.MaxDataBytes = uint32Ptr(50_000) + cfg.MaxPerMsgGasLimit = uint32Ptr(5_000_000) + cfg.DestGasOverhead = uint32Ptr(400_000) + cfg.DefaultTokenFeeUSDCents = func() *uint16 { v := uint16(30); return &v }() + cfg.DefaultTokenDestGasOverhead = uint32Ptr(100_000) + cfg.DefaultTxGasLimit = uint32Ptr(250_000) + cfg.NetworkFeeUSDCents = func() *uint16 { v := uint16(20); return &v }() + return cfg + }(), ExecutorDestChainConfig: changesetadapters.ExecutorDestChainConfig{ USDCentsFee: 100, Enabled: true, @@ -765,9 +753,9 @@ func TestConfigureChainForLanes_PartialUpdatePreservesExistingFields(t *testing. DefaultInboundCCVs: []string{local.committeeVerifier}, DefaultOutboundCCVs: []string{local.committeeVerifier}, BaseExecutionGasCost: 120_000, - FeeQuoterDestChainConfig: changesetadapters.FeeQuoterDestChainConfig{ + FeeQuoterDestChainConfigOverrides: changesetadapters.FeeQuoterDestChainConfigOverrides{ OverrideExistingConfig: true, - DestGasOverhead: 500_000, + DestGasOverhead: uint32Ptr(500_000), }, DefaultExecutor: local.executor, ExecutorDestChainConfig: changesetadapters.ExecutorDestChainConfig{ @@ -835,8 +823,8 @@ func TestConfigureChainForLanes_OverrideExistingFeeQuoterConfig(t *testing.T) { noOverrideInput := buildConfigureChainForLanesInput(local, chainSelector, remote, remoteSelector) rc := noOverrideInput.RemoteChains[remoteSelector] - rc.FeeQuoterDestChainConfig.OverrideExistingConfig = false - rc.FeeQuoterDestChainConfig.MaxDataBytes = 99_000 + rc.FeeQuoterDestChainConfigOverrides.OverrideExistingConfig = false + rc.FeeQuoterDestChainConfigOverrides.MaxDataBytes = uint32Ptr(99_000) noOverrideInput.RemoteChains[remoteSelector] = rc _, err = operations.ExecuteSequence( @@ -855,8 +843,8 @@ func TestConfigureChainForLanes_OverrideExistingFeeQuoterConfig(t *testing.T) { overrideInput := buildConfigureChainForLanesInput(local, chainSelector, remote, remoteSelector) rc = overrideInput.RemoteChains[remoteSelector] - rc.FeeQuoterDestChainConfig.OverrideExistingConfig = true - rc.FeeQuoterDestChainConfig.MaxDataBytes = 99_000 + rc.FeeQuoterDestChainConfigOverrides.OverrideExistingConfig = true + rc.FeeQuoterDestChainConfigOverrides.MaxDataBytes = uint32Ptr(99_000) overrideInput.RemoteChains[remoteSelector] = rc _, err = operations.ExecuteSequence( @@ -1188,7 +1176,7 @@ func TestConfigureChainForLanes_GasPriceUpdateSkippedWhenAlreadySet(t *testing.T input := buildConfigureChainForLanesInput(local, chainSelector, remote, remoteChainSelector) rc := input.RemoteChains[remoteChainSelector] - rc.FeeQuoterDestChainConfig.USDPerUnitGas = big.NewInt(42_000) + rc.FeeQuoterDestChainConfigOverrides.USDPerUnitGas = big.NewInt(42_000) input.RemoteChains[remoteChainSelector] = rc report1, err := operations.ExecuteSequence( diff --git a/chains/evm/deployment/v2_0_0/testadapter/test_adapter_test.go b/chains/evm/deployment/v2_0_0/testadapter/test_adapter_test.go index 5b37ab99f7..c63a8b1803 100644 --- a/chains/evm/deployment/v2_0_0/testadapter/test_adapter_test.go +++ b/chains/evm/deployment/v2_0_0/testadapter/test_adapter_test.go @@ -104,9 +104,6 @@ type laneContracts struct { addresses []datastore.AddressRef } -// evmFamilySelector is bytes4(keccak256("CCIP ChainFamilySelector EVM")) = 0x2812d52c. -var evmFamilySelector = [4]byte{0x28, 0x12, 0xd5, 0x2c} - func boolPtr(v bool) *bool { return &v } func deployLaneContracts(t *testing.T, env *deployment.Environment, chain cldf_evm.Chain, chainSelector uint64) laneContracts { @@ -206,20 +203,11 @@ func buildConfigureChainForLanesInput( DefaultExecutor: local.executor, DefaultInboundCCVs: []string{local.committeeVerifier}, DefaultOutboundCCVs: []string{local.committeeVerifier}, - FeeQuoterDestChainConfig: changesetadapters.FeeQuoterDestChainConfig{ - IsEnabled: true, - MaxDataBytes: 30_000, - MaxPerMsgGasLimit: 3_000_000, - DestGasOverhead: 300_000, - DefaultTokenFeeUSDCents: 25, - DestGasPerPayloadByteBase: 16, - DefaultTokenDestGasOverhead: 90_000, - DefaultTxGasLimit: 200_000, - NetworkFeeUSDCents: 10, - ChainFamilySelector: evmFamilySelector, - LinkFeeMultiplierPercent: 90, - USDPerUnitGas: big.NewInt(20_000_000_000_000), - }, + FeeQuoterDestChainConfigOverrides: func() changesetadapters.FeeQuoterDestChainConfigOverrides { + cfg := testsetup.CreateBasicFeeQuoterDestChainConfigOverrides() + cfg.USDPerUnitGas = big.NewInt(20_000_000_000_000) + return cfg + }(), ExecutorDestChainConfig: changesetadapters.ExecutorDestChainConfig{ USDCentsFee: 50, Enabled: true, diff --git a/chains/evm/deployment/v2_0_0/testsetup/testsetup.go b/chains/evm/deployment/v2_0_0/testsetup/testsetup.go index c79cd64b40..d0c7a44c22 100644 --- a/chains/evm/deployment/v2_0_0/testsetup/testsetup.go +++ b/chains/evm/deployment/v2_0_0/testsetup/testsetup.go @@ -5,6 +5,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" + "k8s.io/utils/ptr" "github.com/smartcontractkit/chainlink-deployments-framework/datastore" "github.com/smartcontractkit/chainlink-deployments-framework/operations" @@ -48,6 +49,23 @@ func CreateBasicFeeQuoterDestChainConfig() lanes.FeeQuoterDestChainConfig { } } +// CreateBasicFeeQuoterDestChainConfigOverrides creates adapter-level FeeQuoter dest chain overrides for v2.0.0 lane tests. +func CreateBasicFeeQuoterDestChainConfigOverrides() changesetadapters.FeeQuoterDestChainConfigOverrides { + return changesetadapters.FeeQuoterDestChainConfigOverrides{ + IsEnabled: ptr.To(true), + MaxDataBytes: ptr.To(uint32(30_000)), + MaxPerMsgGasLimit: ptr.To(uint32(3_000_000)), + DestGasOverhead: ptr.To(uint32(300_000)), + DefaultTokenFeeUSDCents: ptr.To(uint16(25)), + DestGasPerPayloadByteBase: ptr.To(uint8(16)), + DefaultTokenDestGasOverhead: ptr.To(uint32(90_000)), + DefaultTxGasLimit: ptr.To(uint32(200_000)), + NetworkFeeUSDCents: ptr.To(uint16(10)), + ChainFamilySelector: evmFamilySelector, + LinkFeeMultiplierPercent: ptr.To(uint8(90)), + } +} + // CreateBasicExecutorDestChainConfig creates a basic executor dest chain config with reasonable defaults for testing func CreateBasicExecutorDestChainConfig() lanes.ExecutorDestChainConfig { return lanes.ExecutorDestChainConfig{ diff --git a/deployment/v2_0_0/adapters/chain_family.go b/deployment/v2_0_0/adapters/chain_family.go index e830be38b9..d036d3e6a5 100644 --- a/deployment/v2_0_0/adapters/chain_family.go +++ b/deployment/v2_0_0/adapters/chain_family.go @@ -64,40 +64,23 @@ type RemoteChainDefaults struct { TokenNetworkFeeUSDCents uint16 } -// FeeQuoterDestChainConfig configures the FeeQuoter for a remote chain. -type FeeQuoterDestChainConfig struct { - OverrideExistingConfig bool - IsEnabled bool - MaxDataBytes uint32 - MaxPerMsgGasLimit uint32 - DestGasOverhead uint32 - DestGasPerPayloadByteBase uint8 - ChainFamilySelector [4]byte - DefaultTokenFeeUSDCents uint16 - DefaultTokenDestGasOverhead uint32 - DefaultTxGasLimit uint32 - NetworkFeeUSDCents uint16 - LinkFeeMultiplierPercent uint8 - USDPerUnitGas *big.Int -} - // RemoteChainConfig defines the configuration for a remote chain. type RemoteChainConfig[RemoteContract any, LocalContract any] struct { - AllowTrafficFrom *bool - OnRamps []RemoteContract - OffRamp RemoteContract - DefaultInboundCCVs []LocalContract - LaneMandatedInboundCCVs []LocalContract - DefaultOutboundCCVs []LocalContract - LaneMandatedOutboundCCVs []LocalContract - DefaultExecutor LocalContract - FeeQuoterDestChainConfig FeeQuoterDestChainConfig - ExecutorDestChainConfig ExecutorDestChainConfig - AddressBytesLength uint8 - BaseExecutionGasCost uint32 - TokenReceiverAllowed *bool - MessageNetworkFeeUSDCents uint16 - TokenNetworkFeeUSDCents uint16 + AllowTrafficFrom *bool + OnRamps []RemoteContract + OffRamp RemoteContract + DefaultInboundCCVs []LocalContract + LaneMandatedInboundCCVs []LocalContract + DefaultOutboundCCVs []LocalContract + LaneMandatedOutboundCCVs []LocalContract + DefaultExecutor LocalContract + FeeQuoterDestChainConfigOverrides FeeQuoterDestChainConfigOverrides + ExecutorDestChainConfig ExecutorDestChainConfig + AddressBytesLength uint8 + BaseExecutionGasCost uint32 + TokenReceiverAllowed *bool + MessageNetworkFeeUSDCents uint16 + TokenNetworkFeeUSDCents uint16 } // ConfigureChainForLanesInput is the input for the chain-centric lane configuration sequence. @@ -131,7 +114,7 @@ type ChainFamily interface { ResolveExecutor(ds datastore.DataStore, chainSelector uint64, qualifier string) (string, error) GetAddressBytesLength() uint8 GetChainFamilySelector() [4]byte - GetDefaultFeeQuoterDestChainConfig() FeeQuoterDestChainConfig + GetDefaultFeeQuoterDestChainConfig() FeeQuoterDestChainConfigOverrides GetDefaultRemoteChainConfig() RemoteChainDefaults GetDefaultCommitteeVerifierRemoteChainConfig() CommitteeVerifierRemoteChainDefaults GetDefaultFinalityConfig() finality.Config @@ -173,3 +156,24 @@ func (r *ChainFamilyRegistry) GetChainFamily(chainFamily string) (ChainFamily, b adapter, ok := r.m[chainFamily] return adapter, ok } + +// FeeQuoterDestChainConfigOverrides is the unified type used both for chain-family adapter +// defaults (returned by GetDefaultFeeQuoterDestChainConfig) and for lane-pair-specific +// user-provided overrides. Nil pointer fields are ignored during merge; non-nil fields +// (including those explicitly set to zero) replace the corresponding value. This ensures +// user-supplied zero values are honored rather than silently dropped. +type FeeQuoterDestChainConfigOverrides struct { + OverrideExistingConfig bool + IsEnabled *bool + MaxDataBytes *uint32 + MaxPerMsgGasLimit *uint32 + DestGasOverhead *uint32 + DestGasPerPayloadByteBase *uint8 + ChainFamilySelector [4]byte + DefaultTokenFeeUSDCents *uint16 + DefaultTokenDestGasOverhead *uint32 + DefaultTxGasLimit *uint32 + NetworkFeeUSDCents *uint16 + LinkFeeMultiplierPercent *uint8 + USDPerUnitGas *big.Int +} diff --git a/deployment/v2_0_0/adapters/chain_family_test.go b/deployment/v2_0_0/adapters/chain_family_test.go index 9ca0048f3d..ffb93765a9 100644 --- a/deployment/v2_0_0/adapters/chain_family_test.go +++ b/deployment/v2_0_0/adapters/chain_family_test.go @@ -66,8 +66,8 @@ func (m *mockChainFamily) GetChainFamilySelector() [4]byte { return [4]byte{} } -func (m *mockChainFamily) GetDefaultFeeQuoterDestChainConfig() adapters.FeeQuoterDestChainConfig { - return adapters.FeeQuoterDestChainConfig{} +func (m *mockChainFamily) GetDefaultFeeQuoterDestChainConfig() adapters.FeeQuoterDestChainConfigOverrides { + return adapters.FeeQuoterDestChainConfigOverrides{} } func (m *mockChainFamily) GetDefaultRemoteChainConfig() adapters.RemoteChainDefaults { diff --git a/deployment/v2_0_0/changesets/configure_chains_for_lanes_from_topology.go b/deployment/v2_0_0/changesets/configure_chains_for_lanes_from_topology.go index 3ae9d64aa6..1c05a56acf 100644 --- a/deployment/v2_0_0/changesets/configure_chains_for_lanes_from_topology.go +++ b/deployment/v2_0_0/changesets/configure_chains_for_lanes_from_topology.go @@ -7,6 +7,11 @@ import ( "strconv" chainsel "github.com/smartcontractkit/chain-selectors" + "github.com/smartcontractkit/chainlink-deployments-framework/datastore" + "github.com/smartcontractkit/chainlink-deployments-framework/deployment" + cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations" + mcms_types "github.com/smartcontractkit/mcms/types" + "github.com/smartcontractkit/chainlink-ccip/deployment/finality" changesetscore "github.com/smartcontractkit/chainlink-ccip/deployment/utils/changesets" datastore_utils "github.com/smartcontractkit/chainlink-ccip/deployment/utils/datastore" @@ -14,10 +19,6 @@ import ( "github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences" "github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/adapters" "github.com/smartcontractkit/chainlink-ccip/deployment/v2_0_0/offchain" - "github.com/smartcontractkit/chainlink-deployments-framework/datastore" - "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations" - mcms_types "github.com/smartcontractkit/mcms/types" ) const defaultQualifier = "default" @@ -41,27 +42,6 @@ type CommitteeVerifierInputConfig struct { AllowedFinalityConfig *finality.Config `json:"allowedFinalityConfig" yaml:"allowedFinalityConfig"` } -// FeeQuoterDestChainConfigOverrides provides lane-pair-specific overrides on top of the -// chain-family defaults returned by the remote adapter's GetDefaultFeeQuoterDestChainConfig. -// Nil fields are left at the adapter default; non-nil fields replace the default. -// -// DestGasOverhead is intentionally omitted — it is a LEGACY v2 field whose responsibility -// moved to OnRamp.BaseExecutionGasCost. ChainFamilySelector is also omitted because it is -// always auto-populated from the remote adapter. -type FeeQuoterDestChainConfigOverrides struct { - OverrideExistingConfig bool - IsEnabled *bool - MaxDataBytes *uint32 - MaxPerMsgGasLimit *uint32 - DestGasPerPayloadByteBase *uint8 - DefaultTokenFeeUSDCents *uint16 - DefaultTokenDestGasOverhead *uint32 - DefaultTxGasLimit *uint32 - NetworkFeeUSDCents *uint16 - LinkFeeMultiplierPercent *uint8 - USDPerUnitGas *big.Int -} - // PartialRemoteChainConfig is the user-facing input for a single remote chain. All fields // are optional, but their empty values are resolved from different sources: // - adapter-backed remote-chain settings fall back to the remote chain family adapter's @@ -84,7 +64,7 @@ type PartialRemoteChainConfig struct { LaneMandatedInboundCCVs []datastore.AddressRef DefaultOutboundCCVs []datastore.AddressRef LaneMandatedOutboundCCVs []datastore.AddressRef - FeeQuoterDestChainConfig FeeQuoterDestChainConfigOverrides + FeeQuoterDestChainConfig adapters.FeeQuoterDestChainConfigOverrides ExecutorDestChainConfig *adapters.ExecutorDestChainConfig // nil = use adapter default BaseExecutionGasCost *uint32 // nil = use adapter default TokenReceiverAllowed *bool @@ -501,21 +481,21 @@ func resolveRemoteChainConfig( } return adapters.RemoteChainConfig[[]byte, string]{ - AllowTrafficFrom: &allowTrafficFrom, - OnRamps: [][]byte{remoteOnRampBytes}, - OffRamp: remoteOffRampBytes, - DefaultExecutor: executorAddr, - DefaultInboundCCVs: defaultInboundCCVs, - LaneMandatedInboundCCVs: laneMandatedInboundCCVs, - DefaultOutboundCCVs: defaultOutboundCCVs, - LaneMandatedOutboundCCVs: laneMandatedOutboundCCVs, - FeeQuoterDestChainConfig: fqConfig, - ExecutorDestChainConfig: executorConfig, - AddressBytesLength: remoteAdapter.GetAddressBytesLength(), - BaseExecutionGasCost: baseExecutionGasCost, - TokenReceiverAllowed: &tokenReceiverAllowed, - MessageNetworkFeeUSDCents: messageNetworkFeeUSDCents, - TokenNetworkFeeUSDCents: tokenNetworkFeeUSDCents, + AllowTrafficFrom: &allowTrafficFrom, + OnRamps: [][]byte{remoteOnRampBytes}, + OffRamp: remoteOffRampBytes, + DefaultExecutor: executorAddr, + DefaultInboundCCVs: defaultInboundCCVs, + LaneMandatedInboundCCVs: laneMandatedInboundCCVs, + DefaultOutboundCCVs: defaultOutboundCCVs, + LaneMandatedOutboundCCVs: laneMandatedOutboundCCVs, + FeeQuoterDestChainConfigOverrides: fqConfig, + ExecutorDestChainConfig: executorConfig, + AddressBytesLength: remoteAdapter.GetAddressBytesLength(), + BaseExecutionGasCost: baseExecutionGasCost, + TokenReceiverAllowed: &tokenReceiverAllowed, + MessageNetworkFeeUSDCents: messageNetworkFeeUSDCents, + TokenNetworkFeeUSDCents: tokenNetworkFeeUSDCents, }, nil } @@ -627,41 +607,45 @@ func mergeCommitteeVerifierRemoteChainConfig( } func mergeFeeQuoterDestChainConfig( - defaults adapters.FeeQuoterDestChainConfig, - overrides FeeQuoterDestChainConfigOverrides, -) adapters.FeeQuoterDestChainConfig { - defaults.OverrideExistingConfig = overrides.OverrideExistingConfig + defaults adapters.FeeQuoterDestChainConfigOverrides, + overrides adapters.FeeQuoterDestChainConfigOverrides, +) adapters.FeeQuoterDestChainConfigOverrides { + out := defaults + out.OverrideExistingConfig = overrides.OverrideExistingConfig if overrides.IsEnabled != nil { - defaults.IsEnabled = *overrides.IsEnabled + out.IsEnabled = overrides.IsEnabled } if overrides.MaxDataBytes != nil { - defaults.MaxDataBytes = *overrides.MaxDataBytes + out.MaxDataBytes = overrides.MaxDataBytes } if overrides.MaxPerMsgGasLimit != nil { - defaults.MaxPerMsgGasLimit = *overrides.MaxPerMsgGasLimit + out.MaxPerMsgGasLimit = overrides.MaxPerMsgGasLimit } if overrides.DestGasPerPayloadByteBase != nil { - defaults.DestGasPerPayloadByteBase = *overrides.DestGasPerPayloadByteBase + out.DestGasPerPayloadByteBase = overrides.DestGasPerPayloadByteBase + } + if overrides.ChainFamilySelector != [4]byte{} { + out.ChainFamilySelector = overrides.ChainFamilySelector } if overrides.DefaultTokenFeeUSDCents != nil { - defaults.DefaultTokenFeeUSDCents = *overrides.DefaultTokenFeeUSDCents + out.DefaultTokenFeeUSDCents = overrides.DefaultTokenFeeUSDCents } if overrides.DefaultTokenDestGasOverhead != nil { - defaults.DefaultTokenDestGasOverhead = *overrides.DefaultTokenDestGasOverhead + out.DefaultTokenDestGasOverhead = overrides.DefaultTokenDestGasOverhead } if overrides.DefaultTxGasLimit != nil { - defaults.DefaultTxGasLimit = *overrides.DefaultTxGasLimit + out.DefaultTxGasLimit = overrides.DefaultTxGasLimit } if overrides.NetworkFeeUSDCents != nil { - defaults.NetworkFeeUSDCents = *overrides.NetworkFeeUSDCents + out.NetworkFeeUSDCents = overrides.NetworkFeeUSDCents } if overrides.LinkFeeMultiplierPercent != nil { - defaults.LinkFeeMultiplierPercent = *overrides.LinkFeeMultiplierPercent + out.LinkFeeMultiplierPercent = overrides.LinkFeeMultiplierPercent } if overrides.USDPerUnitGas != nil { - defaults.USDPerUnitGas = new(big.Int).Set(overrides.USDPerUnitGas) + out.USDPerUnitGas = new(big.Int).Set(overrides.USDPerUnitGas) } - return defaults + return out } // filterNOPsToCommitteeMembers returns only the NOPs whose aliases appear in at least one diff --git a/deployment/v2_0_0/changesets/configure_chains_for_lanes_from_topology_test.go b/deployment/v2_0_0/changesets/configure_chains_for_lanes_from_topology_test.go index 3058277d0d..7414eb69e7 100644 --- a/deployment/v2_0_0/changesets/configure_chains_for_lanes_from_topology_test.go +++ b/deployment/v2_0_0/changesets/configure_chains_for_lanes_from_topology_test.go @@ -96,17 +96,17 @@ func (m *mockChainFamilyAdapter) GetChainFamilySelector() [4]byte { return [4]byte{0x28, 0x12, 0xd5, 0x2c} } -func (m *mockChainFamilyAdapter) GetDefaultFeeQuoterDestChainConfig() adapters.FeeQuoterDestChainConfig { - return adapters.FeeQuoterDestChainConfig{ - IsEnabled: true, - MaxDataBytes: 32_000, - MaxPerMsgGasLimit: 8_000_000, - DestGasPerPayloadByteBase: 16, - DefaultTokenFeeUSDCents: 25, - DefaultTokenDestGasOverhead: 90_000, - DefaultTxGasLimit: 200_000, - NetworkFeeUSDCents: 10, - LinkFeeMultiplierPercent: 90, +func (m *mockChainFamilyAdapter) GetDefaultFeeQuoterDestChainConfig() adapters.FeeQuoterDestChainConfigOverrides { + return adapters.FeeQuoterDestChainConfigOverrides{ + IsEnabled: ptrTo(true), + MaxDataBytes: ptrTo(uint32(32_000)), + MaxPerMsgGasLimit: ptrTo(uint32(8_000_000)), + DestGasPerPayloadByteBase: ptrTo(uint8(16)), + DefaultTokenFeeUSDCents: ptrTo(uint16(25)), + DefaultTokenDestGasOverhead: ptrTo(uint32(90_000)), + DefaultTxGasLimit: ptrTo(uint32(200_000)), + NetworkFeeUSDCents: ptrTo(uint16(10)), + LinkFeeMultiplierPercent: ptrTo(uint8(90)), } } @@ -596,7 +596,7 @@ func TestConfigureChainsForLanesFromTopology_PerSourceDestinationConfig(t *testi }, RemoteChains: map[uint64]changesets.PartialRemoteChainConfig{ sharedDest: { - FeeQuoterDestChainConfig: changesets.FeeQuoterDestChainConfigOverrides{MaxDataBytes: ptrTo[uint32](1000)}, + FeeQuoterDestChainConfig: adapters.FeeQuoterDestChainConfigOverrides{MaxDataBytes: ptrTo[uint32](1000)}, ExecutorDestChainConfig: &adapters.ExecutorDestChainConfig{USDCentsFee: 100, Enabled: true}, }, }, @@ -608,7 +608,7 @@ func TestConfigureChainsForLanesFromTopology_PerSourceDestinationConfig(t *testi }, RemoteChains: map[uint64]changesets.PartialRemoteChainConfig{ sharedDest: { - FeeQuoterDestChainConfig: changesets.FeeQuoterDestChainConfigOverrides{MaxDataBytes: ptrTo[uint32](2000)}, + FeeQuoterDestChainConfig: adapters.FeeQuoterDestChainConfigOverrides{MaxDataBytes: ptrTo[uint32](2000)}, ExecutorDestChainConfig: &adapters.ExecutorDestChainConfig{USDCentsFee: 200, Enabled: true}, }, }, @@ -625,11 +625,11 @@ func TestConfigureChainsForLanesFromTopology_PerSourceDestinationConfig(t *testi } inputA := inputsByChain[chainA] - assert.Equal(t, uint32(1000), inputA.RemoteChains[sharedDest].FeeQuoterDestChainConfig.MaxDataBytes) + assert.Equal(t, uint32(1000), *inputA.RemoteChains[sharedDest].FeeQuoterDestChainConfigOverrides.MaxDataBytes) assert.Equal(t, uint16(100), inputA.RemoteChains[sharedDest].ExecutorDestChainConfig.USDCentsFee) inputB := inputsByChain[chainB] - assert.Equal(t, uint32(2000), inputB.RemoteChains[sharedDest].FeeQuoterDestChainConfig.MaxDataBytes) + assert.Equal(t, uint32(2000), *inputB.RemoteChains[sharedDest].FeeQuoterDestChainConfigOverrides.MaxDataBytes) assert.Equal(t, uint16(200), inputB.RemoteChains[sharedDest].ExecutorDestChainConfig.USDCentsFee) }