Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Fix the `StorageVec` type by excluding the `len_cached` field from its type info - [#2052](https://github.com/paritytech/ink/pull/2052)

## Version 5.0.0-rc

Expand Down
10 changes: 1 addition & 9 deletions crates/storage/src/lazy/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub struct StorageVec<V: Packed, KeyType: StorageKey = AutoKey> {
///
/// Because of caching, never operate on this field directly!
/// Always use `fn get_len()` an `fn set_len()` instead.
#[cfg_attr(feature = "std", codec(skip))]
len_cached: CachedLen,
/// We use a [Mapping] to store all elements of the vector.
/// Each element is living in storage under `&(KeyType::KEY, index)`.
Expand All @@ -130,15 +131,6 @@ pub struct StorageVec<V: Packed, KeyType: StorageKey = AutoKey> {
#[derive(Debug)]
struct CachedLen(Cell<Option<u32>>);

#[cfg(feature = "std")]
impl scale_info::TypeInfo for CachedLen {
type Identity = Option<u32>;

fn type_info() -> scale_info::Type {
<Self::Identity as scale_info::TypeInfo>::type_info()
}
}

impl<V, KeyType> Default for StorageVec<V, KeyType>
where
V: Packed,
Expand Down