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 EIP-4844: Remove system contract concept #5353

Merged
merged 7 commits into from
Sep 8, 2022

Conversation

lightclient
Copy link
Member

@lightclient lightclient commented Jul 27, 2022

This PR removes the "system contract" concept from EIP-4844. Although the approach has several pros, it tends to be a sticking point in the discussions around EIP-4844 due to the fact that we don't currently have the concept of a system contract with storage and that concept would need to be implemented into clients - whereas the header extension approach has already been performed to add baseFee to the header in EIP-1559.

Additionally, it resolves an issue in the original draft that conflated blobs and blob txs.

Will leave in draft until some consensus among authors is reached.

@eth-bot
Copy link
Collaborator

eth-bot commented Jul 27, 2022

All tests passed; auto-merging...

(pass) eip-4844.md

classification
updateEIP
  • passed!

@github-actions
Copy link

The commit 3c5e72b (as a parent of 85fc2d3) contains errors. Please inspect the Run Summary for details.

Copy link
Contributor

@protolambda protolambda left a comment

Choose a reason for hiding this comment

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

I was expecting that we'd add a blob_basefee field, not a total blob_txs counter. Since the counter does not capture the fee-adjustment result of previous history, only the total number of blobs.

In EIP-1559 we weigh recent history higher than older history, but now it's basically averaging the usage all-time, which is not the same as the exponential adjustment we have in EIP-1559; adjustments will be smaller and smaller the longer the fork is active.

And the ExecutionPayloadHeader and ExecutionPayload type in the CL spec will need to match the EL definition of the block.

@protolambda
Copy link
Contributor

After re-reading the EIP, and the Blob gasprice update rule text, I do think your implementation is correct, but I think the thing in question for me is this part of the EIP:

Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed.

EIP-1559 responds based on the distribution of blobs throughout history, whereas the current EIP draft handles excess blobs over all time, making excess blobs have long-term effects on the price.

With these effects, we get two unfortunate side-effects:

  • Excess blobs (i.e. over target) that were included long ago, and already pruned, will cause the blob price to be higher even if all blocks within the non-pruned period perfectly match the target.
  • Few bursts vs many small excesses: stable bandwidth usage and processing cost may be preferable, yet the total cost is lower if you distribute them in bursts.
    • Example:
      • For 8 blocks, if you have 1 excess each time: 2**(1/64)+2**(2/64)+2**(3/64)+2**(4/64)+2**(5/64)+2**(6/64)+2**(7/64)+2**(8/64) = ~ 8.40 total cost (note how the excess keeps growing)
      • For 8 blocks, if you have no excess, and then 8 all at once: 2**(8/64) = ~ 1.09 (or ~ 8.09 if the no-excess blocks charge 1 each, unlike the EIP code which makes those free...)
    • Maybe we embrace it, since batching is good for CPU performance? Would unstable bandwidth hurt the network more than less efficient batch processing?

Also, the EIP describes "blob_gas of block N+1 increases by a factor of 2**((X - TARGET_BLOB_TXS_PER_BLOCK) / GASPRICE_UPDATE_FRACTION_PER_BLOB)." but there's no increase, the code uses this directly as gas price per blob (and it can even be zero).

EIPS/eip-4844.md Outdated Show resolved Hide resolved
@vbuterin
Copy link
Contributor

With these effects, we get two unfortunate side-effects:

I think that if we had gone with an EIP 1559 based on excess (so what this EIP does) from the start, no one would seriously consider adding a weird rule where you penalize excess more if it's spread out across blocks than if it's concentrated in a single block (which is what status quo EIP 1559 gives us in practice). The complexity is just not worth it, and the value of having a clean simple invariant of what total usage is targeted is really high.

