Optimize `decode_len` (#5975)
* Optimize `decode_len` Instead of reading the full storage value into the runtime, we only read at maximum `5bytes` from the storage into the runtime. Furthermore this drops any handling with regards to set default values in `decl_storage!`. If the value does not exists or the decoding of the length fails, it will return `None`. To prevent people from messing stuff up, this feature relies on the `StorageDecodeLength` trait that is sealed by `frame-support` (aka only implementable inside this crate). * Some clean ups * Update frame/support/src/storage/mod.rs Co-authored-by:Alexander Popiak <alexander.popiak@parity.io> Co-authored-by:
Alexander Popiak <alexander.popiak@parity.io>
Showing
- substrate/frame/elections-phragmen/src/lib.rs 5 additions, 5 deletionssubstrate/frame/elections-phragmen/src/lib.rs
- substrate/frame/staking/src/lib.rs 1 addition, 1 deletionsubstrate/frame/staking/src/lib.rs
- substrate/frame/support/src/storage/generator/double_map.rs 1 addition, 18 deletionssubstrate/frame/support/src/storage/generator/double_map.rs
- substrate/frame/support/src/storage/generator/map.rs 4 additions, 17 deletionssubstrate/frame/support/src/storage/generator/map.rs
- substrate/frame/support/src/storage/generator/value.rs 0 additions, 16 deletionssubstrate/frame/support/src/storage/generator/value.rs
- substrate/frame/support/src/storage/mod.rs 68 additions, 20 deletionssubstrate/frame/support/src/storage/mod.rs
- substrate/frame/support/test/tests/decl_storage.rs 12 additions, 10 deletionssubstrate/frame/support/test/tests/decl_storage.rs
Please register or sign in to comment