mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Make Digest support StorageAppend (#5922)
* Make `Digest` support `StorageAppend` This adds support for `StorageAppend` to `Digest`. Digest is just a wrapper around a `Vec` and we abuse the fact that SCALE does not puts any special marker into the encoding for structs. So, we can just append to the encoded Digest. A test is added that ensures, if the `Digest` format ever changes, we remove this optimization. * Update weight * Update frame/support/src/storage/mod.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update frame/system/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
@@ -993,13 +993,11 @@ impl<T: Trait> Module<T> {
|
||||
/// Deposits a log and ensures it matches the block's log data.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - `O(D)` where `D` length of `Digest`
|
||||
/// - 1 storage mutation (codec `O(D)`).
|
||||
/// - `O(1)`
|
||||
/// - 1 storage write (codec `O(1)`)
|
||||
/// # </weight>
|
||||
pub fn deposit_log(item: DigestItemOf<T>) {
|
||||
let mut l = <Digest<T>>::get();
|
||||
l.push(item);
|
||||
<Digest<T>>::put(l);
|
||||
<Digest<T>>::append(item);
|
||||
}
|
||||
|
||||
/// Get the basic externalities for this module, useful for tests.
|
||||
|
||||
Reference in New Issue
Block a user