-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 EIP-7642: add earliestBlock and update receipts encoding #9237
Open
fjl
wants to merge
9
commits into
ethereum:master
Choose a base branch
from
fjl:eip-7642-history-window
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+60
−33
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ed70ee1
EIP-7642: add earliestBlock and update receipts encoding
fjl e7462cb
EIP-7642: update title
fjl 8a4b8e2
EIP-7642: update link
fjl 70d7c25
EIP-7642: add rationale for earliestBlock
fjl b9ab351
EIP-7642: update deadline
fjl 4dd19d5
EIP-7642: add rationale for receipt encoding
fjl 75925a8
EIP-7642: rephrase
fjl 6ca875f
EIP-7642: remove 'technically'
fjl fe08623
EIP-7642: fixup encoding
fjl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
eip: 7642 | ||
title: eth/69 - Drop pre-merge fields | ||
description: Drop unnecessary fields after the merge | ||
title: eth/69 - history expiry and simpler receipts | ||
description: Adds history serving window and removes bloom filter in receipt | ||
author: Marius van der Wijden (@MariusVanDerWijden), Felix Lange <[email protected]> | ||
discussions-to: https://ethereum-magicians.org/t/eth-70-drop-pre-merge-fields-from-eth-protocol/19005 | ||
status: Stagnant | ||
|
@@ -13,35 +13,46 @@ requires: 5793 | |
|
||
## Abstract | ||
|
||
After the merge the `td` field in the networking protocol became obsolete. | ||
This EIP modifies the networking messages such that this field is not sent anymore. | ||
Additionally we propose to remove the `Bloom` field from the receipts networking messages. | ||
This EIP modifies the 'eth' p2p protocol to announce the historical block range served by | ||
the node. We also simplify the handshake to remove total difficulty information, which | ||
isn't used anymore after the merge. Additionally we propose to remove the `Bloom` field | ||
from receipts transfered over the protocol. | ||
|
||
## Motivation | ||
|
||
We recently discovered that none of the clients store the `Bloom` field of the receipts as it can be recomputed on demand. | ||
However the networking spec requires the `Bloom` field to be sent over the network. | ||
Thus a syncing node will ask for the Bloom filters for all receipts. | ||
The serving node will regenerate roughly 530GB of bloom filters (2.3B txs * 256 byte). | ||
These 530GBs are send over the network to the syncing peer, the syncing peer will verify them and not store them either. | ||
This adds an additional 530GB of unnecessary bandwidth to every sync. | ||
### Removing Bloom in Receipts | ||
|
||
Additionally we propose to remove the field that was deprecated by the merge, namely | ||
the `TD` field in the `Status` message. | ||
We recently discovered that none of the clients store the `Bloom` field of the receipts as | ||
it can be recomputed on demand. However the networking spec requires the `Bloom` field to | ||
be sent over the network. Thus a syncing node will ask for the Bloom filters for all | ||
receipts. The serving node will regenerate roughly 530GB of bloom filters (2.3B txs * 256 | ||
byte). These 530GBs are send over the network to the syncing peer, the syncing peer will | ||
verify them and not store them either. This adds an additional 530GB of unnecessary | ||
bandwidth to every sync. | ||
|
||
### earliestBlock in Status message | ||
|
||
In the history expiry working group, it was decided that clients may drop pre-merge | ||
history from their storage after May 1, 2025. For clients that want to sync history | ||
through the 'eth' protocol, it is essential to know whether a peer still serves old | ||
history. A similar idea was proposed in [EIP-7542](./eip-7542.md) but was later withdrawn | ||
because a political decision on history expiry had not been reached at the time. | ||
|
||
## Specification | ||
|
||
Modify the `Status (0x00)` message as follows: | ||
|
||
- (eth/68): `[version: P, networkid: P, td: P, blockhash: B_32, genesis: B_32, forkid]` | ||
|
||
- (eth/69): `[version: P, networkid: P, blockhash: B_32, genesis: B_32, forkid]` | ||
- (eth/69): `[version: P, networkid: P, blockhash: B_32, genesis: B_32, forkid, earliestBlock: P]` | ||
|
||
Modify the encoding for receipts in the `Receipts (0x10)` message as follows: | ||
|
||
- (eth/68): `receipt = {legacy-receipt, typed-receipt}` with `typed-receipt = tx-type || receipt-data` and | ||
- (eth/68): `receipt = {legacy-receipt, typed-receipt}` with | ||
|
||
``` | ||
typed-receipt = tx-type || rlp(legacy-receipt) | ||
|
||
legacy-receipt = [ | ||
post-state-or-status: {B_32, {0, 1}}, | ||
cumulative-gas: P, | ||
|
@@ -50,32 +61,48 @@ legacy-receipt = [ | |
] | ||
``` | ||
|
||
- (eth/69): `receipt = {legacy-receipt, typed-receipt}` with `typed-receipt = tx-type || receipt-data` and | ||
- (eth/69): `receipt = [tx-type, post-state-or-status, cumulative-gas, logs]` | ||
|
||
``` | ||
legacy-receipt = [ | ||
post-state-or-status: {B_32, {0, 1}}, | ||
cumulative-gas: P, | ||
logs: [log₁, log₂, ...] | ||
] | ||
``` | ||
## Rationale | ||
|
||
We omit the bloom filter from both the legacy and typed receipts. | ||
Receiving nodes will be able to recompute the bloom filter based on the logs. | ||
### Status changes | ||
|
||
## Rationale | ||
After the merge, the `TD` field of the `Status` message became meaningless since the | ||
difficulty of post-merge blocks are 0. It could in theory be used to distinguish synced | ||
with unsynced nodes, but the same thing can be accomplished with the forkid as well. | ||
|
||
The new `earliestBlock` field is technically not required for history expiry, but there | ||
are a couple reasons why adding it can help: | ||
|
||
- It improves peer finding for clients that still want to sync history from p2p after the | ||
agreed-upon removal of pre merge history has taken place. Without `earliestBlock`, the | ||
client would have to perform a request for history to check if the earlier range exists, | ||
and assume that a failed request means it's not there. | ||
- The new field can be used for census in a specialized crawler. We will be able to see | ||
how many users/nodes enable history, and in which implementation. | ||
- It prepares us for a future where the history expiry window is dynamic. | ||
|
||
### Receipts changes | ||
|
||
After the merge, the `TD` field of the `Status` message became meaningless since the difficulty of post-merge blocks are 0. | ||
It could in theory be used to distinguish synced with unsynced nodes, | ||
but the same thing can be accomplished with the forkid as well. | ||
It is not used in the go-ethereum codebase in any way. | ||
Removing the bloom filters from the `Receipt` message reduces the CPU load of serving | ||
nodes as well as the bandwidth significantly. The receiving nodes will need to recompute | ||
the bloom filter in order to fully verify the receipt hash. The recomputation is not very | ||
CPU intensive. The bandwidth gains amount to roughly 530GiB per syncing node or (at least) | ||
95GiB snappy compressed. | ||
|
||
Removing the bloom filters from the `Receipt` message reduces the cpu load of serving nodes as well as the bandwidth significantly. The receiving nodes will need to recompute the bloom filter. The recomputation is not very CPU intensive. | ||
The bandwidth gains amount to roughly 530GiB per syncing node or (at least) 95GiB snappy compressed. | ||
In Ethereum consensus, the encoding of receipts differs between legacy transactions and | ||
typed transactions. Typed transaction receipts are 'opaque' and have the data wrapped in a | ||
byte array. However, all receipt types ultimately contain the same four fields. With the | ||
removal of the bloom filter, the networking protocol now deviates from the encoding used | ||
by consensus, and there is no need to replicate the weird and expensive encoding used | ||
there. The proposed receipt encoding is just a flat list of the required data fields. | ||
|
||
## Backwards Compatibility | ||
|
||
This EIP changes the eth protocol and requires rolling out a new version, `eth/69`. Supporting multiple versions of a wire protocol is possible. Rolling out a new version does not break older clients immediately, since they can keep using protocol version `eth/68`. | ||
This EIP changes the eth protocol and requires rolling out a new version, `eth/69`. | ||
Supporting multiple versions of a wire protocol is possible. Rolling out a new version | ||
does not break older clients immediately, since they can keep using protocol version | ||
`eth/68`. | ||
|
||
This EIP does not change consensus rules of the EVM and does not require a hard fork. | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this allows you to merge changes to the eip via the bot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I know but I want to discuss a bit before merging.