mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 11:21:07 +00:00
BlockId removal: &Hash to Hash (#12626)
It changes &Block::Hash argument to Block::Hash. This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
This commit is contained in:
committed by
GitHub
parent
7c4bfc9749
commit
1ed70004e7
@@ -66,7 +66,7 @@ fn insert_blocks(db: &Backend<Block>, storage: Vec<(Vec<u8>, Vec<u8>)>) -> H256
|
||||
for i in 0..10 {
|
||||
let mut op = db.begin_operation().unwrap();
|
||||
|
||||
db.begin_state_operation(&mut op, &parent_hash).unwrap();
|
||||
db.begin_state_operation(&mut op, parent_hash).unwrap();
|
||||
|
||||
let mut header = Header {
|
||||
number,
|
||||
@@ -83,7 +83,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(&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,
|
||||
);
|
||||
@@ -175,7 +175,7 @@ fn state_access_benchmarks(c: &mut Criterion) {
|
||||
|
||||
group.bench_function(desc, |b| {
|
||||
b.iter_batched(
|
||||
|| backend.state_at(&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();
|
||||
@@ -213,7 +213,7 @@ fn state_access_benchmarks(c: &mut Criterion) {
|
||||
|
||||
group.bench_function(desc, |b| {
|
||||
b.iter_batched(
|
||||
|| backend.state_at(&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();
|
||||
@@ -251,7 +251,7 @@ fn state_access_benchmarks(c: &mut Criterion) {
|
||||
|
||||
group.bench_function(desc, |b| {
|
||||
b.iter_batched(
|
||||
|| backend.state_at(&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();
|
||||
@@ -289,7 +289,7 @@ fn state_access_benchmarks(c: &mut Criterion) {
|
||||
|
||||
group.bench_function(desc, |b| {
|
||||
b.iter_batched(
|
||||
|| backend.state_at(&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