mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 18:27:56 +00:00
Implement change trie for child trie. (#3122)
* Initial implementation, some redundancy is awkward and there is some useless computation (but there is a pending pr for that). Next are tests. * Minimal tests and fix extend child. * implement iterator for change child trie. * prune child trie. * Fix pruning test. * bump spec version. * Avoid empty child trie (could also be checked before) * tabs. * Fix child digest overriding each others. * Restore doc deleted on merge. * Check correct child value on extrinsics build. * Revert runtime version update.
This commit is contained in:
committed by
Svyatoslav Nikolsky
parent
06658e0c3c
commit
e3d0c60a31
@@ -226,7 +226,8 @@ impl<'a, B: BlockT> LightDispatchNetwork<B> for LightDispatchIn<'a, B> {
|
||||
last: <B as BlockT>::Hash,
|
||||
min: <B as BlockT>::Hash,
|
||||
max: <B as BlockT>::Hash,
|
||||
key: Vec<u8>
|
||||
storage_key: Option<Vec<u8>>,
|
||||
key: Vec<u8>,
|
||||
) {
|
||||
let message = message::generic::Message::RemoteChangesRequest(message::RemoteChangesRequest {
|
||||
id,
|
||||
@@ -234,6 +235,7 @@ impl<'a, B: BlockT> LightDispatchNetwork<B> for LightDispatchIn<'a, B> {
|
||||
last,
|
||||
min,
|
||||
max,
|
||||
storage_key,
|
||||
key,
|
||||
});
|
||||
|
||||
@@ -1385,24 +1387,34 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
|
||||
trace!(target: "sync", "Remote changes proof request {} from {} for key {} ({}..{})",
|
||||
request.id,
|
||||
who,
|
||||
request.key.to_hex::<String>(),
|
||||
if let Some(sk) = request.storage_key.as_ref() {
|
||||
format!("{} : {}", sk.to_hex::<String>(), request.key.to_hex::<String>())
|
||||
} else {
|
||||
request.key.to_hex::<String>()
|
||||
},
|
||||
request.first,
|
||||
request.last
|
||||
);
|
||||
let storage_key = request.storage_key.map(|sk| StorageKey(sk));
|
||||
let key = StorageKey(request.key);
|
||||
let proof = match self.context_data.chain.key_changes_proof(
|
||||
request.first,
|
||||
request.last,
|
||||
request.min,
|
||||
request.max,
|
||||
&key
|
||||
storage_key.as_ref(),
|
||||
&key,
|
||||
) {
|
||||
Ok(proof) => proof,
|
||||
Err(error) => {
|
||||
trace!(target: "sync", "Remote changes proof request {} from {} for key {} ({}..{}) failed with: {}",
|
||||
request.id,
|
||||
who,
|
||||
key.0.to_hex::<String>(),
|
||||
if let Some(sk) = storage_key {
|
||||
format!("{} : {}", sk.0.to_hex::<String>(), key.0.to_hex::<String>())
|
||||
} else {
|
||||
key.0.to_hex::<String>()
|
||||
},
|
||||
request.first,
|
||||
request.last,
|
||||
error
|
||||
|
||||
Reference in New Issue
Block a user