mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 10:01:02 +00:00
BlockId removal: refactor: Backend::state_at (#12488)
* Minor naming improved * BlockId removal refactor: Backend::state_at * formatting
This commit is contained in:
committed by
GitHub
parent
dcd56b1ffd
commit
532dd5ecc2
@@ -84,7 +84,7 @@ fn insert_blocks(db: &Backend<Block>, storage: Vec<(Vec<u8>, Vec<u8>)>) -> H256
|
||||
.map(|(k, v)| (k.clone(), Some(v.clone())))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let (state_root, tx) = db.state_at(BlockId::Hash(parent_hash)).unwrap().storage_root(
|
||||
let (state_root, tx) = db.state_at(&parent_hash).unwrap().storage_root(
|
||||
changes.iter().map(|(k, v)| (k.as_slice(), v.as_deref())),
|
||||
StateVersion::V1,
|
||||
);
|
||||
@@ -176,7 +176,7 @@ fn state_access_benchmarks(c: &mut Criterion) {
|
||||
|
||||
group.bench_function(desc, |b| {
|
||||
b.iter_batched(
|
||||
|| backend.state_at(BlockId::Hash(block_hash)).expect("Creates state"),
|
||||
|| backend.state_at(&block_hash).expect("Creates state"),
|
||||
|state| {
|
||||
for key in keys.iter().cycle().take(keys.len() * multiplier) {
|
||||
let _ = state.storage(&key).expect("Doesn't fail").unwrap();
|
||||
@@ -214,7 +214,7 @@ fn state_access_benchmarks(c: &mut Criterion) {
|
||||
|
||||
group.bench_function(desc, |b| {
|
||||
b.iter_batched(
|
||||
|| backend.state_at(BlockId::Hash(block_hash)).expect("Creates state"),
|
||||
|| backend.state_at(&block_hash).expect("Creates state"),
|
||||
|state| {
|
||||
for key in keys.iter().take(1).cycle().take(multiplier) {
|
||||
let _ = state.storage(&key).expect("Doesn't fail").unwrap();
|
||||
@@ -252,7 +252,7 @@ fn state_access_benchmarks(c: &mut Criterion) {
|
||||
|
||||
group.bench_function(desc, |b| {
|
||||
b.iter_batched(
|
||||
|| backend.state_at(BlockId::Hash(block_hash)).expect("Creates state"),
|
||||
|| backend.state_at(&block_hash).expect("Creates state"),
|
||||
|state| {
|
||||
for key in keys.iter().take(1).cycle().take(multiplier) {
|
||||
let _ = state.storage_hash(&key).expect("Doesn't fail").unwrap();
|
||||
@@ -290,7 +290,7 @@ fn state_access_benchmarks(c: &mut Criterion) {
|
||||
|
||||
group.bench_function(desc, |b| {
|
||||
b.iter_batched(
|
||||
|| backend.state_at(BlockId::Hash(block_hash)).expect("Creates state"),
|
||||
|| backend.state_at(&block_hash).expect("Creates state"),
|
||||
|state| {
|
||||
let _ = state
|
||||
.storage_hash(sp_core::storage::well_known_keys::CODE)
|
||||
|
||||
Reference in New Issue
Block a user