Skip to content
Snippets Groups Projects
Unverified Commit 81487fb6 authored by bgallois's avatar bgallois
Browse files

fix benchmark extrinsic creation

parent 09454c67
No related branches found
No related tags found
1 merge request!312Upgrade polkadot v1.17.0
Pipeline #39767 passed
......@@ -16,8 +16,8 @@
use common_runtime::{AccountId, Balance, Block, BlockNumber, Hash, Header, Index};
use sc_client_api::{
AuxStore, Backend as BackendT, BlockchainEvents, KeysIter, MerkleValue, PairsIter,
UsageProvider,
AuxStore, Backend as BackendT, BlockBackend, BlockchainEvents, KeysIter, MerkleValue,
PairsIter, UsageProvider,
};
use sp_api::{CallApiAt, ProvideRuntimeApi};
use sp_blockchain::{HeaderBackend, HeaderMetadata};
......@@ -26,7 +26,7 @@ use sp_core::{Encode, Pair};
use sp_runtime::{
generic::SignedBlock,
traits::{BlakeTwo256, Block as BlockT},
Justifications,
Justifications, SaturatedConversion,
};
use sp_storage::{ChildInfo, StorageData, StorageKey};
use std::sync::Arc;
......@@ -385,9 +385,10 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for Client {
let signer = sp_keyring::Sr25519Keyring::Bob.pair();
let period = super::runtime_executor::runtime::BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64;
let genesis = client.usage_info().chain.best_hash;
let genesis = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed");
let best_block = client.chain_info().best_number;
Ok(client.sign_call(call, nonce, 0, period, genesis, signer))
Ok(client.sign_call(call, nonce, best_block.saturated_into(), period, genesis, signer))
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment