mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
Fix benchmarks (#1919)
* fixed benchmarks broken by rejecting storage proofs with excessive trie nodes and justifications with extra prevotes * update weights * fmt * accidental paste * revert changes to millau runtime (separate PR) * revert comment change
This commit is contained in:
committed by
Bastian Köcher
parent
7be2cb1cdd
commit
aa466a485d
@@ -19,7 +19,8 @@
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
use crate::{
|
||||
messages_benchmarking::insert_header_to_grandpa_pallet, messages_generation::grow_trie,
|
||||
messages_benchmarking::insert_header_to_grandpa_pallet,
|
||||
messages_generation::grow_trie_leaf_value,
|
||||
};
|
||||
|
||||
use bp_parachains::parachain_head_storage_key_at_source;
|
||||
@@ -59,17 +60,21 @@ where
|
||||
TrieDBMutBuilderV1::<RelayBlockHasher>::new(&mut mdb, &mut state_root).build();
|
||||
|
||||
// insert parachain heads
|
||||
for parachain in parachains {
|
||||
for (i, parachain) in parachains.into_iter().enumerate() {
|
||||
let storage_key =
|
||||
parachain_head_storage_key_at_source(R::ParasPalletName::get(), *parachain);
|
||||
trie.insert(&storage_key.0, ¶chain_head.encode())
|
||||
let leaf_data = if i == 0 {
|
||||
grow_trie_leaf_value(parachain_head.encode(), size)
|
||||
} else {
|
||||
parachain_head.encode()
|
||||
};
|
||||
trie.insert(&storage_key.0, &leaf_data)
|
||||
.map_err(|_| "TrieMut::insert has failed")
|
||||
.expect("TrieMut::insert should not fail in benchmarks");
|
||||
storage_keys.push(storage_key);
|
||||
parachain_heads.push((*parachain, parachain_head.hash()))
|
||||
}
|
||||
}
|
||||
state_root = grow_trie(state_root, &mut mdb, size);
|
||||
|
||||
// generate heads storage proof
|
||||
let proof = record_all_trie_keys::<LayoutV1<RelayBlockHasher>, _>(&mdb, &state_root)
|
||||
|
||||
Reference in New Issue
Block a user