From 868f1ef19f09d7e0a6fb5b0fd81a648210e75021 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Thu, 26 Oct 2023 12:37:03 -0400 Subject: [PATCH 01/15] Rename L2Suggested to SuggestedPrice --- core/chains/evm/config/config_test.go | 2 +- .../config/toml/defaults/Fantom_Mainnet.toml | 5 ++--- .../config/toml/defaults/Fantom_Testnet.toml | 2 +- .../config/toml/defaults/Klaytn_Mainnet.toml | 2 +- .../config/toml/defaults/Klaytn_Testnet.toml | 2 +- .../config/toml/defaults/Metis_Mainnet.toml | 4 ++-- .../config/toml/defaults/Metis_Rinkeby.toml | 2 +- .../config/toml/defaults/Scroll_Mainnet.toml | 4 ++-- .../config/toml/defaults/Scroll_Sepolia.toml | 4 ++-- core/chains/evm/gas/models.go | 2 +- core/config/docs/chains-evm.toml | 2 +- core/services/chainlink/config_test.go | 4 ++-- .../chainlink/testdata/config-full.toml | 2 +- core/web/resolver/testdata/config-full.toml | 2 +- docs/CHANGELOG.md | 2 +- docs/CONFIG.md | 18 +++++++++--------- 16 files changed, 29 insertions(+), 30 deletions(-) diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index d0f9e846e37..0a3fc5f41e6 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -423,7 +423,7 @@ func Test_chainScopedConfig_Validate(t *testing.T) { t.Run("testnet", func(t *testing.T) { cfg := configWithChains(t, 421611, &toml.Chain{ GasEstimator: toml.GasEstimator{ - Mode: ptr("L2Suggested"), + Mode: ptr("SuggestedPrice"), }, }) assert.NoError(t, cfg.Validate()) diff --git a/core/chains/evm/config/toml/defaults/Fantom_Mainnet.toml b/core/chains/evm/config/toml/defaults/Fantom_Mainnet.toml index 7046642bb93..c7fb6ba4736 100644 --- a/core/chains/evm/config/toml/defaults/Fantom_Mainnet.toml +++ b/core/chains/evm/config/toml/defaults/Fantom_Mainnet.toml @@ -9,9 +9,8 @@ RPCBlockQueryDelay = 2 Enabled = true [GasEstimator] -# Fantom network has been slow to include txs at times when using the BlockHistory estimator, and the recommendation is to use L2Suggested mode. -# There is work under way to improve L2Suggested mode's name so that its use on non-L2 chains will be less confusing in the future. -Mode = 'L2Suggested' +# Fantom network has been slow to include txs at times when using the BlockHistory estimator, and the recommendation is to use SuggestedPrice mode. +Mode = 'SuggestedPrice' [OCR2.Automation] GasLimit = 3800000 \ No newline at end of file diff --git a/core/chains/evm/config/toml/defaults/Fantom_Testnet.toml b/core/chains/evm/config/toml/defaults/Fantom_Testnet.toml index 0292ed5b743..1e1aab14681 100644 --- a/core/chains/evm/config/toml/defaults/Fantom_Testnet.toml +++ b/core/chains/evm/config/toml/defaults/Fantom_Testnet.toml @@ -7,7 +7,7 @@ NoNewHeadsThreshold = '0' RPCBlockQueryDelay = 2 [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' [OCR2.Automation] GasLimit = 3800000 \ No newline at end of file diff --git a/core/chains/evm/config/toml/defaults/Klaytn_Mainnet.toml b/core/chains/evm/config/toml/defaults/Klaytn_Mainnet.toml index 36dc04ae96b..c68f03b0446 100644 --- a/core/chains/evm/config/toml/defaults/Klaytn_Mainnet.toml +++ b/core/chains/evm/config/toml/defaults/Klaytn_Mainnet.toml @@ -5,6 +5,6 @@ NoNewHeadsThreshold = '30s' OCR.ContractConfirmations = 1 [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '750 gwei' # gwei = ston BumpThreshold = 0 diff --git a/core/chains/evm/config/toml/defaults/Klaytn_Testnet.toml b/core/chains/evm/config/toml/defaults/Klaytn_Testnet.toml index 34b15ca74b1..864aa0fa72a 100644 --- a/core/chains/evm/config/toml/defaults/Klaytn_Testnet.toml +++ b/core/chains/evm/config/toml/defaults/Klaytn_Testnet.toml @@ -5,6 +5,6 @@ NoNewHeadsThreshold = '30s' OCR.ContractConfirmations = 1 [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '750 gwei' # gwei = ston BumpThreshold = 0 diff --git a/core/chains/evm/config/toml/defaults/Metis_Mainnet.toml b/core/chains/evm/config/toml/defaults/Metis_Mainnet.toml index 855fef55a75..3e8efa531cc 100644 --- a/core/chains/evm/config/toml/defaults/Metis_Mainnet.toml +++ b/core/chains/evm/config/toml/defaults/Metis_Mainnet.toml @@ -8,8 +8,8 @@ NoNewHeadsThreshold = '0' OCR.ContractConfirmations = 1 [GasEstimator] -Mode = 'L2Suggested' -# Metis uses the L2Suggested estimator; we don't want to place any limits on the minimum gas price +Mode = 'SuggestedPrice' +# Metis uses the SuggestedPrice estimator; we don't want to place any limits on the minimum gas price PriceMin = '0' # Never bump gas on metis BumpThreshold = 0 diff --git a/core/chains/evm/config/toml/defaults/Metis_Rinkeby.toml b/core/chains/evm/config/toml/defaults/Metis_Rinkeby.toml index 487cc224852..7d9fec9076f 100644 --- a/core/chains/evm/config/toml/defaults/Metis_Rinkeby.toml +++ b/core/chains/evm/config/toml/defaults/Metis_Rinkeby.toml @@ -9,7 +9,7 @@ OCR.ContractConfirmations = 1 Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceMin = '0' BumpThreshold = 0 diff --git a/core/chains/evm/config/toml/defaults/Scroll_Mainnet.toml b/core/chains/evm/config/toml/defaults/Scroll_Mainnet.toml index 63c08559016..56ed84c7f38 100644 --- a/core/chains/evm/config/toml/defaults/Scroll_Mainnet.toml +++ b/core/chains/evm/config/toml/defaults/Scroll_Mainnet.toml @@ -7,8 +7,8 @@ NoNewHeadsThreshold = '0' OCR.ContractConfirmations = 1 [GasEstimator] -Mode = 'L2Suggested' -# Scroll uses the L2Suggested estimator; we don't want to place any limits on the minimum gas price +Mode = 'SuggestedPrice' +# Scroll uses the SuggestedPrice estimator; we don't want to place any limits on the minimum gas price PriceMin = '0' # Never bump gas on Scroll BumpThreshold = 0 diff --git a/core/chains/evm/config/toml/defaults/Scroll_Sepolia.toml b/core/chains/evm/config/toml/defaults/Scroll_Sepolia.toml index 5a1a0f9ba7d..af17c4d485e 100644 --- a/core/chains/evm/config/toml/defaults/Scroll_Sepolia.toml +++ b/core/chains/evm/config/toml/defaults/Scroll_Sepolia.toml @@ -7,8 +7,8 @@ NoNewHeadsThreshold = '0' OCR.ContractConfirmations = 1 [GasEstimator] -Mode = 'L2Suggested' -# Scroll uses the L2Suggested estimator; we don't want to place any limits on the minimum gas price +Mode = 'SuggestedPrice' +# Scroll uses the SuggestedPrice estimator; we don't want to place any limits on the minimum gas price PriceMin = '0' # Never bump gas on Scroll BumpThreshold = 0 diff --git a/core/chains/evm/gas/models.go b/core/chains/evm/gas/models.go index bd3106c2ad4..4dfcbaea26e 100644 --- a/core/chains/evm/gas/models.go +++ b/core/chains/evm/gas/models.go @@ -79,7 +79,7 @@ func NewEstimator(lggr logger.Logger, ethClient evmclient.Client, cfg Config, ge return NewWrappedEvmEstimator(NewBlockHistoryEstimator(lggr, ethClient, cfg, geCfg, bh, *ethClient.ConfiguredChainID()), df, l1Oracle) case "FixedPrice": return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df, l1Oracle) - case "Optimism2", "L2Suggested": + case "Optimism2", "SuggestedPrice": return NewWrappedEvmEstimator(NewL2SuggestedPriceEstimator(lggr, ethClient), df, l1Oracle) default: lggr.Warnf("GasEstimator: unrecognised mode '%s', falling back to FixedPriceEstimator", s) diff --git a/core/config/docs/chains-evm.toml b/core/config/docs/chains-evm.toml index c8b5395d6d7..ef98c34690a 100644 --- a/core/config/docs/chains-evm.toml +++ b/core/config/docs/chains-evm.toml @@ -112,7 +112,7 @@ Enabled = true # Default # # - `FixedPrice` uses static configured values for gas price (can be set via API call). # - `BlockHistory` dynamically adjusts default gas price based on heuristics from mined blocks. -# - `L2Suggested` is a special mode only for use with L2 blockchains. This mode will use the gas price suggested by the rpc endpoint via `eth_gasPrice`. +# - `SuggestedPrice` is a special mode only for use with L2 blockchains. This mode will use the gas price suggested by the rpc endpoint via `eth_gasPrice`. # - `Arbitrum` is a special mode only for use with Arbitrum blockchains. It uses the suggested gas price (up to `ETH_MAX_GAS_PRICE_WEI`, with `1000 gwei` default) as well as an estimated gas limit (up to `ETH_GAS_LIMIT_MAX`, with `1,000,000,000` default). # # Chainlink nodes decide what gas price to use using an `Estimator`. It ships with several simple and battle-hardened built-in estimators that should work well for almost all use-cases. Note that estimators will change their behaviour slightly depending on if you are in EIP-1559 mode or not. diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index d811dd8209d..25c04909f20 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -469,7 +469,7 @@ func TestConfig_Marshal(t *testing.T) { FlagsContractAddress: mustAddress("0xae4E781a6218A8031764928E88d457937A954fC3"), GasEstimator: evmcfg.GasEstimator{ - Mode: ptr("L2Suggested"), + Mode: ptr("SuggestedPrice"), EIP1559DynamicFees: ptr(true), BumpPercent: ptr[uint16](10), BumpThreshold: ptr[uint32](6), @@ -913,7 +913,7 @@ ResendAfterThreshold = '1h0m0s' Enabled = true [EVM.GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '9.223372036854775807 ether' PriceMax = '281.474976710655 micro' PriceMin = '13 wei' diff --git a/core/services/chainlink/testdata/config-full.toml b/core/services/chainlink/testdata/config-full.toml index 3bd422f8923..e5b9970808c 100644 --- a/core/services/chainlink/testdata/config-full.toml +++ b/core/services/chainlink/testdata/config-full.toml @@ -257,7 +257,7 @@ ResendAfterThreshold = '1h0m0s' Enabled = true [EVM.GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '9.223372036854775807 ether' PriceMax = '281.474976710655 micro' PriceMin = '13 wei' diff --git a/core/web/resolver/testdata/config-full.toml b/core/web/resolver/testdata/config-full.toml index 5a815b2e012..40a33ecf1d6 100644 --- a/core/web/resolver/testdata/config-full.toml +++ b/core/web/resolver/testdata/config-full.toml @@ -257,7 +257,7 @@ ResendAfterThreshold = '1h0m0s' Enabled = true [EVM.GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '9.223372036854775807 ether' PriceMax = '281.474976710655 micro' PriceMin = '13 wei' diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 44d018769ec..41d60adde96 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -611,7 +611,7 @@ For backward compatibility all insecure passwords will continue to work, however - The following ENV variables have been deprecated, and will be removed in a future release: `INSECURE_SKIP_VERIFY`, `CLIENT_NODE_URL`, `ADMIN_CREDENTIALS_FILE`. These vars only applied to Chainlink when running in client mode and have been replaced by command line args, notably: `--insecure-skip-verify`, `--remote-node-url URL` and `--admin-credentials-file FILE` respectively. More information can be found by running `./chainlink --help`. -- The `Optimism2` `GAS_ESTIMATOR_MODE` has been renamed to `L2Suggested`. The old name is still supported for now. +- The `Optimism2` `GAS_ESTIMATOR_MODE` has been renamed to `SuggestedPrice`. The old name is still supported for now. - The `p2pBootstrapPeers` property on OCR2 job specs has been renamed to `p2pv2Bootstrappers`. diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 1fc7d9b632f..3f7ca91eddf 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -2724,7 +2724,7 @@ ResendAfterThreshold = '1m0s' Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '20 gwei' PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' PriceMin = '1 gwei' @@ -2883,7 +2883,7 @@ ResendAfterThreshold = '1m0s' Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '20 gwei' PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' PriceMin = '0' @@ -2961,7 +2961,7 @@ ResendAfterThreshold = '1m0s' Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '750 gwei' PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' PriceMin = '1 gwei' @@ -3040,7 +3040,7 @@ ResendAfterThreshold = '1m0s' Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '20 gwei' PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' PriceMin = '0' @@ -3197,7 +3197,7 @@ ResendAfterThreshold = '1m0s' Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '20 gwei' PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' PriceMin = '1 gwei' @@ -3275,7 +3275,7 @@ ResendAfterThreshold = '1m0s' Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '750 gwei' PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' PriceMin = '1 gwei' @@ -4381,7 +4381,7 @@ ResendAfterThreshold = '1m0s' Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '20 gwei' PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' PriceMin = '0' @@ -4459,7 +4459,7 @@ ResendAfterThreshold = '1m0s' Enabled = true [GasEstimator] -Mode = 'L2Suggested' +Mode = 'SuggestedPrice' PriceDefault = '20 gwei' PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' PriceMin = '0' @@ -5002,7 +5002,7 @@ Mode controls what type of gas estimator is used. - `FixedPrice` uses static configured values for gas price (can be set via API call). - `BlockHistory` dynamically adjusts default gas price based on heuristics from mined blocks. -- `L2Suggested` is a special mode only for use with L2 blockchains. This mode will use the gas price suggested by the rpc endpoint via `eth_gasPrice`. +- `SuggestedPrice` is a special mode only for use with L2 blockchains. This mode will use the gas price suggested by the rpc endpoint via `eth_gasPrice`. - `Arbitrum` is a special mode only for use with Arbitrum blockchains. It uses the suggested gas price (up to `ETH_MAX_GAS_PRICE_WEI`, with `1000 gwei` default) as well as an estimated gas limit (up to `ETH_GAS_LIMIT_MAX`, with `1,000,000,000` default). Chainlink nodes decide what gas price to use using an `Estimator`. It ships with several simple and battle-hardened built-in estimators that should work well for almost all use-cases. Note that estimators will change their behaviour slightly depending on if you are in EIP-1559 mode or not. From c24bad4e41e27872eeb090e758e34fa322587327 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Thu, 26 Oct 2023 12:57:28 -0400 Subject: [PATCH 02/15] Rename L2Suggested to SuggestedPrice --- core/chains/evm/gas/arbitrum_estimator.go | 8 +-- core/chains/evm/gas/models.go | 2 +- ...imator.go => suggested_price_estimator.go} | 56 +++++++++---------- ...t.go => suggested_price_estimator_test.go} | 16 +++--- 4 files changed, 41 insertions(+), 41 deletions(-) rename core/chains/evm/gas/{l2_suggested_estimator.go => suggested_price_estimator.go} (61%) rename core/chains/evm/gas/{l2_suggested_estimator_test.go => suggested_price_estimator_test.go} (87%) diff --git a/core/chains/evm/gas/arbitrum_estimator.go b/core/chains/evm/gas/arbitrum_estimator.go index 6c2b5e8b879..68100dcb7b5 100644 --- a/core/chains/evm/gas/arbitrum_estimator.go +++ b/core/chains/evm/gas/arbitrum_estimator.go @@ -31,11 +31,11 @@ type ethClient interface { CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) } -// arbitrumEstimator is an Estimator which extends l2SuggestedPriceEstimator to use getPricesInArbGas() for gas limit estimation. +// arbitrumEstimator is an Estimator which extends SuggestedPriceEstimator to use getPricesInArbGas() for gas limit estimation. type arbitrumEstimator struct { cfg ArbConfig - EvmEstimator // *l2SuggestedPriceEstimator + EvmEstimator // *SuggestedPriceEstimator client ethClient pollPeriod time.Duration @@ -57,7 +57,7 @@ func NewArbitrumEstimator(lggr logger.Logger, cfg ArbConfig, rpcClient rpcClient lggr = lggr.Named("ArbitrumEstimator") return &arbitrumEstimator{ cfg: cfg, - EvmEstimator: NewL2SuggestedPriceEstimator(lggr, rpcClient), + EvmEstimator: NewSuggestedPriceEstimator(lggr, rpcClient), client: ethClient, pollPeriod: 10 * time.Second, logger: lggr, @@ -100,7 +100,7 @@ func (a *arbitrumEstimator) HealthReport() map[string]error { } // GetLegacyGas estimates both the gas price and the gas limit. -// - Price is delegated to the embedded l2SuggestedPriceEstimator. +// - Price is delegated to the embedded SuggestedPriceEstimator. // - Limit is computed from the dynamic values perL2Tx and perL1CalldataUnit, provided by the getPricesInArbGas() method // of the precompilie contract at ArbGasInfoAddress. perL2Tx is a constant amount of gas, and perL1CalldataUnit is // multiplied by the length of the tx calldata. The sum of these two values plus the original l2GasLimit is returned. diff --git a/core/chains/evm/gas/models.go b/core/chains/evm/gas/models.go index 4dfcbaea26e..c4255834791 100644 --- a/core/chains/evm/gas/models.go +++ b/core/chains/evm/gas/models.go @@ -80,7 +80,7 @@ func NewEstimator(lggr logger.Logger, ethClient evmclient.Client, cfg Config, ge case "FixedPrice": return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df, l1Oracle) case "Optimism2", "SuggestedPrice": - return NewWrappedEvmEstimator(NewL2SuggestedPriceEstimator(lggr, ethClient), df, l1Oracle) + return NewWrappedEvmEstimator(NewSuggestedPriceEstimator(lggr, ethClient), df, l1Oracle) default: lggr.Warnf("GasEstimator: unrecognised mode '%s', falling back to FixedPriceEstimator", s) return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df, l1Oracle) diff --git a/core/chains/evm/gas/l2_suggested_estimator.go b/core/chains/evm/gas/suggested_price_estimator.go similarity index 61% rename from core/chains/evm/gas/l2_suggested_estimator.go rename to core/chains/evm/gas/suggested_price_estimator.go index 1782e349302..1c9087a06f3 100644 --- a/core/chains/evm/gas/l2_suggested_estimator.go +++ b/core/chains/evm/gas/suggested_price_estimator.go @@ -18,7 +18,7 @@ import ( ) var ( - _ EvmEstimator = &l2SuggestedPriceEstimator{} + _ EvmEstimator = &SuggestedPriceEstimator{} ) //go:generate mockery --quiet --name rpcClient --output ./mocks/ --case=underscore --structname RPCClient @@ -26,8 +26,8 @@ type rpcClient interface { CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error } -// l2SuggestedPriceEstimator is an Estimator which uses the L2 suggested gas price from eth_gasPrice. -type l2SuggestedPriceEstimator struct { +// SuggestedPriceEstimator is an Estimator which uses the L2 suggested gas price from eth_gasPrice. +type SuggestedPriceEstimator struct { utils.StartStopOnce client rpcClient @@ -35,7 +35,7 @@ type l2SuggestedPriceEstimator struct { logger logger.Logger gasPriceMu sync.RWMutex - l2GasPrice *assets.Wei + GasPrice *assets.Wei chForceRefetch chan (chan struct{}) chInitialised chan struct{} @@ -43,12 +43,12 @@ type l2SuggestedPriceEstimator struct { chDone chan struct{} } -// NewL2SuggestedPriceEstimator returns a new Estimator which uses the L2 suggested gas price. -func NewL2SuggestedPriceEstimator(lggr logger.Logger, client rpcClient) EvmEstimator { - return &l2SuggestedPriceEstimator{ +// NewSuggestedPriceEstimator returns a new Estimator which uses the L2 suggested gas price. +func NewSuggestedPriceEstimator(lggr logger.Logger, client rpcClient) EvmEstimator { + return &SuggestedPriceEstimator{ client: client, pollPeriod: 10 * time.Second, - logger: lggr.Named("L2SuggestedEstimator"), + logger: lggr.Named("SuggestedPriceEstimator"), chForceRefetch: make(chan (chan struct{})), chInitialised: make(chan struct{}), chStop: make(chan struct{}), @@ -56,30 +56,30 @@ func NewL2SuggestedPriceEstimator(lggr logger.Logger, client rpcClient) EvmEstim } } -func (o *l2SuggestedPriceEstimator) Name() string { +func (o *SuggestedPriceEstimator) Name() string { return o.logger.Name() } -func (o *l2SuggestedPriceEstimator) Start(context.Context) error { - return o.StartOnce("L2SuggestedEstimator", func() error { +func (o *SuggestedPriceEstimator) Start(context.Context) error { + return o.StartOnce("SuggestedPriceEstimator", func() error { go o.run() <-o.chInitialised return nil }) } -func (o *l2SuggestedPriceEstimator) Close() error { - return o.StopOnce("L2SuggestedEstimator", func() error { +func (o *SuggestedPriceEstimator) Close() error { + return o.StopOnce("SuggestedPriceEstimator", func() error { close(o.chStop) <-o.chDone return nil }) } -func (o *l2SuggestedPriceEstimator) HealthReport() map[string]error { +func (o *SuggestedPriceEstimator) HealthReport() map[string]error { return map[string]error{o.Name(): o.Healthy()} } -func (o *l2SuggestedPriceEstimator) run() { +func (o *SuggestedPriceEstimator) run() { defer close(o.chDone) t := o.refreshPrice() @@ -99,7 +99,7 @@ func (o *l2SuggestedPriceEstimator) run() { } } -func (o *l2SuggestedPriceEstimator) refreshPrice() (t *time.Timer) { +func (o *SuggestedPriceEstimator) refreshPrice() (t *time.Timer) { t = time.NewTimer(utils.WithJitter(o.pollPeriod)) var res hexutil.Big @@ -112,28 +112,28 @@ func (o *l2SuggestedPriceEstimator) refreshPrice() (t *time.Timer) { } bi := (*assets.Wei)(&res) - o.logger.Debugw("refreshPrice", "l2GasPrice", bi) + o.logger.Debugw("refreshPrice", "GasPrice", bi) o.gasPriceMu.Lock() defer o.gasPriceMu.Unlock() - o.l2GasPrice = bi + o.GasPrice = bi return } -func (o *l2SuggestedPriceEstimator) OnNewLongestChain(context.Context, *evmtypes.Head) {} +func (o *SuggestedPriceEstimator) OnNewLongestChain(context.Context, *evmtypes.Head) {} -func (*l2SuggestedPriceEstimator) GetDynamicFee(_ context.Context, _ uint32, _ *assets.Wei) (fee DynamicFee, chainSpecificGasLimit uint32, err error) { +func (*SuggestedPriceEstimator) GetDynamicFee(_ context.Context, _ uint32, _ *assets.Wei) (fee DynamicFee, chainSpecificGasLimit uint32, err error) { err = errors.New("dynamic fees are not implemented for this layer 2") return } -func (*l2SuggestedPriceEstimator) BumpDynamicFee(_ context.Context, _ DynamicFee, _ uint32, _ *assets.Wei, _ []EvmPriorAttempt) (bumped DynamicFee, chainSpecificGasLimit uint32, err error) { +func (*SuggestedPriceEstimator) BumpDynamicFee(_ context.Context, _ DynamicFee, _ uint32, _ *assets.Wei, _ []EvmPriorAttempt) (bumped DynamicFee, chainSpecificGasLimit uint32, err error) { err = errors.New("dynamic fees are not implemented for this layer 2") return } -func (o *l2SuggestedPriceEstimator) GetLegacyGas(ctx context.Context, _ []byte, l2GasLimit uint32, maxGasPriceWei *assets.Wei, opts ...feetypes.Opt) (gasPrice *assets.Wei, chainSpecificGasLimit uint32, err error) { - chainSpecificGasLimit = l2GasLimit +func (o *SuggestedPriceEstimator) GetLegacyGas(ctx context.Context, _ []byte, GasLimit uint32, maxGasPriceWei *assets.Wei, opts ...feetypes.Opt) (gasPrice *assets.Wei, chainSpecificGasLimit uint32, err error) { + chainSpecificGasLimit = GasLimit ok := o.IfStarted(func() { if slices.Contains(opts, feetypes.OptForceRefetch) { @@ -158,10 +158,10 @@ func (o *l2SuggestedPriceEstimator) GetLegacyGas(ctx context.Context, _ []byte, } } if gasPrice = o.getGasPrice(); gasPrice == nil { - err = errors.New("failed to estimate l2 gas; gas price not set") + err = errors.New("failed to estimate gas; gas price not set") return } - o.logger.Debugw("GetLegacyGas", "l2GasPrice", gasPrice, "l2GasLimit", l2GasLimit) + o.logger.Debugw("GetLegacyGas", "GasPrice", gasPrice, "GasLimit", GasLimit) }) if !ok { return nil, 0, errors.New("estimator is not started") @@ -175,12 +175,12 @@ func (o *l2SuggestedPriceEstimator) GetLegacyGas(ctx context.Context, _ []byte, return } -func (o *l2SuggestedPriceEstimator) BumpLegacyGas(_ context.Context, _ *assets.Wei, _ uint32, _ *assets.Wei, _ []EvmPriorAttempt) (bumpedGasPrice *assets.Wei, chainSpecificGasLimit uint32, err error) { +func (o *SuggestedPriceEstimator) BumpLegacyGas(_ context.Context, _ *assets.Wei, _ uint32, _ *assets.Wei, _ []EvmPriorAttempt) (bumpedGasPrice *assets.Wei, chainSpecificGasLimit uint32, err error) { return nil, 0, errors.New("bump gas is not supported for this l2") } -func (o *l2SuggestedPriceEstimator) getGasPrice() (l2GasPrice *assets.Wei) { +func (o *SuggestedPriceEstimator) getGasPrice() (GasPrice *assets.Wei) { o.gasPriceMu.RLock() defer o.gasPriceMu.RUnlock() - return o.l2GasPrice + return o.GasPrice } diff --git a/core/chains/evm/gas/l2_suggested_estimator_test.go b/core/chains/evm/gas/suggested_price_estimator_test.go similarity index 87% rename from core/chains/evm/gas/l2_suggested_estimator_test.go rename to core/chains/evm/gas/suggested_price_estimator_test.go index 69b36033024..c0dc4550cfb 100644 --- a/core/chains/evm/gas/l2_suggested_estimator_test.go +++ b/core/chains/evm/gas/suggested_price_estimator_test.go @@ -17,7 +17,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" ) -func TestL2SuggestedEstimator(t *testing.T) { +func TestSuggestedPriceEstimator(t *testing.T) { t.Parallel() maxGasPrice := assets.NewWeiI(100) @@ -27,7 +27,7 @@ func TestL2SuggestedEstimator(t *testing.T) { t.Run("calling GetLegacyGas on unstarted estimator returns error", func(t *testing.T) { client := mocks.NewRPCClient(t) - o := gas.NewL2SuggestedPriceEstimator(logger.TestLogger(t), client) + o := gas.NewSuggestedPriceEstimator(logger.TestLogger(t), client) _, _, err := o.GetLegacyGas(testutils.Context(t), calldata, gasLimit, maxGasPrice) assert.EqualError(t, err, "estimator is not started") }) @@ -39,7 +39,7 @@ func TestL2SuggestedEstimator(t *testing.T) { (*big.Int)(res).SetInt64(42) }) - o := gas.NewL2SuggestedPriceEstimator(logger.TestLogger(t), client) + o := gas.NewSuggestedPriceEstimator(logger.TestLogger(t), client) require.NoError(t, o.Start(testutils.Context(t))) t.Cleanup(func() { assert.NoError(t, o.Close()) }) gasPrice, chainSpecificGasLimit, err := o.GetLegacyGas(testutils.Context(t), calldata, gasLimit, maxGasPrice) @@ -50,7 +50,7 @@ func TestL2SuggestedEstimator(t *testing.T) { t.Run("gas price is lower than user specified max gas price", func(t *testing.T) { client := mocks.NewRPCClient(t) - o := gas.NewL2SuggestedPriceEstimator(logger.TestLogger(t), client) + o := gas.NewSuggestedPriceEstimator(logger.TestLogger(t), client) client.On("CallContext", mock.Anything, mock.Anything, "eth_gasPrice").Return(nil).Run(func(args mock.Arguments) { res := args.Get(1).(*hexutil.Big) @@ -68,7 +68,7 @@ func TestL2SuggestedEstimator(t *testing.T) { t.Run("gas price is lower than global max gas price", func(t *testing.T) { client := mocks.NewRPCClient(t) - o := gas.NewL2SuggestedPriceEstimator(logger.TestLogger(t), client) + o := gas.NewSuggestedPriceEstimator(logger.TestLogger(t), client) client.On("CallContext", mock.Anything, mock.Anything, "eth_gasPrice").Return(nil).Run(func(args mock.Arguments) { res := args.Get(1).(*hexutil.Big) @@ -85,14 +85,14 @@ func TestL2SuggestedEstimator(t *testing.T) { t.Run("calling BumpLegacyGas always returns error", func(t *testing.T) { client := mocks.NewRPCClient(t) - o := gas.NewL2SuggestedPriceEstimator(logger.TestLogger(t), client) + o := gas.NewSuggestedPriceEstimator(logger.TestLogger(t), client) _, _, err := o.BumpLegacyGas(testutils.Context(t), assets.NewWeiI(42), gasLimit, assets.NewWeiI(10), nil) assert.EqualError(t, err, "bump gas is not supported for this l2") }) t.Run("calling GetLegacyGas on started estimator if initial call failed returns error", func(t *testing.T) { client := mocks.NewRPCClient(t) - o := gas.NewL2SuggestedPriceEstimator(logger.TestLogger(t), client) + o := gas.NewSuggestedPriceEstimator(logger.TestLogger(t), client) client.On("CallContext", mock.Anything, mock.Anything, "eth_gasPrice").Return(errors.New("kaboom")) @@ -100,6 +100,6 @@ func TestL2SuggestedEstimator(t *testing.T) { t.Cleanup(func() { assert.NoError(t, o.Close()) }) _, _, err := o.GetLegacyGas(testutils.Context(t), calldata, gasLimit, maxGasPrice) - assert.EqualError(t, err, "failed to estimate l2 gas; gas price not set") + assert.EqualError(t, err, "failed to estimate gas; gas price not set") }) } From 030253a04d35bcdecfb2b7daa3621b45e1c70616 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Thu, 26 Oct 2023 13:26:53 -0400 Subject: [PATCH 03/15] update test error string --- core/chains/evm/gas/arbitrum_estimator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/chains/evm/gas/arbitrum_estimator_test.go b/core/chains/evm/gas/arbitrum_estimator_test.go index b6e299190c5..9ccb1f5161d 100644 --- a/core/chains/evm/gas/arbitrum_estimator_test.go +++ b/core/chains/evm/gas/arbitrum_estimator_test.go @@ -152,7 +152,7 @@ func TestArbitrumEstimator(t *testing.T) { t.Cleanup(func() { assert.NoError(t, o.Close()) }) _, _, err := o.GetLegacyGas(testutils.Context(t), calldata, gasLimit, maxGasPrice) - assert.EqualError(t, err, "failed to estimate l2 gas; gas price not set") + assert.EqualError(t, err, "failed to estimate gas; gas price not set") }) t.Run("limit computes", func(t *testing.T) { From 86bfb6100abbe76f6e643a5cfc35b455ba35e1ad Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Fri, 27 Oct 2023 10:48:18 -0400 Subject: [PATCH 04/15] update comment --- core/chains/evm/gas/suggested_price_estimator.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/chains/evm/gas/suggested_price_estimator.go b/core/chains/evm/gas/suggested_price_estimator.go index 1c9087a06f3..a0a9eda8b8b 100644 --- a/core/chains/evm/gas/suggested_price_estimator.go +++ b/core/chains/evm/gas/suggested_price_estimator.go @@ -44,6 +44,7 @@ type SuggestedPriceEstimator struct { } // NewSuggestedPriceEstimator returns a new Estimator which uses the L2 suggested gas price. +// Can also be used for non-L2 chains. func NewSuggestedPriceEstimator(lggr logger.Logger, client rpcClient) EvmEstimator { return &SuggestedPriceEstimator{ client: client, From b70cb2ad1154327542035fcf3e54a2f727cd0a63 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Fri, 27 Oct 2023 10:52:36 -0400 Subject: [PATCH 05/15] update docs --- core/config/docs/chains-evm.toml | 2 +- docs/CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/config/docs/chains-evm.toml b/core/config/docs/chains-evm.toml index ef98c34690a..5d1a9f02689 100644 --- a/core/config/docs/chains-evm.toml +++ b/core/config/docs/chains-evm.toml @@ -112,7 +112,7 @@ Enabled = true # Default # # - `FixedPrice` uses static configured values for gas price (can be set via API call). # - `BlockHistory` dynamically adjusts default gas price based on heuristics from mined blocks. -# - `SuggestedPrice` is a special mode only for use with L2 blockchains. This mode will use the gas price suggested by the rpc endpoint via `eth_gasPrice`. +# - `SuggestedPrice` is a mode which uses the gas price suggested by the rpc endpoint via `eth_gasPrice`. # - `Arbitrum` is a special mode only for use with Arbitrum blockchains. It uses the suggested gas price (up to `ETH_MAX_GAS_PRICE_WEI`, with `1000 gwei` default) as well as an estimated gas limit (up to `ETH_GAS_LIMIT_MAX`, with `1,000,000,000` default). # # Chainlink nodes decide what gas price to use using an `Estimator`. It ships with several simple and battle-hardened built-in estimators that should work well for almost all use-cases. Note that estimators will change their behaviour slightly depending on if you are in EIP-1559 mode or not. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 41d60adde96..44d018769ec 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -611,7 +611,7 @@ For backward compatibility all insecure passwords will continue to work, however - The following ENV variables have been deprecated, and will be removed in a future release: `INSECURE_SKIP_VERIFY`, `CLIENT_NODE_URL`, `ADMIN_CREDENTIALS_FILE`. These vars only applied to Chainlink when running in client mode and have been replaced by command line args, notably: `--insecure-skip-verify`, `--remote-node-url URL` and `--admin-credentials-file FILE` respectively. More information can be found by running `./chainlink --help`. -- The `Optimism2` `GAS_ESTIMATOR_MODE` has been renamed to `SuggestedPrice`. The old name is still supported for now. +- The `Optimism2` `GAS_ESTIMATOR_MODE` has been renamed to `L2Suggested`. The old name is still supported for now. - The `p2pBootstrapPeers` property on OCR2 job specs has been renamed to `p2pv2Bootstrappers`. From d4c91f2ebadba089c1608d2dced8df439bae605a Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Fri, 27 Oct 2023 11:13:30 -0400 Subject: [PATCH 06/15] generate docs --- docs/CONFIG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 3f7ca91eddf..147ec3d829b 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -5002,7 +5002,7 @@ Mode controls what type of gas estimator is used. - `FixedPrice` uses static configured values for gas price (can be set via API call). - `BlockHistory` dynamically adjusts default gas price based on heuristics from mined blocks. -- `SuggestedPrice` is a special mode only for use with L2 blockchains. This mode will use the gas price suggested by the rpc endpoint via `eth_gasPrice`. +- `SuggestedPrice` is a mode which uses the gas price suggested by the rpc endpoint via `eth_gasPrice`. - `Arbitrum` is a special mode only for use with Arbitrum blockchains. It uses the suggested gas price (up to `ETH_MAX_GAS_PRICE_WEI`, with `1000 gwei` default) as well as an estimated gas limit (up to `ETH_GAS_LIMIT_MAX`, with `1,000,000,000` default). Chainlink nodes decide what gas price to use using an `Estimator`. It ships with several simple and battle-hardened built-in estimators that should work well for almost all use-cases. Note that estimators will change their behaviour slightly depending on if you are in EIP-1559 mode or not. From da022fabffc08db9be38b11714bb47f3a04d1089 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Mon, 30 Oct 2023 14:01:03 -0400 Subject: [PATCH 07/15] L2Suggested backwards compatibility --- core/chains/evm/gas/models.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/chains/evm/gas/models.go b/core/chains/evm/gas/models.go index c4255834791..bc0917e250a 100644 --- a/core/chains/evm/gas/models.go +++ b/core/chains/evm/gas/models.go @@ -79,7 +79,7 @@ func NewEstimator(lggr logger.Logger, ethClient evmclient.Client, cfg Config, ge return NewWrappedEvmEstimator(NewBlockHistoryEstimator(lggr, ethClient, cfg, geCfg, bh, *ethClient.ConfiguredChainID()), df, l1Oracle) case "FixedPrice": return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df, l1Oracle) - case "Optimism2", "SuggestedPrice": + case "Optimism2", "L2Suggested", "SuggestedPrice": return NewWrappedEvmEstimator(NewSuggestedPriceEstimator(lggr, ethClient), df, l1Oracle) default: lggr.Warnf("GasEstimator: unrecognised mode '%s', falling back to FixedPriceEstimator", s) From c61edab16c5b2ef2a01994cfe5b7d390496e6603 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Mon, 30 Oct 2023 14:12:27 -0400 Subject: [PATCH 08/15] L2Suggested backwards compatibility --- core/chains/evm/gas/models.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/chains/evm/gas/models.go b/core/chains/evm/gas/models.go index c4255834791..bc0917e250a 100644 --- a/core/chains/evm/gas/models.go +++ b/core/chains/evm/gas/models.go @@ -79,7 +79,7 @@ func NewEstimator(lggr logger.Logger, ethClient evmclient.Client, cfg Config, ge return NewWrappedEvmEstimator(NewBlockHistoryEstimator(lggr, ethClient, cfg, geCfg, bh, *ethClient.ConfiguredChainID()), df, l1Oracle) case "FixedPrice": return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df, l1Oracle) - case "Optimism2", "SuggestedPrice": + case "Optimism2", "L2Suggested", "SuggestedPrice": return NewWrappedEvmEstimator(NewSuggestedPriceEstimator(lggr, ethClient), df, l1Oracle) default: lggr.Warnf("GasEstimator: unrecognised mode '%s', falling back to FixedPriceEstimator", s) From 6519809b80eb3cd393187683c3a4a0400b7c4801 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Mon, 30 Oct 2023 15:17:52 -0400 Subject: [PATCH 09/15] Update CHANGELOG --- core/chains/evm/gas/models.go | 2 +- docs/CHANGELOG.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/chains/evm/gas/models.go b/core/chains/evm/gas/models.go index 3d34c436bee..299d7d54734 100644 --- a/core/chains/evm/gas/models.go +++ b/core/chains/evm/gas/models.go @@ -78,7 +78,7 @@ func NewEstimator(lggr logger.Logger, ethClient evmclient.Client, cfg Config, ge return NewWrappedEvmEstimator(NewBlockHistoryEstimator(lggr, ethClient, cfg, geCfg, bh, *ethClient.ConfiguredChainID()), df, l1Oracle) case "FixedPrice": return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df, l1Oracle) - case "Optimism2", "L2Suggested", "SuggestedPrice": + case "L2Suggested", "SuggestedPrice": return NewWrappedEvmEstimator(NewSuggestedPriceEstimator(lggr, ethClient), df, l1Oracle) default: lggr.Warnf("GasEstimator: unrecognised mode '%s', falling back to FixedPriceEstimator", s) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index daeddf2ce66..091693bf464 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -33,6 +33,7 @@ These will eventually replace `TelemetryIngress.URL` and `TelemetryIngress.Serve - `P2P.V1` is now disabled (`Enabled = false`) by default. It must be explicitly enabled with `true` to be used. However, it is deprecated and will be removed in the future. - `P2P.V2` is now enabled (`Enabled = true`) by default. +- `L2Suggested` mode is now called `SuggestedPrice` ### Upcoming Required Configuration Changes Starting in `v2.9.0`: @@ -42,6 +43,7 @@ Starting in `v2.9.0`: ### Removed - Removed the ability to set a next nonce value for an address through CLI +- Removed `Optimism2` as a supported gas estimator mode From ec3d0aeae10d017e072609f81e4462da1f6ff865 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Tue, 31 Oct 2023 10:06:14 -0400 Subject: [PATCH 10/15] Update comments --- core/chains/evm/gas/suggested_price_estimator.go | 10 +++++----- core/chains/evm/gas/suggested_price_estimator_test.go | 2 +- docs/CHANGELOG.md | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/chains/evm/gas/suggested_price_estimator.go b/core/chains/evm/gas/suggested_price_estimator.go index a0a9eda8b8b..e03ee7ac36d 100644 --- a/core/chains/evm/gas/suggested_price_estimator.go +++ b/core/chains/evm/gas/suggested_price_estimator.go @@ -2,6 +2,7 @@ package gas import ( "context" + "github.com/smartcontractkit/chainlink-relay/pkg/services" "slices" "sync" "time" @@ -26,9 +27,9 @@ type rpcClient interface { CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error } -// SuggestedPriceEstimator is an Estimator which uses the L2 suggested gas price from eth_gasPrice. +// SuggestedPriceEstimator is an Estimator which uses the suggested gas price from eth_gasPrice. type SuggestedPriceEstimator struct { - utils.StartStopOnce + services.StateMachine client rpcClient pollPeriod time.Duration @@ -43,8 +44,7 @@ type SuggestedPriceEstimator struct { chDone chan struct{} } -// NewSuggestedPriceEstimator returns a new Estimator which uses the L2 suggested gas price. -// Can also be used for non-L2 chains. +// NewSuggestedPriceEstimator returns a new Estimator which uses the suggested gas price. func NewSuggestedPriceEstimator(lggr logger.Logger, client rpcClient) EvmEstimator { return &SuggestedPriceEstimator{ client: client, @@ -177,7 +177,7 @@ func (o *SuggestedPriceEstimator) GetLegacyGas(ctx context.Context, _ []byte, Ga } func (o *SuggestedPriceEstimator) BumpLegacyGas(_ context.Context, _ *assets.Wei, _ uint32, _ *assets.Wei, _ []EvmPriorAttempt) (bumpedGasPrice *assets.Wei, chainSpecificGasLimit uint32, err error) { - return nil, 0, errors.New("bump gas is not supported for this l2") + return nil, 0, errors.New("bump gas is not supported for this chain") } func (o *SuggestedPriceEstimator) getGasPrice() (GasPrice *assets.Wei) { diff --git a/core/chains/evm/gas/suggested_price_estimator_test.go b/core/chains/evm/gas/suggested_price_estimator_test.go index c0dc4550cfb..808b28a3a6b 100644 --- a/core/chains/evm/gas/suggested_price_estimator_test.go +++ b/core/chains/evm/gas/suggested_price_estimator_test.go @@ -87,7 +87,7 @@ func TestSuggestedPriceEstimator(t *testing.T) { client := mocks.NewRPCClient(t) o := gas.NewSuggestedPriceEstimator(logger.TestLogger(t), client) _, _, err := o.BumpLegacyGas(testutils.Context(t), assets.NewWeiI(42), gasLimit, assets.NewWeiI(10), nil) - assert.EqualError(t, err, "bump gas is not supported for this l2") + assert.EqualError(t, err, "bump gas is not supported for this chain") }) t.Run("calling GetLegacyGas on started estimator if initial call failed returns error", func(t *testing.T) { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 091693bf464..75efc8da26d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [dev] +- `L2Suggested` mode is now called `SuggestedPrice` +- Removed `Optimism2` as a supported gas estimator mode ... @@ -33,7 +35,6 @@ These will eventually replace `TelemetryIngress.URL` and `TelemetryIngress.Serve - `P2P.V1` is now disabled (`Enabled = false`) by default. It must be explicitly enabled with `true` to be used. However, it is deprecated and will be removed in the future. - `P2P.V2` is now enabled (`Enabled = true`) by default. -- `L2Suggested` mode is now called `SuggestedPrice` ### Upcoming Required Configuration Changes Starting in `v2.9.0`: @@ -43,7 +44,6 @@ Starting in `v2.9.0`: ### Removed - Removed the ability to set a next nonce value for an address through CLI -- Removed `Optimism2` as a supported gas estimator mode From 04fd448941f5b52413bb9164849a1920435905fd Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Tue, 31 Oct 2023 11:46:30 -0400 Subject: [PATCH 11/15] Update docs/CHANGELOG.md Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com> --- docs/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 75efc8da26d..8f3b16c1327 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,7 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [dev] + +### Changed + - `L2Suggested` mode is now called `SuggestedPrice` + +### Removed + - Removed `Optimism2` as a supported gas estimator mode ... From 0a4cfb876431c249f23c72a94ada192ac6272f7e Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Tue, 31 Oct 2023 12:43:28 -0400 Subject: [PATCH 12/15] Fix error message --- core/chains/evm/gas/arbitrum_estimator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/chains/evm/gas/arbitrum_estimator_test.go b/core/chains/evm/gas/arbitrum_estimator_test.go index 9ccb1f5161d..a226368edf2 100644 --- a/core/chains/evm/gas/arbitrum_estimator_test.go +++ b/core/chains/evm/gas/arbitrum_estimator_test.go @@ -131,7 +131,7 @@ func TestArbitrumEstimator(t *testing.T) { ethClient := mocks.NewETHClient(t) o := gas.NewArbitrumEstimator(logger.TestLogger(t), &arbConfig{}, rpcClient, ethClient) _, _, err := o.BumpLegacyGas(testutils.Context(t), assets.NewWeiI(42), gasLimit, assets.NewWeiI(10), nil) - assert.EqualError(t, err, "bump gas is not supported for this l2") + assert.EqualError(t, err, "bump gas is not supported for this chain") }) t.Run("calling GetLegacyGas on started estimator if initial call failed returns error", func(t *testing.T) { From 0144a769aa5ed5be866043293dc247bdae9f67f2 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Tue, 31 Oct 2023 13:11:01 -0400 Subject: [PATCH 13/15] Move import --- core/chains/evm/gas/suggested_price_estimator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/chains/evm/gas/suggested_price_estimator.go b/core/chains/evm/gas/suggested_price_estimator.go index e03ee7ac36d..a4ffb80997e 100644 --- a/core/chains/evm/gas/suggested_price_estimator.go +++ b/core/chains/evm/gas/suggested_price_estimator.go @@ -2,7 +2,6 @@ package gas import ( "context" - "github.com/smartcontractkit/chainlink-relay/pkg/services" "slices" "sync" "time" @@ -10,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink-relay/pkg/services" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" "github.com/smartcontractkit/chainlink/v2/core/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" From dd30b440cae601d3e728cd8f44cb84b351e3687a Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Tue, 31 Oct 2023 16:38:35 -0400 Subject: [PATCH 14/15] deprecate L2Suggested --- core/config/docs/chains-evm.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/core/config/docs/chains-evm.toml b/core/config/docs/chains-evm.toml index 5d1a9f02689..0e0d0d0bd81 100644 --- a/core/config/docs/chains-evm.toml +++ b/core/config/docs/chains-evm.toml @@ -112,6 +112,7 @@ Enabled = true # Default # # - `FixedPrice` uses static configured values for gas price (can be set via API call). # - `BlockHistory` dynamically adjusts default gas price based on heuristics from mined blocks. +# - `L2Suggested` mode is deprecated and replaced with `SuggestedPrice`. # - `SuggestedPrice` is a mode which uses the gas price suggested by the rpc endpoint via `eth_gasPrice`. # - `Arbitrum` is a special mode only for use with Arbitrum blockchains. It uses the suggested gas price (up to `ETH_MAX_GAS_PRICE_WEI`, with `1000 gwei` default) as well as an estimated gas limit (up to `ETH_GAS_LIMIT_MAX`, with `1,000,000,000` default). # From c40ac85333e3cf34309a396c036bc558eef4486c Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Wed, 1 Nov 2023 10:48:14 -0400 Subject: [PATCH 15/15] Update CONFIG.md --- docs/CONFIG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 130575d4ded..313e7b46aaf 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -5004,6 +5004,7 @@ Mode controls what type of gas estimator is used. - `FixedPrice` uses static configured values for gas price (can be set via API call). - `BlockHistory` dynamically adjusts default gas price based on heuristics from mined blocks. +- `L2Suggested` mode is deprecated and replaced with `SuggestedPrice`. - `SuggestedPrice` is a mode which uses the gas price suggested by the rpc endpoint via `eth_gasPrice`. - `Arbitrum` is a special mode only for use with Arbitrum blockchains. It uses the suggested gas price (up to `ETH_MAX_GAS_PRICE_WEI`, with `1000 gwei` default) as well as an estimated gas limit (up to `ETH_GAS_LIMIT_MAX`, with `1,000,000,000` default).