-
Notifications
You must be signed in to change notification settings - Fork 492
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
fix: Update transaction validation logic in ethclient #1409
base: develop
Are you sure you want to change the base?
Conversation
- Resolved an issue where blocks containing system transactions could not be fetched correctly. - The `transactionsRoot` of such blocks is set to `EmptyTxsHash`, but the `Transactions` list contains one transaction, causing a mismatch. - Updated validation to properly handle these cases. Reference: Example block with system transaction: https://amoy.polygonscan.com/block/16653120
Hi, thanks for raising this PR. The issues seems correct that it will happen when there's only 1 transaction which is a state-sync (system) transaction and nothing else. But, IMO, we shouldn't get rid of the error. Let me see if there's some way to find out if it's a state-sync tx or not. |
Hi @Leekyungun, can you update the PR to handle this specific condition explicitly instead of removing this check? Basically, system transactions are directly applied on state and hence the Also, could you raise the PR against |
Good idea! |
This reverts commit 60892a0.
- Improved error handling to ensure block consistency when the transaction list and header hash mismatch. Reference: Example block with system transaction: https://amoy.polygonscan.com/block/16653120
I've added exception handling and updated the target branch to develop. Initially, I considered declaring the address "0x0000000000000000000000000000000000000000" as a constant and replacing its occurrences, but I was concerned that future updates in Ethereum might cause conflicts. Please provide feedback. |
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.
Hey @Leekyungun, thanks for the PR, just small suggestions and would wait for final review from @manav2401 😄
- add logic to check if all transactions are system transactions. - System transaction is determined by checking if both "from" and "to" addresses are zero addresses.
Thanks for the review, it seems like the code has improved because of it. |
Hey, the PR looks good, wait for the final review from @manav2401 😄 |
Description
This PR resolves an issue where blocks containing system transactions could not be retrieved properly using
getBlock
.For such blocks, the
transactionsRoot
is set toEmptyTxsHash
, but theTransactions
list contains one transaction, which leads to a mismatch and prevents block information from being retrieved.The validation logic has been updated to handle these cases correctly.
Example block with system transaction: https://amoy.polygonscan.com/block/16653120
Changes
Breaking changes
No breaking changes have been introduced in this PR.
Nodes audience
This PR affects all nodes and does not include changes limited to a subset of nodes.
Checklist
Cross repository changes
Testing
Manual tests
transactionsRoot
asEmptyTxsHash
but includingTransactions
).Additional comments
See the example block for context:
https://amoy.polygonscan.com/block/16653120