Skip to content

Add EIP 7778 to Amsterdam#9664

Merged
daniellehrner merged 19 commits intobesu-eth:mainfrom
daniellehrner:feat/issue-9539/eip_7778
Jan 26, 2026
Merged

Add EIP 7778 to Amsterdam#9664
daniellehrner merged 19 commits intobesu-eth:mainfrom
daniellehrner:feat/issue-9539/eip_7778

Conversation

@daniellehrner
Copy link
Copy Markdown
Contributor

PR description

Implement EIP-7778 for Amsterdam. It changes how the block gas limit is calculated. With this EIP the refunds are not deductible for the block gas limit only for the gas spent on the transaction. Because of that a new gas_spent field is added to transactions receipt

Fixed Issue(s)

fixes #9539

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:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
…ng and after correcting it, it is not needed anymore

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
@daniellehrner daniellehrner changed the title Feat/issue 9539/eip 7778 Add EIP 7778 to Amsterdam Jan 21, 2026
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
…ecoding to know if gas_spent must be present or not

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
return RLP.input(bytes)
.readList(
in ->
isAmsterdamOrLater
Copy link
Copy Markdown
Contributor Author

@daniellehrner daniellehrner Jan 21, 2026

Choose a reason for hiding this comment

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

Transaction receipts have already one optional field, revert reason. Simply extending tx receipts with another optional field, gas_spent from EIP-7778, makes decoding ambiguous, because it is not clear which of the 2 optional fields has to be decoded after the mandatory ones.

This is solved by checking the hardfork first and then using the legacy decoder, or the amsterdam one which has gas_spent as a mandatory field.

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
@macfarla macfarla moved this to Open PRs in 26.1.0 Release Jan 22, 2026
Copy link
Copy Markdown
Contributor

@fab-10 fab-10 left a comment

Choose a reason for hiding this comment

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

Looks good, some minor suggestion and one invite to find a better way to find how to store receipts

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
… and remove gasSpent logic from base decoder, use ProtocolSpec to decide which transaction receipt decoder to use

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
@daniellehrner daniellehrner requested a review from fab-10 January 23, 2026 16:43
@daniellehrner daniellehrner merged commit efb004f into besu-eth:main Jan 26, 2026
54 of 61 checks passed
@github-project-automation github-project-automation bot moved this from Open PRs to Done in 26.1.0 Release Jan 26, 2026
@daniellehrner daniellehrner deleted the feat/issue-9539/eip_7778 branch January 26, 2026 12:20
macfarla pushed a commit to CPerezz/besu that referenced this pull request Feb 6, 2026
* EIP-7708 implementation

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* fix acceptance tests

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* undo modification for debugging

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* properly check empty requests hash

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* adapt unit tests to new changes

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* undo AbstractEngineNewPayload changes, because the test setup was wrong and after correcting it, it is not needed anymore

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* revert change as the acceptance tests have been fixed

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* first draft

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* add acceptance and unit tests, add 7778 changes to block building

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* update plugin hash, add changelog entry

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* fixed ambiguous tx receipt decoding by checking the hardfork before decoding to know if gas_spent must be present or not

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* remove gas spent parsing from pre amsterdam tx receipt decoding

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* fixed merging issues

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

* Rename TransactionReceiptDecoder to FrontierTransactionReceiptDecoder and remove gasSpent logic from base decoder, use ProtocolSpec to decide which transaction receipt decoder to use

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>

---------

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Matilda-Clerke added a commit to Matilda-Clerke/besu that referenced this pull request Feb 17, 2026
This reverts commit efb004f

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
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.

EIP-7778: Block Gas Accounting without Refunds

3 participants