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

Holocene: eip-1559 parameters in extraData #428

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

roberto-bayardo
Copy link
Contributor

@roberto-bayardo roberto-bayardo commented Oct 12, 2024

Description

EIP-1559 parameters need to be in the ExecutionPayload, not just the PayloadAttributes, to allow geth to properly include the encoded parameters in the block header. So instead of using nonce, we use the extraData field which is already in the ExecutionPayload. This will also reserve nonce to be used for sub-second block times.

@roberto-bayardo roberto-bayardo changed the title Holocene: eip-1559 parameters in ExecutionPayload Holocene: eip-1559 parameters in extraData Oct 15, 2024
@roberto-bayardo
Copy link
Contributor Author

As discussed in discord, updated spec to use extraData instead of nonce.

@roberto-bayardo roberto-bayardo force-pushed the holocene-execution-payload branch 3 times, most recently from 8fd9747 to edd510b Compare October 15, 2024 23:46
Comment on lines +75 to +78
- if `parent_header.extraData` is empty, the [canyon base fee parameter constants](../exec-engine.md#1559-parameters)
are used for the block's base fee parameters.
- if `parent_header.extraData` is non-empty with the version byte (first byte) value 0, the remaining 64
bytes are used for the block's eip-1559 parameters.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- if `parent_header.extraData` is empty, the [canyon base fee parameter constants](../exec-engine.md#1559-parameters)
are used for the block's base fee parameters.
- if `parent_header.extraData` is non-empty with the version byte (first byte) value 0, the remaining 64
bytes are used for the block's eip-1559 parameters.
- if Holocene is not active in `parent_header.timestamp`, then `parent_header.extraData` may be set to anything valid in pre-Holocene context. The [canyon base fee parameter constants](../exec-engine.md#1559-parameters), or prior EIP-1559 constants are used for the block's base fee parameters.
- While not set in regular pre-Holocene blocks, the `extraData` was set in the genesis block of some pre-Holocene chains, and other blocks with pre-Bedrock legacy content. It is thus important to check the hardfork before parsing the `extraData`.
- if Holocene is active in `parent_header.timestamp`, then `parent_header.extraData` is non-empty, with the following encoding:
- the first byte is set to `0`, used as version byte for the content.
- the next 8 bytes are used to encode the 1559 params following the [`eip1559Params`
encoding](#eip1559params-encoding).
- the `extraData` ends there, at 9 bytes length. The `extraData` has a maximum capacity of 32 bytes (to fit in the L1 beacon-chain `extraData` data-type), and may be modified/extended in future versions.

A hardfork should also not retro-actively apply constraints on prior blocks, like the parent-block.
The spec needs to call out that the transition block does not read the 1559 params from the more arbitrary pre-holocene block.
The previous spec rule would create weird behavior for the block right after genesis, if Holocene wasn't active then yet.

| `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit |
| `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain |
| `EIP_1559_PARAMS` | `uint8(4)` | `(uint256(_denominator) << 32) \| _elasticity` | Modifies the EIP-1559 denominator and elasticity |
| `EIP_1559_PARAMS` | `uint8(4)` | `abi.encode((uint256(_denominator) << 32) \| _elasticity)` | Modifies the EIP-1559 denominator and elasticity |
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be worth clarifying that this is the format emitted by the SystemConfig. Not the same as the format in the block-header extraData.

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