Skip to content

EIP-7934 Validate block size #8765

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

Merged
merged 21 commits into from
Jun 18, 2025

Conversation

jframe
Copy link
Contributor

@jframe jframe commented Jun 9, 2025

PR description

EIP-7934 Validate block size

Fixed Issue(s)

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

jframe added 2 commits June 9, 2025 12:53
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
@Gabriel-Trintinalia Gabriel-Trintinalia added the Osaka Osaka fork related - part of Fusaka label Jun 10, 2025
@Gabriel-Trintinalia Gabriel-Trintinalia moved this to In Progress in Osaka Jun 10, 2025
jframe and others added 17 commits June 10, 2025 12:44
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Comment on lines 35 to 41
public BlockSizeBlockValidator(
final BlockHeaderValidator blockHeaderValidator,
final BlockBodyValidator blockBodyValidator,
final BlockProcessor blockProcessor) {
super(blockHeaderValidator, blockBodyValidator, blockProcessor);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the limit is in the gasCalculator "for now", this class can be removed and the check can be moved to MainnetTransactionValidator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rather keep it as is as in the future in this PR or another the limit being in the GasCalculator will be removed and at that point I'd want this in it's own validator.

final boolean shouldUpdateHead,
final boolean shouldRecordBadBlock) {
final int blockSize = block.getSize();
if (blockSize > MAX_RLP_BLOCK_SIZE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have a method that returns it in the gasCalculator, it is probably better to avoid using the constant.

Comment on lines 38 to 44
public static final int MAX_BLOCK_SIZE = 10_485_760;

/** The safety margin to take the CL block overhead into account */
public static final int SAFETY_MARGIN = 2_097_152;

/** The maximum size of an RLP encoded block size in bytes */
public static final int MAX_RLP_BLOCK_SIZE = MAX_BLOCK_SIZE - SAFETY_MARGIN;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be private since we have a method that returns it

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
@Gabriel-Trintinalia Gabriel-Trintinalia marked this pull request as ready for review June 18, 2025 03:42
@Gabriel-Trintinalia Gabriel-Trintinalia merged commit 65f25ac into hyperledger:main Jun 18, 2025
48 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Osaka Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Osaka Osaka fork related - part of Fusaka
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants