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

Update linea_estimateGas reference with compatibility mode details #747

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
90 changes: 74 additions & 16 deletions docs/developers/reference/api/linea-estimategas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds like it's unavailable on Sepolia, but it is

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 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).

:::

Expand Down Expand Up @@ -146,3 +136,71 @@ 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.

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
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
Copy link
Contributor

Choose a reason for hiding this comment

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

That's inaccurate

  • multiplier - Linea's cost per byte on L1 in current market conditions
  • There's another multiplier (overheadMultiplier aka margin) * (calldataUsedInBytes * multiplier + constant) * gasUsed. This margin is to ensure that in case of a sudden change of market conditions (gas price increase) transaction is still accepted

I know that public knowledge shouldn't be exactly the same as internal, but please take it into consideration

```

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

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).
Copy link
Contributor

Choose a reason for hiding this comment

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


:::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.
Loading