Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed limitTransfer gasLimit from uint32 to uint64 #12496

Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/little-hats-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Change LimitTransfer gasLimit type from uint32 to uint64
8 changes: 4 additions & 4 deletions common/txmgr/mocks/tx_manager.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions common/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
}
Expand All @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/chain_scoped_gas_estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
8 changes: 4 additions & 4 deletions core/chains/evm/config/mocks/gas_estimator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/txmgr/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion core/web/evm_transfer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Loading