Skip to content

feat: enforce sorted and unique storage slots#2154

Merged
PhilippGackstatter merged 8 commits intonextfrom
pgackst-sorted-named-slots
Dec 12, 2025
Merged

feat: enforce sorted and unique storage slots#2154
PhilippGackstatter merged 8 commits intonextfrom
pgackst-sorted-named-slots

Conversation

@PhilippGackstatter
Copy link
Contributor

Following up to #2025, this adds missing checks that ensure storage slots are sorted and unique in Rust APIs and in the kernel.

  • Changes duplicate check by comparing neighboring slots after sorting, in AccountStorage and AccountStorageHeader.
  • Adds a sorting/uniqueness check in $kernel::account by implementing slot ID comparison.

I tried adding a test that triggers the newly added sorting/uniqueness error in the tx kernel, but wasn't able to find a way to bypass the sorting/uniqueness checks in the Rust APIs that are called when preparing a transaction.
I added a test to make sure the slot ID comparison in MASM is correct, so I think the overall approach should work as intended. It would still be nice to come up with a way to test all tx kernel errors, but I'm not yet sure how.

part of #1724

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! i left a couple of questions inline.

@PhilippGackstatter PhilippGackstatter merged commit 4879303 into next Dec 12, 2025
17 checks passed
@PhilippGackstatter PhilippGackstatter deleted the pgackst-sorted-named-slots branch December 12, 2025 02:01
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.

3 participants