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

Explain gas pricing mechanism #769

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Explain gas pricing mechanism #769

wants to merge 5 commits into from

Conversation

jlwllmr
Copy link
Collaborator

@jlwllmr jlwllmr commented Oct 8, 2024

Adds detail to the gas estimation guide that explains how the prices returned by linea_estimateGas are calculated, and touches on how this relates to transaction sequencing.

Also amends callout in linea_estimateGas reference page to reflect its activation.

Copy link

vercel bot commented Oct 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
doc-zk-evm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 9:21am

Copy link
Collaborator

@bgravenorst bgravenorst left a comment

Choose a reason for hiding this comment

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

Left some feedback. Would prefer another review before merging.

- [`eth_gasPrice`](https://docs.infura.io/api/networks/linea/json-rpc-methods/eth_gasprice)
- [`eth_feeHistory`](https://docs.infura.io/api/networks/linea/json-rpc-methods/eth_feehistory).

## Gas pricing
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question. This content reads like we're populating the Ethereum networks extraData block field? Is this correct? Or is the extraData block field for Linea being populated.

Comment on lines +46 to +56
The gas price you retrieve using methods such as `linea_estimateGas` is based on the variable data
cost of the previous block with a profitability multiplier applied.

The first stage of returning gas price values with `linea_estimateGas` is to populate values in an
object called `extraData`. The two most relevant values here are:
- A `FIXED_COST` of 0.03 Gwei, which reflects infrastructure costs, and;
- `VARIABLE_COST`, which is the cost per byte of data submitted to L1.

These values are inserted into each block's `extraData` field—32 bytes available in every Ethereum
block to store any data—and then used by the sequencer and Linea Besu nodes running the correct
plugins to expose `linea_estimateGas`, in both cases with the same logic.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Recommend (assuming we're writing to Linea's extraData):

The gas price returned by linea_estimateGas is based on the
variable data cost of the previous block with a profitability multiplier applied.

Each Linea block's extraData field is populated with the following gas price values that are used by linea_estimateGas to calculate the cost of a transaction:

  • A FIXED_COST of 0.03 Gwei, which reflects infrastructure costs, and;
  • VARIABLE_COST, which is the cost per byte of data submitted to L1.

:::note
The extraData field is a 32-byte space used to store arbitrary data, such as metadata or
additional information relevant to the block.

With Linea it is used by the sequencer and Linea Besu nodes running the correct plugins
to expose linea_estimateGas
:::

Comment on lines +102 to +105
The `linea_estimateGas` formula above essentially ensures that transactions are checked for
profitability for inclusion in a block. However, the nonce order of transactions submitted from the
same account takes precedence, so there may be occasions where less profitable transactions must be
included first.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The `linea_estimateGas` formula above essentially ensures that transactions are checked for
profitability for inclusion in a block. However, the nonce order of transactions submitted from the
same account takes precedence, so there may be occasions where less profitable transactions must be
included first.
The `linea_estimateGas` formula above ensures that transactions are checked for
profitability for inclusion in a block. However, the nonce order of transactions submitted from the
same account takes precedence, so there may be occasions where less profitable transactions must be
included first.

- At transaction selection stage: `1.0`

:::note
The RPC method and transaction pool values are configurable by node runners according to preference;
Copy link
Collaborator

Choose a reason for hiding this comment

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

node runners? Are we referring to RPC providers here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants