From 898b5f5c237c39d6733ac08b692f2d6feff4188c Mon Sep 17 00:00:00 2001 From: jlwllmr <95916148+jlwllmr@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:45:44 +0100 Subject: [PATCH 1/3] Initial draft, WIP --- .../reference/api/linea-estimategas.mdx | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/docs/developers/reference/api/linea-estimategas.mdx b/docs/developers/reference/api/linea-estimategas.mdx index 0887def84..05fe48e7c 100644 --- a/docs/developers/reference/api/linea-estimategas.mdx +++ b/docs/developers/reference/api/linea-estimategas.mdx @@ -9,24 +9,14 @@ import TabItem from '@theme/TabItem'; # `linea_estimateGas` -:::warning +:::info Compatibility mode -`linea_estimateGas` is currently unavailable, but we will provide activation dates soon. In the -meantime, please get in touch via the [Linea Discord](https://discord.gg/linea) if you intend to -use `linea_estimateGas` once it is available. +`linea_estimateGas` is currently only available on Mainnet in compatibility mode, which means it +returns the same results as `eth_gasPrice`. -::: - -:::info - -`linea_estimateGas` is only fully compatible with endpoints using the Besu client with the -[`linea-sequencer`](https://github.com/Consensys/linea-sequencer/tree/main) plugin enabled. If it -is unavailable, try updating Besu. If you prefer to use Geth, `linea_estimateGas` is only available -if you redirect your request through an Infura endpoint. - -We recommend using `linea_estimateGas` rather than alternatives, such as `eth_gasPrice`. -`linea_estimateGas` returns estimates with greater accuracy, minimizing the risk of transactions -being priced incorrectly and failing as a result. +`linea_estimateGas` will be fully activated on September 30. Infrastructure providers must adjust +their node configurations to ensure compatibility mode is deactivated and `linea_estimateGas` +functions fully. See our [guide](#compatibility-mode). ::: @@ -146,3 +136,39 @@ decimals to get the wei value. You can use any hexadecimal to decimal converter [RapidTables](https://www.rapidtables.com/convert/number/hex-to-decimal.html). ::: + +## Compatibility mode + +When `linea_estimateGas` is activated on Mainnet on September 30, infrastructure providers and those +using their own nodes to submit transactions must adjust their configuration files to disable +compatibility mode. + +### Effects + +`linea_estimateGas` in compatibility mode returns the same gas price as `eth_gasPrice`. This means +gas price is applied consistently regardless of the relative complexity of the transaction +(measured through its `calldata` size). As a result, transactions can be underpriced and risk +getting stuck, or be overpriced and result in the user overpaying in fees. + +This can be described with the following formula: +``` +fee = gasPrice * gasUsed +``` + +### Benefits of disabling + +With compatibility mode disabled, `linea_estimateGas` is able to function as designed and return a +more accurate gas price, better suited to the transaction. The gas price scales with the amount of +`calldata` a transaction contains. As a result, Linea can more effectively ensure the gas price +reflects L1 costs and prover costs, which rise with transaction complexity/`calldata` size. + +The formula with `linea_estimateGas` enabled is: +``` +fee = (calldataUsed * multiplier + constant) * gasUsed +``` + +Where the `multiplier` is applied to ensure network profitability, and the `constant` is a +reflection of several other aspects factored into the calculation. + +### How to disable + From be64529bcbafc16aaa4d04da792b0f7ca100e5ea Mon Sep 17 00:00:00 2001 From: jlwllmr <95916148+jlwllmr@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:42:52 +0100 Subject: [PATCH 2/3] Add instructions to disable --- .../reference/api/linea-estimategas.mdx | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/developers/reference/api/linea-estimategas.mdx b/docs/developers/reference/api/linea-estimategas.mdx index 05fe48e7c..bdec82e0a 100644 --- a/docs/developers/reference/api/linea-estimategas.mdx +++ b/docs/developers/reference/api/linea-estimategas.mdx @@ -172,3 +172,31 @@ reflection of several other aspects factored into the calculation. ### How to disable +For most people running an `advanced` Linea Besu node—a prerequisite for using `linea_estimateGas`— +compatibility mode will already be disabled in the files you downloaded from the [`linea-besu-package` +repository](https://github.com/Consensys/linea-besu-package/tree/main). + +:::note + +See our run a node guides for information on running a Linea Besu node [with Docker](../../guides/run-a-node/use-docker.mdx#run-a-linea-besu-node) +and [using the binary distribution](../../guides/run-a-node/use-binary.mdx#run-a-linea-besu-node). + +::: + +### Binary distribution + +To ensure compatibility is not running, check your `.toml` configuration file for the following +setting, and ensure it is `false`: +``` +plugin-linea-estimate-gas-compatibility-mode-enabled=false +``` + +This configuration may be `true` if you downloaded the files before September 30. + +### Docker + +The Docker image accessed via the `compose` files in the [`linea-besu-package` repository](https://github.com/Consensys/linea-besu-package/tree/main) +will be updated via image update to ensure compatibility mode is disabled after September 30. + +You do not need to take any action regarding compatibility mode if you are using Docker to run an +`advanced` Linea Besu node. From 63c1ae81137445ca9e9a56ca876b5b2db0707f1e Mon Sep 17 00:00:00 2001 From: jlwllmr <95916148+jlwllmr@users.noreply.github.com> Date: Fri, 20 Sep 2024 11:18:30 +0100 Subject: [PATCH 3/3] Add Sepolia details --- docs/developers/reference/api/linea-estimategas.mdx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/developers/reference/api/linea-estimategas.mdx b/docs/developers/reference/api/linea-estimategas.mdx index bdec82e0a..0bd356043 100644 --- a/docs/developers/reference/api/linea-estimategas.mdx +++ b/docs/developers/reference/api/linea-estimategas.mdx @@ -12,10 +12,10 @@ import TabItem from '@theme/TabItem'; :::info Compatibility mode `linea_estimateGas` is currently only available on Mainnet in compatibility mode, which means it -returns the same results as `eth_gasPrice`. +returns the same results as `eth_gasPrice`. -`linea_estimateGas` will be fully activated on September 30. Infrastructure providers must adjust -their node configurations to ensure compatibility mode is deactivated and `linea_estimateGas` +`linea_estimateGas` will be fully activated on Mainnet on September 30. Infrastructure providers +must adjust their node configurations to ensure compatibility mode is deactivated and `linea_estimateGas` functions fully. See our [guide](#compatibility-mode). ::: @@ -143,6 +143,10 @@ When `linea_estimateGas` is activated on Mainnet on September 30, infrastructure using their own nodes to submit transactions must adjust their configuration files to disable compatibility mode. +No action is required for Linea Sepolia nodes using the `advanced-testnet` profile from the +[`linea-besu-package` repository](https://github.com/Consensys/linea-besu-package/tree/main), since +`linea_estimateGas` is already activated on Linea Sepolia. + ### Effects `linea_estimateGas` in compatibility mode returns the same gas price as `eth_gasPrice`. This means