File tree Expand file tree Collapse file tree 10 files changed +957
-4
lines changed Expand file tree Collapse file tree 10 files changed +957
-4
lines changed Original file line number Diff line number Diff line change @@ -121,3 +121,10 @@ payability
121
121
unpayable
122
122
initializer
123
123
WebSocket/S
124
+ StorageVec
125
+ KiB
126
+ GB
127
+ BufferTooSmall
128
+ KeyNotFound
129
+ ink_env
130
+ ^
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15
15
- Linter: ` no_main ` lint - [ #2001 ] ( https://github.com/paritytech/ink/pull/2001 )
16
16
- Clean E2E configuration parsing - [ #1922 ] ( https://github.com/paritytech/ink/pull/1922 )
17
17
- Make ` set_code_hash ` generic - [ #1906 ] ( https://github.com/paritytech/ink/pull/1906 )
18
+ - Provide a ` StorageVec ` datastructure built on top of ` Lazy ` - [ #1995 ] ( https://github.com/paritytech/ink/pull/1955 )
18
19
19
20
### Changed
20
21
- Messages return ` TypeSpec ` directly - #[ 1999] ( https://github.com/paritytech/ink/pull/1999 )
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ pub mod storage {
57
57
pub use ink_storage:: {
58
58
Lazy ,
59
59
Mapping ,
60
+ StorageVec ,
60
61
} ;
61
62
}
62
63
Original file line number Diff line number Diff line change 19
19
//! extra care has to be taken when operating directly on them.
20
20
21
21
mod mapping;
22
+ mod vec;
22
23
23
24
#[ doc( inline) ]
24
25
pub use self :: mapping:: Mapping ;
26
+ pub use self :: vec:: StorageVec ;
25
27
26
28
use crate :: traits:: {
27
29
AutoKey ,
@@ -159,15 +161,15 @@ where
159
161
let key_size = <Key as Storable >:: encoded_size ( & KeyType :: KEY ) ;
160
162
161
163
if key_size >= ink_env:: BUFFER_SIZE {
162
- return Some ( Err ( ink_env:: Error :: BufferTooSmall ) )
164
+ return Some ( Err ( ink_env:: Error :: BufferTooSmall ) ) ;
163
165
}
164
166
165
167
let value_size: usize = ink_env:: contains_contract_storage ( & KeyType :: KEY ) ?
166
168
. try_into ( )
167
169
. expect ( "targets of less than 32bit pointer size are not supported; qed" ) ;
168
170
169
171
if key_size. saturating_add ( value_size) > ink_env:: BUFFER_SIZE {
170
- return Some ( Err ( ink_env:: Error :: BufferTooSmall ) )
172
+ return Some ( Err ( ink_env:: Error :: BufferTooSmall ) ) ;
171
173
}
172
174
173
175
self . get ( ) . map ( Ok )
@@ -191,7 +193,7 @@ where
191
193
let value_size = <V as Storable >:: encoded_size ( value) ;
192
194
193
195
if key_size. saturating_add ( value_size) > ink_env:: BUFFER_SIZE {
194
- return Err ( ink_env:: Error :: BufferTooSmall )
196
+ return Err ( ink_env:: Error :: BufferTooSmall ) ;
195
197
} ;
196
198
197
199
self . set ( value) ;
You can’t perform that action at this time.
0 commit comments