-
Notifications
You must be signed in to change notification settings - Fork 21.6k
core/state: fix bug about getting stable LogsHash result. #33082
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
Conversation
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.
Pull Request Overview
This PR addresses non-deterministic log ordering by ensuring logs are returned in a stable, consistent order. Map iteration in Go is intentionally randomized, which can cause the Logs() method to return logs in different orders across multiple calls, potentially affecting hash calculations like LogsHash.
- Added sorting of logs by
TxIndexto ensure deterministic ordering - Imported the
sortpackage to support the sorting operation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Removed comment about sorting logs by TxIndex.
…3082) Because the map iteration is unstable, we need to order logs by tx index and keep the same order with receipts and their logs, so we can still get the same `LogsHash` across runs. --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: rjl493456442 <[email protected]>
…3082) Because the map iteration is unstable, we need to order logs by tx index and keep the same order with receipts and their logs, so we can still get the same `LogsHash` across runs. --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: rjl493456442 <[email protected]>
…3082) Because the map iteration is unstable, we need to order logs by tx index and keep the same order with receipts and their logs, so we can still get the same `LogsHash` across runs. --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: rjl493456442 <[email protected]>
Because the map iteration is unstable, we need to order logs by tx index and keep the same order with receipts and their logs, so we can still get the same
LogsHashacross runs.