mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-30 14:17:24 +00:00
Runtime benchmarks: start (#136)
* runtime benchmarks: start * merge tests + benchmarks infrastructure * fix compilation * Fix compilation issues with runtime-benchmark feature flag Mainly involved pulling in correct dependencies and adding some functions which were called but didn't yet exist. * Fix broken compilation for tests * Move header signing methods into trait * Move signing related test helpers to own module * Remove comment about feature flag * Add constants to tests * Add top level comment for testing utilities Co-authored-by: Hernando Castano <castano.ha@gmail.com>
This commit is contained in:
committed by
Bastian Köcher
parent
ea45fa8da7
commit
e39ca0dc16
@@ -273,19 +273,16 @@ impl ValidatorsSource {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get validator that should author the block at given step.
|
||||
pub fn step_validator(header_validators: &[Address], header_step: u64) -> Address {
|
||||
header_validators[(header_step % header_validators.len() as u64) as usize]
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::mock::{custom_test_ext, genesis, validators_addresses, TestRuntime};
|
||||
use crate::mock::{run_test, validators_addresses, TestRuntime};
|
||||
use crate::{BridgeStorage, Headers, ScheduledChange, ScheduledChanges, StoredHeader};
|
||||
use frame_support::StorageMap;
|
||||
use primitives::{TransactionOutcome, H256};
|
||||
|
||||
const TOTAL_VALIDATORS: usize = 3;
|
||||
|
||||
pub(crate) fn validators_change_recept(parent_hash: H256) -> Receipt {
|
||||
Receipt {
|
||||
gas_used: 0.into(),
|
||||
@@ -425,7 +422,7 @@ pub(crate) mod tests {
|
||||
}
|
||||
|
||||
fn try_finalize_with_scheduled_change(scheduled_at: Option<HeaderId>) -> Option<ChangeToEnact> {
|
||||
custom_test_ext(genesis(), validators_addresses(3)).execute_with(|| {
|
||||
run_test(TOTAL_VALIDATORS, |_| {
|
||||
let config = ValidatorsConfiguration::Single(ValidatorsSource::Contract(Default::default(), Vec::new()));
|
||||
let validators = Validators::new(&config);
|
||||
let storage = BridgeStorage::<TestRuntime>::new();
|
||||
|
||||
Reference in New Issue
Block a user