You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For additional examples, see commented out tests in #6043 that are marked with TODOs that relate to this issue.
The bug might be in the fact that in the StorageVec::insert() these lines:
let write_offset = offset_calculator::<V>(count + 1);
let read_offset = offset_calculator::<V>(count);
write::<V>(key, write_offset, read::<V>(key, read_offset).unwrap());
will be calculating the same write_offset and read_offset for zero-size types.
To that, this issue is very likely an issue with all zero-sized types and not only storage types. It's just that nobody usually stores zero-size types in the storage.
As a general remark, I am not sure if fixing this issue makes sense before Storage v3.0 is implemented.
The text was updated successfully, but these errors were encountered:
## 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.
E.g., having:
and inserting:
will revert at runtime at the second insert. At the same time:
works.
The same is with e.g.
StorageVec<StorageString>
.For additional examples, see commented out tests in #6043 that are marked with TODOs that relate to this issue.
The bug might be in the fact that in the
StorageVec::insert()
these lines:will be calculating the same
write_offset
andread_offset
for zero-size types.To that, this issue is very likely an issue with all zero-sized types and not only storage types. It's just that nobody usually stores zero-size types in the storage.
As a general remark, I am not sure if fixing this issue makes sense before Storage v3.0 is implemented.
The text was updated successfully, but these errors were encountered: