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

Pushing a StorageString to StorageVec overwrites all values with the latest #6036

Closed
ironcev opened this issue May 20, 2024 · 0 comments · Fixed by #6043
Closed

Pushing a StorageString to StorageVec overwrites all values with the latest #6036

ironcev opened this issue May 20, 2024 · 0 comments · Fixed by #6043
Assignees
Labels
bug Something isn't working lib: std Standard library

Comments

@ironcev
Copy link
Member

ironcev commented May 20, 2024

For the minimal repro and issue description see: https://github.com/MoMannn/sway-vec/tree/master

Hint: StorageString should use field_id() instead of the slot().

@ironcev ironcev added bug Something isn't working lib: std Standard library labels May 20, 2024
@ironcev ironcev self-assigned this May 20, 2024
ironcev added a commit that referenced this issue May 22, 2024
## Description

This PR fixes #6036 by using `field_id()` in the `StorageString` instead
of `slot()`.

Additionally, the PR:
- fixes documentation glitches in the `StorageVec`.
- optimizes `StorageMap::get` by removing double calculation of the
`key`.
- cleans up most of the Sway and all Rust warnings in the SDK harness
tests.

The PR is not solving all the issues related to composing dynamic
storage types. E.g, #6040 is (very likely just one) of them.

Closes #6036.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib: std Standard library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant