Refactor Optimism Transaction Validator: Extract OP-Specific Checks & Enable Batch Processing #14929
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the Optimism transaction validation(#13902). The changes decouple the Ethereum (ETH) standard validation from the additional Optimism-specific logic (i.e., ensuring the sender can cover the L1 gas fee). In addition, batch validation is now optimized by delegating to the inner validator’s batch method and then applying the OP-specific checks on the resulting outcomes.
Detailed Changes
Extracted OP-Specific Validation Logic
apply_op_checks
that encapsulates the Optimism-specific checks.Simplified Single Transaction Validation
validate_one
method now:apply_op_checks
method.Optimized Batch Transaction Validation
validate_all
method to use the inner validator’s batch validation (validate_all
) which internally use ('validate_batch') instead of iterating over transactions one-by-one.apply_op_checks
, ensuring that the extra L1 gas fee validation is applied consistently and efficiently.This is my first contribution to reth, and I'm eager to receive any feedback or suggestions for improvement.