mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
The storage runtime interface should not enforce a hash type (#4231)
* The storage runtime interface should not enforce a hash type Currently the runtime interface enforces `H256` as hash type, but in the future people could use whatever they want as hash type. The hash type always needs to match between the runtime and the node, but that is already required. * Update primitives/externalities/src/lib.rs Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
committed by
Gavin Wood
parent
39388b826b
commit
3e26fceda4
@@ -384,12 +384,6 @@ pub trait Hash: 'static + MaybeSerializeDeserialize + Debug + Clone + Eq + Parti
|
||||
|
||||
/// The Patricia tree root of the given mapping.
|
||||
fn trie_root(input: Vec<(Vec<u8>, Vec<u8>)>) -> Self::Output;
|
||||
|
||||
/// Acquire the global storage root.
|
||||
fn storage_root() -> Self::Output;
|
||||
|
||||
/// Acquire the global storage changes root.
|
||||
fn storage_changes_root(parent_hash: Self::Output) -> Option<Self::Output>;
|
||||
}
|
||||
|
||||
/// Blake2-256 Hash implementation.
|
||||
@@ -405,19 +399,11 @@ impl Hash for BlakeTwo256 {
|
||||
}
|
||||
|
||||
fn trie_root(input: Vec<(Vec<u8>, Vec<u8>)>) -> Self::Output {
|
||||
runtime_io::storage::blake2_256_trie_root(input)
|
||||
runtime_io::trie::blake2_256_root(input)
|
||||
}
|
||||
|
||||
fn ordered_trie_root(input: Vec<Vec<u8>>) -> Self::Output {
|
||||
runtime_io::storage::blake2_256_ordered_trie_root(input)
|
||||
}
|
||||
|
||||
fn storage_root() -> Self::Output {
|
||||
runtime_io::storage::root().into()
|
||||
}
|
||||
|
||||
fn storage_changes_root(parent_hash: Self::Output) -> Option<Self::Output> {
|
||||
runtime_io::storage::changes_root(parent_hash.into()).map(Into::into)
|
||||
runtime_io::trie::blake2_256_ordered_root(input)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user