-
Notifications
You must be signed in to change notification settings - Fork 219
refactor the state accesses collector #7480
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
base: feat/supernova-async-exec
Are you sure you want to change the base?
refactor the state accesses collector #7480
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 refactors the state accesses collector to support tracking state accesses per root hash rather than maintaining a single global collection. The refactoring enables better support for HeaderV3 blocks with multiple execution results, where each execution result has its own root hash and associated state accesses.
Key changes:
- Modified the
StateAccessesCollectorinterface to use root-hash-based methods:GetStateAccessesForRootHash(),CommitCollectedAccesses(rootHash), andRemoveStateAccessesForRootHash() - Moved state access storage timing from before commit to after commit in
accountsDB.go, ensuring the root hash is available - Removed explicit
Reset()calls from block processors, relying instead on targeted cleanup viaRemoveStateAccessesForRootHash()
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
state/interface.go |
Updated StateAccessesCollector interface to replace GetCollectedAccesses() and Store() with root-hash-aware methods |
state/stateAccesses/collector.go |
Added stateAccessesForBlock map to store accesses per root hash, implemented new interface methods with proper locking |
state/stateAccesses/collector_test.go |
Updated tests to call CommitCollectedAccesses() before retrieving state accesses via GetStateAccessesForRootHash() |
testscommon/state/stateChangesCollectorStub.go |
Updated stub to match new interface with root-hash parameters |
state/disabled/disabledStateChangesCollector.go |
Updated disabled implementation with new interface methods |
state/accountsDB.go |
Moved CommitCollectedAccesses() call to after root hash is computed in commit flow |
state/export_test.go |
Updated test helper to accept root hash parameter |
state/accountsDB_test.go |
Updated tests to commit before resetting state accesses collector |
outport/process/outportDataProvider.go |
Added logic to retrieve and remove state accesses for each root hash (supports both regular headers and HeaderV3) |
process/block/shardblock.go |
Removed explicit Reset() call as cleanup now happens in outport |
process/block/metablock.go |
Removed explicit Reset() call as cleanup now happens in outport |
go.mod / go.sum |
Updated mx-chain-core-go dependency to version with StateAccessesForBlock support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…stateAccesses-for-supernova # Conflicts: # go.mod # go.sum
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feat/supernova-async-exec #7480 +/- ##
=============================================================
- Coverage 77.59% 77.59% -0.01%
=============================================================
Files 872 872
Lines 119417 119454 +37
=============================================================
+ Hits 92663 92685 +22
- Misses 20682 20694 +12
- Partials 6072 6075 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?