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

Gas limit estimation feature #14041

Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
baaeef6
Added gas limit estimation feature to EVM gas estimators
amit-momin Aug 5, 2024
2ccdf9d
Added changeset
amit-momin Aug 5, 2024
b1d16de
Fixed linting
amit-momin Aug 6, 2024
8c4b278
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 6, 2024
392b93b
Added new failure tests
amit-momin Aug 7, 2024
8797154
Fixed test
amit-momin Aug 7, 2024
47ab728
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 7, 2024
7ded8c4
Fixed mock configs in ccip capabilities
amit-momin Aug 7, 2024
67a665e
Fixed configs
amit-momin Aug 7, 2024
a43d391
Fixed test
amit-momin Aug 8, 2024
e09a7ca
Refactored GetFee method
amit-momin Aug 8, 2024
4305ee3
Added EstimatedGasBuffer and addressed feedback
amit-momin Aug 14, 2024
b6537da
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 14, 2024
970c0de
Fixed linting
amit-momin Aug 14, 2024
4e3afea
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 14, 2024
dba4cff
Fixed config doc and tests
amit-momin Aug 14, 2024
2660fac
Addressed feedback
amit-momin Aug 19, 2024
fdf4100
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 19, 2024
2a1d8b6
Fixed typo
amit-momin Aug 20, 2024
9ffd1dd
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 20, 2024
65950b1
Repurposed LimitMultiplier to be used as a buffer for estimated gas
amit-momin Aug 20, 2024
d71bfd3
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 20, 2024
d51878b
Updated mocks
amit-momin Aug 20, 2024
c583750
Removed LimitMultiplier if gas estimation fails and updated config docs
amit-momin Aug 20, 2024
40ad239
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 20, 2024
61039fd
Fixed Broadcaster test
amit-momin Aug 20, 2024
915e009
Enabled uncapped gas limit estimation if provided fee limit is 0
amit-momin Aug 21, 2024
7b8a668
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 21, 2024
327d434
Updated estimate gas buffer to be a fixed value instead of using Limi…
amit-momin Aug 21, 2024
9e896c0
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 21, 2024
4dc5cb5
Updated log message
amit-momin Aug 21, 2024
03db68e
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
amit-momin Aug 21, 2024
fe6bb79
Updated logs
amit-momin Aug 21, 2024
be17d56
Merge branch 'develop' into BCI-3658-Implement-the-dynamic-gas-limit-…
prashantkumar1982 Aug 22, 2024
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/loud-windows-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Added gas limit estimation feature to EVM gas estimators #added
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ func (g *TestGasEstimatorConfig) LimitJobType() evmconfig.LimitJobType {
func (g *TestGasEstimatorConfig) PriceMaxKey(addr common.Address) *assets.Wei {
return assets.GWei(1)
}
func (g *TestGasEstimatorConfig) EstimateGasLimit() bool { return false }

func (e *TestEvmConfig) GasEstimator() evmconfig.GasEstimator {
return &TestGasEstimatorConfig{bumpThreshold: e.BumpThreshold}
Expand Down
4 changes: 4 additions & 0 deletions core/chains/evm/config/chain_scoped_gas_estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func (g *gasEstimatorConfig) LimitJobType() LimitJobType {
return &limitJobTypeConfig{c: g.c.LimitJobType}
}

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

type limitJobTypeConfig struct {
c toml.GasLimitJobType
}
Expand Down
1 change: 1 addition & 0 deletions core/chains/evm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ type GasEstimator interface {
PriceMin() *assets.Wei
Mode() string
PriceMaxKey(gethcommon.Address) *assets.Wei
EstimateGasLimit() bool
}

type LimitJobType interface {
Expand Down
45 changes: 45 additions & 0 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.

14 changes: 9 additions & 5 deletions core/chains/evm/config/toml/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,12 @@ type GasEstimator struct {
PriceMax *assets.Wei
PriceMin *assets.Wei

LimitDefault *uint64
LimitMax *uint64
LimitMultiplier *decimal.Decimal
LimitTransfer *uint64
LimitJobType GasLimitJobType `toml:",omitempty"`
LimitDefault *uint64
LimitMax *uint64
LimitMultiplier *decimal.Decimal
LimitTransfer *uint64
LimitJobType GasLimitJobType `toml:",omitempty"`
EstimateGasLimit *bool

BumpMin *assets.Wei
BumpPercent *uint16
Expand Down Expand Up @@ -633,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
1 change: 1 addition & 0 deletions core/chains/evm/config/toml/defaults/fallback.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ EIP1559DynamicFees = false
FeeCapDefault = '100 gwei'
TipCapDefault = '1'
TipCapMin = '1'
EstimateGasLimit = false

[GasEstimator.BlockHistory]
BatchSize = 25
Expand Down
5 changes: 5 additions & 0 deletions core/chains/evm/gas/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ type MockGasEstimatorConfig struct {
FeeCapDefaultF *assets.Wei
LimitMaxF uint64
ModeF string
EstimateGasLimitF bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious what's the F for ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we do this because the linter doesn't like it when the field has the same name as the method to access it. Not sure why "F" but just following the pattern here

}

func NewMockGasConfig() *MockGasEstimatorConfig {
Expand Down Expand Up @@ -214,3 +215,7 @@ func (m *MockGasEstimatorConfig) LimitMax() uint64 {
func (m *MockGasEstimatorConfig) Mode() string {
return m.ModeF
}

func (m *MockGasEstimatorConfig) EstimateGasLimit() bool {
return m.EstimateGasLimitF
}
72 changes: 38 additions & 34 deletions core/chains/evm/gas/mocks/evm_fee_estimator.go

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

57 changes: 57 additions & 0 deletions core/chains/evm/gas/mocks/fee_estimator_client.go

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

Loading
Loading