Skip to content

Conversation

@BeniaminDrasovean
Copy link
Contributor

@BeniaminDrasovean BeniaminDrasovean commented Sep 8, 2025

Reasoning behind the pull request

  • Simplification of the stateAccess struct

Proposed changes

  • Instead of using a new struct that contains only boolean values for accountChanges, encode the changes using an uint32

Testing procedure

  • Tested in feature branch

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

Copy link
Contributor

Copilot AI left a 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 changes the representation of account changes from a struct with boolean fields to a uint32 bitmask representation to improve performance and memory usage.

  • Changes GetAccountChanges method signatures to return uint32 instead of *stateChange.AccountChanges
  • Updates account change detection logic to use bitwise operations instead of struct field assignments
  • Modifies tests to use new bitmask constants and operations

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testscommon/state/stateChangesCollectorStub.go Updates stub to return uint32 and use NoChange constant
state/stateAccesses/stateAccessesStorer.go Minor formatting change adding blank line
state/stateAccesses/collector_test.go Updates all tests to use new bitmask representation
state/stateAccesses/collector.go Changes GetAccountChanges signature and removes mergeAccountChanges function
state/stateAccesses/accountChanges.go Refactors getAccountChanges to use bitwise operations
state/interface.go Updates StateAccessesCollector interface signature
state/disabled/disabledStateChangesCollector.go Updates disabled implementation to return NoChange
go.mod Updates mx-chain-core-go dependency version

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@BeniaminDrasovean BeniaminDrasovean self-assigned this Sep 8, 2025
bogdan-rosianu
bogdan-rosianu previously approved these changes Sep 8, 2025
@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.03%. Comparing base (ed98e40) to head (14f09f0).
⚠️ Report is 12 commits behind head on feat/state-changes.

Files with missing lines Patch % Lines
state/stateAccesses/collector.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           feat/state-changes    #7232   +/-   ##
===================================================
  Coverage               75.03%   75.03%           
===================================================
  Files                     812      812           
  Lines                  134375   134358   -17     
===================================================
- Hits                   100826   100822    -4     
+ Misses                  27826    27817    -9     
+ Partials                 5723     5719    -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

return &disabledStateAccessesCollector{}
}

// GetAccountChanges returns nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

bogdan-rosianu
bogdan-rosianu previously approved these changes Sep 8, 2025
ssd04
ssd04 previously approved these changes Sep 8, 2025
@BeniaminDrasovean BeniaminDrasovean merged commit f6c6f55 into feat/state-changes Sep 9, 2025
9 checks passed
@BeniaminDrasovean BeniaminDrasovean deleted the refactor-account-changes branch September 9, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants