Use ordered prefixes in contract storage #216

Open
opened 2025-12-28 18:08:54 +00:00 by sami · 2 comments
Owner

Originally created by @cthulhu-rider on GitHub (Nov 12, 2025).

nspcc-dev/neofs-contract@f009282d1e/contracts/container/contract.go (L80-L93)

longer prefixes are used sometimes nspcc-dev/neofs-contract@f009282d1e/contracts/container/contract.go (L103)

this mixes up the order. It's always difficult to understand the unoccupied prefix for a new space

moreover, the symbol is often not representative. Like x in this example

Describe the solution you'd like

declare sequence of consecutive values ​​0, 1, etc. Migrate existing items. Reserve 255 to allow more than 255 item spaces. Most likely this wont be needed

overall, the goal is refactoring. However, in cases like eACL, this will also reduce the storage space

Originally created by @cthulhu-rider on GitHub (Nov 12, 2025). ## Is your feature request related to a problem? Please describe. https://github.com/nspcc-dev/neofs-contract/blob/f009282d1e7bf1e2179d4da8ee640e9056cbf641/contracts/container/contract.go#L80-L93 longer prefixes are used sometimes https://github.com/nspcc-dev/neofs-contract/blob/f009282d1e7bf1e2179d4da8ee640e9056cbf641/contracts/container/contract.go#L103 this mixes up the order. It's always difficult to understand the unoccupied prefix for a new space moreover, the symbol is often not representative. Like `x` in this example ## Describe the solution you'd like declare sequence of consecutive values ​​`0`, `1`, etc. Migrate existing items. Reserve `255` to allow more than 255 item spaces. Most likely this wont be needed overall, the goal is refactoring. However, in cases like `eACL`, this will also reduce the storage space
Author
Owner

@roman-khimov commented on GitHub (Nov 12, 2025):

Not worth the trouble to me. It tried to be semantical (like flags), but it failed to do so. Migration of a lot of values can be painful and we have it all documented anyway. An improvement can be just regrouping/renaming/reordering prefix definitions in code, without value changes.

But it also suggests that container contract is the most problematic currently, it's pretty big and stores a lot of things. You don't have this problem with balance for example.

@roman-khimov commented on GitHub (Nov 12, 2025): Not worth the trouble to me. It tried to be semantical (like flags), but it failed to do so. Migration of a lot of values can be painful and we have it all documented anyway. An improvement can be just regrouping/renaming/reordering prefix definitions in code, without value changes. But it also suggests that `container` contract is the most problematic currently, it's pretty big and stores a lot of things. You don't have this problem with `balance` for example.
Author
Owner

@cthulhu-rider commented on GitHub (Nov 12, 2025):

lets start with code improvements. I'll make a proposal. At least this way new stuff will be sequential naturally. And taking new prefix will be much easier todo

@cthulhu-rider commented on GitHub (Nov 12, 2025): lets start with code improvements. I'll make a proposal. At least this way new stuff will be sequential naturally. And taking new prefix will be much easier todo
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-contract#216
No description provided.