-
Notifications
You must be signed in to change notification settings - Fork 956
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
EIP-7934 Validate block size #8765
Conversation
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>
public BlockSizeBlockValidator( | ||
final BlockHeaderValidator blockHeaderValidator, | ||
final BlockBodyValidator blockBodyValidator, | ||
final BlockProcessor blockProcessor) { | ||
super(blockHeaderValidator, blockBodyValidator, blockProcessor); | ||
} | ||
|
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.
Since the limit is in the gasCalculator "for now", this class can be removed and the check can be moved to MainnetTransactionValidator.
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.
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) { |
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.
Since we have a method that returns it in the gasCalculator, it is probably better to avoid using the constant.
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; |
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.
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>
PR description
EIP-7934 Validate block size
Fixed Issue(s)
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew spotlessApply
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests