Skip to content

Commit

Permalink
Fixed configs
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-momin committed Aug 7, 2024
1 parent 7ded8c4 commit 67a665e
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 5 deletions.
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 @@ -109,7 +109,7 @@ func (g *gasEstimatorConfig) LimitJobType() LimitJobType {
}

func (g *gasEstimatorConfig) EstimateGasLimit() bool {
return g.c.EstimateGasLimit
return *g.c.EstimateGasLimit
}

type limitJobTypeConfig struct {
Expand Down
5 changes: 4 additions & 1 deletion core/chains/evm/config/toml/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ type GasEstimator struct {
LimitMultiplier *decimal.Decimal
LimitTransfer *uint64
LimitJobType GasLimitJobType `toml:",omitempty"`
EstimateGasLimit bool
EstimateGasLimit *bool

BumpMin *assets.Wei
BumpPercent *uint16
Expand Down Expand Up @@ -634,6 +634,9 @@ func (e *GasEstimator) setFrom(f *GasEstimator) {
if v := f.LimitTransfer; v != nil {
e.LimitTransfer = v
}
if v := f.EstimateGasLimit; v != nil {
e.EstimateGasLimit = v
}
if v := f.PriceDefault; v != nil {
e.PriceDefault = v
}
Expand Down
4 changes: 1 addition & 3 deletions core/chains/evm/txmgr/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,13 @@ 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" }
func (g *TestGasEstimatorConfig) EstimateGasLimit() bool { return false }
func (g *TestGasEstimatorConfig) LimitJobType() evmconfig.LimitJobType {
return &TestLimitJobTypeConfig{}
}
func (g *TestGasEstimatorConfig) PriceMaxKey(addr common.Address) *assets.Wei {
return assets.NewWeiI(42)
}
func (g *TestGasEstimatorConfig) EstimateGasLimit() bool {
return false
}

func (e *TestEvmConfig) GasEstimator() evmconfig.GasEstimator {
return &TestGasEstimatorConfig{bumpThreshold: e.BumpThreshold}
Expand Down
2 changes: 2 additions & 0 deletions core/config/docs/chains-evm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ LimitMax = 500_000 # Default
LimitMultiplier = '1.0' # Default
# LimitTransfer is the gas limit used for an ordinary ETH transfer.
LimitTransfer = 21_000 # Default
# EstimateGasLimit enables estimating gas limits for transactions. This feature respects the gas limit provided during transaction creation as an upper bound.
EstimateGasLimit = false # Default
# BumpMin is the minimum fixed amount of wei by which gas is bumped on each transaction attempt.
BumpMin = '5 gwei' # Default
# BumpPercent is the percentage by which to bump gas on a transaction that has exceeded `BumpThreshold`. The larger of `BumpPercent` and `BumpMin` is taken for gas bumps.
Expand Down
2 changes: 2 additions & 0 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ func TestConfig_Marshal(t *testing.T) {
LimitMax: ptr[uint64](17),
LimitMultiplier: mustDecimal("1.234"),
LimitTransfer: ptr[uint64](100),
EstimateGasLimit: ptr(false),
TipCapDefault: assets.NewWeiI(2),
TipCapMin: assets.NewWeiI(1),
PriceDefault: assets.NewWeiI(math.MaxInt64),
Expand Down Expand Up @@ -1024,6 +1025,7 @@ LimitDefault = 12
LimitMax = 17
LimitMultiplier = '1.234'
LimitTransfer = 100
EstimateGasLimit = false
BumpMin = '100 wei'
BumpPercent = 10
BumpThreshold = 6
Expand Down
1 change: 1 addition & 0 deletions core/services/chainlink/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ LimitDefault = 12
LimitMax = 17
LimitMultiplier = '1.234'
LimitTransfer = 100
EstimateGasLimit = false
BumpMin = '100 wei'
BumpPercent = 10
BumpThreshold = 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateGasLimit = false
BumpMin = '5 gwei'
BumpPercent = 20
BumpThreshold = 3
Expand Down Expand Up @@ -403,6 +404,7 @@ LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateGasLimit = false
BumpMin = '5 gwei'
BumpPercent = 20
BumpThreshold = 3
Expand Down Expand Up @@ -497,6 +499,7 @@ LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateGasLimit = false
BumpMin = '20 gwei'
BumpPercent = 20
BumpThreshold = 5
Expand Down
1 change: 1 addition & 0 deletions core/web/resolver/testdata/config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ LimitDefault = 12
LimitMax = 17
LimitMultiplier = '1.234'
LimitTransfer = 100
EstimateGasLimit = false
BumpMin = '100 wei'
BumpPercent = 10
BumpThreshold = 6
Expand Down
3 changes: 3 additions & 0 deletions core/web/resolver/testdata/config-multi-chain-effective.toml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateGasLimit = false
BumpMin = '5 gwei'
BumpPercent = 20
BumpThreshold = 3
Expand Down Expand Up @@ -403,6 +404,7 @@ LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateGasLimit = false
BumpMin = '5 gwei'
BumpPercent = 20
BumpThreshold = 3
Expand Down Expand Up @@ -497,6 +499,7 @@ LimitDefault = 500000
LimitMax = 500000
LimitMultiplier = '1'
LimitTransfer = 21000
EstimateGasLimit = false
BumpMin = '20 gwei'
BumpPercent = 20
BumpThreshold = 5
Expand Down
Loading

0 comments on commit 67a665e

Please sign in to comment.