mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 11:27:58 +00:00
bench pallet: only require Hash instead of Block (#3244)
Preparation for https://github.com/paritytech/polkadot-sdk/issues/2664 Changes: - Only require `Hash` instead of `Block` for the benchmarking - Refactor DB types to do the same ## Integration This breaking change can easily be integrated into your node via: ```patch - cmd.run::<Block, ()>(config) + cmd.run::<HashingFor<Block>, ()>(config) ``` Status: waiting for CI checks --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: cheme <emericchevalier.pro@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a2e6256c0d
commit
c36c51cac3
@@ -57,7 +57,7 @@ impl StorageCmd {
|
||||
let best_hash = client.usage_info().chain.best_hash;
|
||||
let header = client.header(best_hash)?.ok_or("Header not found")?;
|
||||
let original_root = *header.state_root();
|
||||
let trie = DbStateBuilder::<Block>::new(storage.clone(), original_root).build();
|
||||
let trie = DbStateBuilder::<HashingFor<Block>>::new(storage.clone(), original_root).build();
|
||||
|
||||
info!("Preparing keys from block {}", best_hash);
|
||||
// Load all KV pairs and randomly shuffle them.
|
||||
@@ -189,7 +189,7 @@ fn convert_tx<B: BlockT>(
|
||||
/// if `child_info` exist then it means this is a child tree key
|
||||
fn measure_write<Block: BlockT>(
|
||||
db: Arc<dyn sp_database::Database<DbHash>>,
|
||||
trie: &DbState<Block>,
|
||||
trie: &DbState<HashingFor<Block>>,
|
||||
key: Vec<u8>,
|
||||
new_v: Vec<u8>,
|
||||
version: StateVersion,
|
||||
@@ -220,7 +220,7 @@ fn measure_write<Block: BlockT>(
|
||||
/// if `child_info` exist then it means this is a child tree key
|
||||
fn check_new_value<Block: BlockT>(
|
||||
db: Arc<dyn sp_database::Database<DbHash>>,
|
||||
trie: &DbState<Block>,
|
||||
trie: &DbState<HashingFor<Block>>,
|
||||
key: &Vec<u8>,
|
||||
new_v: &Vec<u8>,
|
||||
version: StateVersion,
|
||||
|
||||
Reference in New Issue
Block a user