Skip to content
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

Update storage keys in sequencer #1611

Closed
Fraser999 opened this issue Oct 2, 2024 · 0 comments · Fixed by #1616
Closed

Update storage keys in sequencer #1611

Fraser999 opened this issue Oct 2, 2024 · 0 comments · Fixed by #1616
Assignees

Comments

@Fraser999
Copy link
Contributor

Fraser999 commented Oct 2, 2024

It is difficult to be sure that a given storage key is unique since they are defined in multiple different locations in the sequencer codebase, and we have no convention regarding naming/prefixes.

For each component, move its keys (const values and functions generating DB keys) to a new module named keys inside the component's storage module. All keys should be given a prefix relevant to the component's name.

┆Issue Number: ENG-898

@Fraser999 Fraser999 self-assigned this Oct 2, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 9, 2024
…#1616)

## Summary
The storage keys for all components were moved from the top of
`state_ext` modules into new `storage::keys` modules. The key values
were updated to a consistent style.

## Background
We wanted the keys to be easy to find and to follow a consistent pattern
in terms of their values and locations.

## Changes
- All key consts and functions were moved to `<COMPONENT>/storage/keys`.
- All keys were given a prefix matching the component name followed by a
`/`.
- All keys now use full words (except for a few instances of well-know
abbreviations like "init") and `_` as word separators.
- Existing helper structs in various `state_ext` modules for formatting
keys were unified into a new struct `AddressPrefixer` in
`crate::storage`.
- The `Asset` functionality was moved from `crate::storage_keys` to
`crate::storage`.

## Testing
- All keys have snapshot tests (including const keys - this might be
considered overkill?)
- All keys have tests ensuring they have a component name as prefix.
- All prefix consts or functions which are used in `state_ext` modules
are tested to ensure they are actually prefixes of the given keys.

## Breaking Changelist
- This breaks the on-disk format of both the verifiable and
non-verifiable store.

## Related Issues
Closes #1611.
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 a pull request may close this issue.

1 participant