diff --git a/.changeset/little-hats-worry.md b/.changeset/little-hats-worry.md new file mode 100644 index 00000000000..eb3e86e153a --- /dev/null +++ b/.changeset/little-hats-worry.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +Change LimitTransfer gasLimit type from uint32 to uint64 diff --git a/common/txmgr/mocks/tx_manager.go b/common/txmgr/mocks/tx_manager.go index 45a3675aced..37b0822941d 100644 --- a/common/txmgr/mocks/tx_manager.go +++ b/common/txmgr/mocks/tx_manager.go @@ -386,7 +386,7 @@ func (_m *TxManager[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) Reset( } // SendNativeToken provides a mock function with given fields: ctx, chainID, from, to, value, gasLimit -func (_m *TxManager[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) SendNativeToken(ctx context.Context, chainID CHAIN_ID, from ADDR, to ADDR, value big.Int, gasLimit uint32) (txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], error) { +func (_m *TxManager[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) SendNativeToken(ctx context.Context, chainID CHAIN_ID, from ADDR, to ADDR, value big.Int, gasLimit uint64) (txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], error) { ret := _m.Called(ctx, chainID, from, to, value, gasLimit) if len(ret) == 0 { @@ -395,16 +395,16 @@ func (_m *TxManager[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) SendNa var r0 txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] var r1 error - if rf, ok := ret.Get(0).(func(context.Context, CHAIN_ID, ADDR, ADDR, big.Int, uint32) (txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, CHAIN_ID, ADDR, ADDR, big.Int, uint64) (txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], error)); ok { return rf(ctx, chainID, from, to, value, gasLimit) } - if rf, ok := ret.Get(0).(func(context.Context, CHAIN_ID, ADDR, ADDR, big.Int, uint32) txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]); ok { + if rf, ok := ret.Get(0).(func(context.Context, CHAIN_ID, ADDR, ADDR, big.Int, uint64) txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]); ok { r0 = rf(ctx, chainID, from, to, value, gasLimit) } else { r0 = ret.Get(0).(txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) } - if rf, ok := ret.Get(1).(func(context.Context, CHAIN_ID, ADDR, ADDR, big.Int, uint32) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, CHAIN_ID, ADDR, ADDR, big.Int, uint64) error); ok { r1 = rf(ctx, chainID, from, to, value, gasLimit) } else { r1 = ret.Error(1) diff --git a/common/txmgr/txmgr.go b/common/txmgr/txmgr.go index 74d218915d9..fcfd023ece3 100644 --- a/common/txmgr/txmgr.go +++ b/common/txmgr/txmgr.go @@ -47,7 +47,7 @@ type TxManager[ CreateTransaction(ctx context.Context, txRequest txmgrtypes.TxRequest[ADDR, TX_HASH]) (etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) GetForwarderForEOA(eoa ADDR) (forwarder ADDR, err error) RegisterResumeCallback(fn ResumeCallback) - SendNativeToken(ctx context.Context, chainID CHAIN_ID, from, to ADDR, value big.Int, gasLimit uint32) (etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) + SendNativeToken(ctx context.Context, chainID CHAIN_ID, from, to ADDR, value big.Int, gasLimit uint64) (etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) Reset(addr ADDR, abandon bool) error // Find transactions by a field in the TxMeta blob and transaction states FindTxesByMetaFieldAndStates(ctx context.Context, metaField string, metaValue string, states []txmgrtypes.TxState, chainID *big.Int) (txes []*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) @@ -549,7 +549,7 @@ func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) checkEnabl } // SendNativeToken creates a transaction that transfers the given value of native tokens -func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) SendNativeToken(ctx context.Context, chainID CHAIN_ID, from, to ADDR, value big.Int, gasLimit uint32) (etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) { +func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) SendNativeToken(ctx context.Context, chainID CHAIN_ID, from, to ADDR, value big.Int, gasLimit uint64) (etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) { if utils.IsZero(to) { return etx, errors.New("cannot send native token to zero address") } @@ -558,7 +558,7 @@ func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) SendNative ToAddress: to, EncodedPayload: []byte{}, Value: value, - FeeLimit: uint64(gasLimit), + FeeLimit: gasLimit, Strategy: NewSendEveryStrategy(), } etx, err = b.pruneQueueAndCreateTxn(ctx, txRequest, chainID) @@ -642,7 +642,7 @@ func (n *NullTxManager[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) Res } // SendNativeToken does nothing, null functionality -func (n *NullTxManager[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) SendNativeToken(ctx context.Context, chainID CHAIN_ID, from, to ADDR, value big.Int, gasLimit uint32) (etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) { +func (n *NullTxManager[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) SendNativeToken(ctx context.Context, chainID CHAIN_ID, from, to ADDR, value big.Int, gasLimit uint64) (etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) { return etx, errors.New(n.ErrMsg) } diff --git a/core/chains/evm/config/chain_scoped_gas_estimator.go b/core/chains/evm/config/chain_scoped_gas_estimator.go index 9d7d10356f7..689d5e38b81 100644 --- a/core/chains/evm/config/chain_scoped_gas_estimator.go +++ b/core/chains/evm/config/chain_scoped_gas_estimator.go @@ -76,7 +76,7 @@ func (g *gasEstimatorConfig) LimitMultiplier() float32 { return f } -func (g *gasEstimatorConfig) LimitTransfer() uint32 { +func (g *gasEstimatorConfig) LimitTransfer() uint64 { return *g.c.LimitTransfer } diff --git a/core/chains/evm/config/config.go b/core/chains/evm/config/config.go index 3c504f63ae7..ee9c46c14e4 100644 --- a/core/chains/evm/config/config.go +++ b/core/chains/evm/config/config.go @@ -100,7 +100,7 @@ type GasEstimator interface { LimitDefault() uint64 LimitMax() uint64 LimitMultiplier() float32 - LimitTransfer() uint32 + LimitTransfer() uint64 PriceDefault() *assets.Wei TipCapDefault() *assets.Wei TipCapMin() *assets.Wei diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index c0457fbe850..6fa491051c5 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -280,7 +280,7 @@ func TestChainScopedConfig_GasEstimator(t *testing.T) { assert.Equal(t, uint64(500000), ge.LimitDefault()) assert.Equal(t, uint64(500000), ge.LimitMax()) assert.Equal(t, float32(1), ge.LimitMultiplier()) - assert.Equal(t, uint32(21000), ge.LimitTransfer()) + assert.Equal(t, uint64(21000), ge.LimitTransfer()) assert.Equal(t, assets.GWei(5), ge.BumpMin()) assert.Equal(t, uint16(20), ge.BumpPercent()) assert.Equal(t, uint64(3), ge.BumpThreshold()) diff --git a/core/chains/evm/config/mocks/gas_estimator.go b/core/chains/evm/config/mocks/gas_estimator.go index b1b25c0ee41..b1eb2b49b5c 100644 --- a/core/chains/evm/config/mocks/gas_estimator.go +++ b/core/chains/evm/config/mocks/gas_estimator.go @@ -223,18 +223,18 @@ func (_m *GasEstimator) LimitMultiplier() float32 { } // LimitTransfer provides a mock function with given fields: -func (_m *GasEstimator) LimitTransfer() uint32 { +func (_m *GasEstimator) LimitTransfer() uint64 { ret := _m.Called() if len(ret) == 0 { panic("no return value specified for LimitTransfer") } - var r0 uint32 - if rf, ok := ret.Get(0).(func() uint32); ok { + var r0 uint64 + if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() } else { - r0 = ret.Get(0).(uint32) + r0 = ret.Get(0).(uint64) } return r0 diff --git a/core/chains/evm/config/toml/config.go b/core/chains/evm/config/toml/config.go index a81ef4d94ff..4ad0e6569bb 100644 --- a/core/chains/evm/config/toml/config.go +++ b/core/chains/evm/config/toml/config.go @@ -485,7 +485,7 @@ type GasEstimator struct { LimitDefault *uint64 LimitMax *uint64 LimitMultiplier *decimal.Decimal - LimitTransfer *uint32 + LimitTransfer *uint64 LimitJobType GasLimitJobType `toml:",omitempty"` BumpMin *assets.Wei diff --git a/core/chains/evm/txmgr/test_helpers.go b/core/chains/evm/txmgr/test_helpers.go index 8cb771943b0..41302c8ef6d 100644 --- a/core/chains/evm/txmgr/test_helpers.go +++ b/core/chains/evm/txmgr/test_helpers.go @@ -79,7 +79,7 @@ func (g *TestGasEstimatorConfig) TipCapMin() *assets.Wei { return assets.New func (g *TestGasEstimatorConfig) LimitMax() uint64 { return 0 } func (g *TestGasEstimatorConfig) LimitMultiplier() float32 { return 0 } func (g *TestGasEstimatorConfig) BumpTxDepth() uint32 { return 42 } -func (g *TestGasEstimatorConfig) LimitTransfer() uint32 { return 42 } +func (g *TestGasEstimatorConfig) LimitTransfer() uint64 { return 42 } func (g *TestGasEstimatorConfig) PriceMax() *assets.Wei { return assets.NewWeiI(42) } func (g *TestGasEstimatorConfig) PriceMin() *assets.Wei { return assets.NewWeiI(42) } func (g *TestGasEstimatorConfig) Mode() string { return "FixedPrice" } diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 3c2c9c9d0f0..2587bbc8f5e 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -510,7 +510,7 @@ func TestConfig_Marshal(t *testing.T) { LimitDefault: ptr[uint64](12), LimitMax: ptr[uint64](17), LimitMultiplier: mustDecimal("1.234"), - LimitTransfer: ptr[uint32](100), + LimitTransfer: ptr[uint64](100), TipCapDefault: assets.NewWeiI(2), TipCapMin: assets.NewWeiI(1), PriceDefault: assets.NewWeiI(math.MaxInt64), diff --git a/core/web/evm_transfer_controller.go b/core/web/evm_transfer_controller.go index 47b7d8b4686..88d3dead4c8 100644 --- a/core/web/evm_transfer_controller.go +++ b/core/web/evm_transfer_controller.go @@ -113,7 +113,7 @@ func ValidateEthBalanceForTransfer(c *gin.Context, chain legacyevm.Chain, fromAd return errors.Errorf("balance is too low for this transaction to be executed: %v", balance) } - gasLimit := uint64(chain.Config().EVM().GasEstimator().LimitTransfer()) + gasLimit := chain.Config().EVM().GasEstimator().LimitTransfer() estimator := chain.GasEstimator() amountWithFees, err := estimator.GetMaxCost(c, amount, nil, gasLimit, chain.Config().EVM().GasEstimator().PriceMaxKey(fromAddr))