-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Storage name based slots and namespaces. #6064
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esdrubal
added
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
breaking
May cause existing user code to break. Requires a minor or major release.
labels
May 28, 2024
Benchmark for 7d96cebClick to view benchmark
|
esdrubal
force-pushed
the
esdrubal/storage_key_change
branch
2 times, most recently
from
June 5, 2024 18:54
802e600
to
4893a59
Compare
Benchmark for 8599040Click to view benchmark
|
esdrubal
force-pushed
the
esdrubal/storage_key_change
branch
from
June 6, 2024 12:21
703c1ce
to
3941df8
Compare
Benchmark for 5fd1e80Click to view benchmark
|
esdrubal
force-pushed
the
esdrubal/storage_key_change
branch
from
June 11, 2024 10:52
3941df8
to
60958b7
Compare
Benchmark for 99e1d6dClick to view benchmark
|
sdankel
reviewed
Jun 13, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in swayfmt and sway-lsp look good to me. I just left a comment about the compatibility with #[namespace]
test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/src/main.sw
Show resolved
Hide resolved
test/src/e2e_vm_tests/test_programs/should_pass/language/fallback_only/src/main.sw
Show resolved
Hide resolved
With this change storage keys will have a hash based on: `sha256("storage::<storage_field_name1>::<storage_field_name2>")` or a given key. A key can be provide by using the `in` keyword in a storage field as such: ``` storage { a in 0x02dac99c283f16bc91b74f6942db7f012699a2ad51272b15207b9cc14a70dbae: u64 } ``` StorageKey.field_id is now based on: `sha256("storage::<storage_field_name1>::<storage_field_name2>.<struct_field_name1>.<struct_field_name2>")` Nested storage field such as the following are not yet supported and will be added in a later pull request. ``` storage { a { b:u64 } } ```
esdrubal
force-pushed
the
esdrubal/storage_key_change
branch
2 times, most recently
from
June 17, 2024 15:20
d60ec12
to
30784d6
Compare
IGI-111
reviewed
Jun 17, 2024
docs/reference/src/documentation/operations/storage/in-keyword.md
Outdated
Show resolved
Hide resolved
Benchmark for 73458fcClick to view benchmark
|
Benchmark for 7182d62Click to view benchmark
|
esdrubal
force-pushed
the
esdrubal/storage_key_change
branch
from
June 18, 2024 09:03
bcbbbd0
to
a36179a
Compare
Benchmark for 342ffecClick to view benchmark
|
IGI-111
approved these changes
Jun 18, 2024
Benchmark for 96ef3cfClick to view benchmark
|
JoshuaBatty
approved these changes
Jun 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking
May cause existing user code to break. Requires a minor or major release.
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
With this change storage keys will have a hash based on:
sha256("storage::<storage_namespace_name1>::<storage_namespace_name2>.<storage_field_name>"
or a given key.
A key can be provided by using the
in
keyword in a storage field as such:Or by using a const expression:
StorageKey.field_id is now based on:
sha256("storage::<storage_namespace_name1>::<storage_namespace_name2>.<storage_field_name>.<struct_field_name1>.<struct_field_name2>")
Nested storage namespaces such as the following are now supported.
A deprecated warning is now thrown when the attribute
#[namespace(ns)]
is used.A warning is thrown when storage fields use the same storage slot key. The warning looks like this:
This PR does not include yet the necessary documentation updates.
Created dev-rel documentation request: https://github.com/FuelLabs/devrel-requests/issues/14
Checklist
Breaking*
orNew Feature
labels where relevant.