-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
op-node: Span batch Unprotected Tx Handling + Logic Error Fix #8458
op-node: Span batch Unprotected Tx Handling + Logic Error Fix #8458
Conversation
WalkthroughWalkthroughThe changes across various Go source files and markdown specifications involve the introduction of a new Changes
TipsChat with CodeRabbit Bot (
|
Good catch! |
fa45a08
to
6f10382
Compare
Pushed a commit: improve test cases to cover all tx types including unprotected txs |
… big.Int encoding/decodig, update spec
span-batches: encode bitlists as big-endian integers, use standard Go…
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.
LGTM. I like the new tests & the shared bit list code.
afbe2e8
Description
This PR fixes two critical errors.
Span batch did not encode/decode correctly for L2 transactions which is not protected(signed with homestead signer), causing L2 unsafe block reorg.
Example input:
Example output(after upper tx encoded and is written to L1, then decoded by derivation):
This discrepancy was caused because span batch encoding always assumed that legacy transaction will be always protected. THIS IS WRONG.
v
value was originally28
but after enc/dec, it becomes1838 = 901 * 2 + 35 + 1
. A disaster!Therefore, we do have to store bits whether legacy tx is protected or not. All other tx types(access list, eip1559) is always protected. Added
protected_bits
field. Please refer to the updated specs for the details. This may affect span batch performance, but not much because it adds single bit per L2 legacy transactions.Found out while self reviewing. If window is larger than span, must truncate.
Tests
Ensured than non-protected tx are included at span batch.
Added unit tests for new methods.
Updated unit tests to handle newly added field in span batch txs.