BlockId removal: refactor: Backend::state_at (#12488)

* Minor naming improved

* BlockId removal refactor: Backend::state_at

* formatting
This commit is contained in:
Michal Kucharczyk
2022-10-14 11:27:32 +02:00
committed by GitHub
parent dcd56b1ffd
commit 532dd5ecc2
12 changed files with 105 additions and 100 deletions
+7 -2
View File
@@ -34,7 +34,7 @@ use std::borrow::Cow;
use node_primitives::Block;
use node_testing::bench::{BenchDb, BlockType, DatabaseType, KeyTypes, Profile};
use sc_client_api::backend::Backend;
use sc_client_api::{backend::Backend, HeaderBackend};
use sp_runtime::generic::BlockId;
use sp_state_machine::InspectState;
@@ -127,10 +127,15 @@ impl core::Benchmark for ImportBenchmark {
context.import_block(self.block.clone());
let elapsed = start.elapsed();
let hash = context
.client
.expect_block_hash_from_id(&BlockId::number(1))
.expect("Block 1 was imported; qed");
// Sanity checks.
context
.client
.state_at(&BlockId::number(1))
.state_at(&hash)
.expect("state_at failed for block#1")
.inspect_state(|| {
match self.block_type {