Skip to content

fix(sync): validate account and slot order and boundaries in SnapProviderHelper #8551

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Pricstas
Copy link

@Pricstas Pricstas commented Apr 23, 2025

Fixes #XXXX

Changes

  • Added validation of sorting order for accounts and storage slots in AddAccountRange and AddStorageRange
  • Added boundary checks to ensure all account and slot paths fall within [startingHash, limitHash)
  • Introduced new enum members to AddRangeResult: InvalidOrder and OutOfBounds

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature
  • Breaking change
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: None

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Added unit tests for sorting validation in AddAccountRange and AddStorageRange.

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

Copy link
Contributor

@damian-orzechowski damian-orzechowski left a comment

Choose a reason for hiding this comment

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

General question - is there a case identified to be solved or is this to address items on TODO list?

@Pricstas
Copy link
Author

@damian-orzechowski

  • Removed hard validation for boundary limits (OutOfBounds) — accounts and slots outside the range are now handled gracefully using hasExtraStorage logic.
  • Kept sorting validation for accounts and slots to ensure proper boundary stitching, with comments added to clarify this behavior.
  • Let me know if you'd prefer unit tests added now, or I can follow up with a separate PR.

@damian-orzechowski
Copy link
Contributor

damian-orzechowski commented Apr 25, 2025

  • Let me know if you'd prefer unit tests added now, or I can follow up with a separate PR.

Yes, I'd prefer to add unit test to this PR

@Pricstas Pricstas force-pushed the fix/update branch 3 times, most recently from b8cf82e to 9605974 Compare April 25, 2025 13:22
@Pricstas Pricstas requested review from rubo and a team as code owners April 25, 2025 13:22
- Added validation for sorting order for accounts and storage slots in AddAccountRange and AddStorageRange.
- Introduced InvalidOrder enum member to AddRangeResult.
- Added unit tests for sorting validation.
@Pricstas
Copy link
Author

@damian-orzechowski Added unit tests for the sorting validation as requested

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.

2 participants