More concretely, the value that the clean invariant of the excess-based rule gives us includes:

  • We would not have to worry about bad proposers manipulating the basefee by strategically delaying transactions, because we know that strategically delaying transactions never affects the basefee
  • A cleaner upper bound on how much storage clients need for blobs (target_per_block * (storage_duration / slot_duration + GASPRICE_UPDATE_FRACTION_PER_BLOB * 50), instead of needing 3% extra just in case you get a worst-case distribution
  • A 51% attack on the basefee mechanism would actually require the attacker to have 50.01% of proposer slots, instead of ~46.9% with an EIP-1559-style rule

@protolambda
Copy link
Contributor

In favor of less complexity, let's go ahead with this PR. Pruning/batching incentives are interesting to me, but don't have to block this PR, and may just make it worse.

The change from total_blob_txs to excess_blob_txs like Vitalik proposed would be nice though; it's less complex and we may not have to compute what the target total_blob_txs would be (which gets weird once you change the allowed throughput with a hardfork).

@lightclient lightclient dismissed stale reviews from ghost via 7a31d05 August 10, 2022 17:48
EIPS/eip-4844.md Outdated Show resolved Hide resolved
EIPS/eip-4844.md Outdated
```python
def calc_excess_blob_txs(parent: Header, blobs: int) -> int:
adjusted = parent.blob_txs + blobs
return adjusted - min(TARGET_BLOB_TXS_PER_BLOCK, adjusted)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is TARGET_BLOB_TXS_PER_BLOCK the same as TARGET_BLOBS_PER_BLOCK constant? If that's the case, can we define only one?

Copy link
Contributor

@0xGabi 0xGabi left a comment

Choose a reason for hiding this comment

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

After reading the EIP and this Draft I notice the above.

@lightclient
Copy link
Member Author

lightclient commented Aug 17, 2022

@0xGabi thanks for the review. I was previously considering renaming the constant but decided against it in this PR. Looks like I didn't revert the change fully! Looks like there was already an issue with the naming and I exasperated it. Should be okay now though.

EIPS/eip-4844.md Outdated Show resolved Hide resolved
@ndengeyingoma

This comment was marked as off-topic.

@Pandapip1 Pandapip1 changed the title EIP-4844: Remove system contract concept Update EIP-4844: Remove system contract concept Aug 28, 2022
Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

LGTM from an inplementer's POV.

Copy link
Member

@adietrichs adietrichs left a comment

Choose a reason for hiding this comment

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

Some more small recommended changes, then this should be good to merge.

EIPS/eip-4844.md Outdated Show resolved Hide resolved
EIPS/eip-4844.md Outdated Show resolved Hide resolved
EIPS/eip-4844.md Outdated Show resolved Hide resolved
EIPS/eip-4844.md Show resolved Hide resolved
@github-actions github-actions bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels Sep 8, 2022
@lightclient lightclient force-pushed the update-4844 branch 2 times, most recently from ad20e07 to 9b22385 Compare September 8, 2022 19:54
Co-authored-by: Ansgar Dietrichs <adietrichs@gmail.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
Copy link
Member

@adietrichs adietrichs left a comment

Choose a reason for hiding this comment

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

lgtm

@lightclient lightclient marked this pull request as ready for review September 8, 2022 19:58
@eth-bot eth-bot enabled auto-merge (squash) September 8, 2022 19:58
@eth-bot eth-bot merged commit 2d98342 into ethereum:master Sep 8, 2022
@@ -290,8 +328,8 @@ For early draft implementations, we simply change `get_blob_gas(pre_state)` to a
### Gas price update rule (Full version)

We propose a simple independent EIP-1559-style targeting rule to compute the gas cost of the transaction.
We use the `TOTAL_BLOB_TXS_STORAGE_SLOT` storage slot of the `SYSTEM_STATE_ADDRESS` address
to store persistent data needed to compute the cost.
We use the `blobs` header field to store persistent data needed to compute the cost.
Copy link
Member

Choose a reason for hiding this comment

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

Is this blobs here excess_blobs?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in #5629, thanks for catching

nachomazzara pushed a commit to nachomazzara/EIPs that referenced this pull request Jan 13, 2023
* remove system contract concept

* store excess blob count in header instead of adjusted-total

Co-authored-by: vbuterin <v@buterin.com>
Co-authored-by: lightclient <lightclient@protonmail.com>

* revert previous name change

* update again

* should account for blobs, not blob txs

* fix

* apply review feedback

Co-authored-by: Ansgar Dietrichs <adietrichs@gmail.com>
Co-authored-by: lightclient <lightclient@protonmail.com>

Co-authored-by: vbuterin <v@buterin.com>
Co-authored-by: Ansgar Dietrichs <adietrichs@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-update Modifies an existing proposal s-draft This EIP is a Draft t-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.