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

EIP-7742 - gas calculation using target_blobs_per_block #7823

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

siladu
Copy link
Contributor

@siladu siladu commented Oct 29, 2024

PR description

The approach uses the Optional targetBlobsPerBlock field to trigger the new behaviour rather than explicitly checking the fork.

targetBlobsPerGas is sent to Besu via newPayloadV4 (see #7840) where it will be added to the block header (see #7808).

CancunGasCalculator.computeExcessBlobGas was pulled up as default method on GasCalculator interface so it can be inherited by PragueGasCalculator as well as future gas calculators.

It was not desirable to leave CancunGasCalculator untouched and override in PragueGasCalculator (the typical pattern for forks) because the method signature needed to change in order to avoid leaking conditional fork behaviour to the callers (BlobGasValidationRule and ExcessBlobGasCalculator).

In GasCalculator, the presence of the dynamic targetBlobsPerBlock (on the parent header) causes its value to replace the static CancunGasCalculator.TARGET_BLOB_GAS_PER_BLOCK (equivalent to 3 blobs).

Instead of the hardcoded value from 4844 (TARGET_BLOB_GAS_PER_BLOCK), parentTargetBlobGas is now calculated via blobGasCost(parentTargetBlobsPerBlock)


Part of #7605

Implemented as written in https://github.com/ethereum/EIPs/blob/a78f470331f2150aa1640f348ab4343127d212af/EIPS/eip-7742.md

but note there are further changes likely coming: ethereum/EIPs#8994

Spec for https://eips.ethereum.org/EIPS/eip-7742 was finalized with no further changes

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

Copy link

This pr is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the Stale label Nov 29, 2024
@siladu siladu removed the Stale label Nov 29, 2024
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@siladu siladu changed the title EIP-7742 - gas calculation using target_block_count EIP-7742 - gas calculation using target_blobs_per_block Dec 4, 2024
@siladu siladu marked this pull request as ready for review December 4, 2024 07:12
@siladu siladu enabled auto-merge (squash) December 5, 2024 01:28
@siladu siladu merged commit 472357f into hyperledger:main Dec 5, 2024
43 checks passed
@siladu siladu deleted the eip-7742_gas branch December 5, 2024 04:49
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.

2 participants