mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
* Some work * Fixes * Tests builds * Fixes * Fixes * Fixes * Fixes * Fixes * Formatting * Formatting * Fix * Fixes * Fixes * Fixes * Fixes * Update Cargo.lock * Bump * Fixes
This commit is contained in:
@@ -32,7 +32,7 @@ use primitives::v1::{
|
||||
use sp_core::{sr25519, H256};
|
||||
use sp_runtime::{
|
||||
generic::Digest,
|
||||
traits::{Header as HeaderT, One, Zero},
|
||||
traits::{Header as HeaderT, One, TrailingZeroInput, Zero},
|
||||
RuntimeAppPublic,
|
||||
};
|
||||
use sp_std::{collections::btree_map::BTreeMap, convert::TryInto, prelude::Vec, vec};
|
||||
@@ -45,9 +45,10 @@ fn mock_validation_code() -> ValidationCode {
|
||||
///
|
||||
/// This is directly from frame-benchmarking. Copy/pasted so we can use it when not compiling with
|
||||
/// "features = runtime-benchmarks".
|
||||
fn account<AccountId: Decode + Default>(name: &'static str, index: u32, seed: u32) -> AccountId {
|
||||
fn account<AccountId: Decode>(name: &'static str, index: u32, seed: u32) -> AccountId {
|
||||
let entropy = (name, index, seed).using_encoded(sp_io::hashing::blake2_256);
|
||||
AccountId::decode(&mut &entropy[..]).expect("256 bit input is valid. qed.")
|
||||
AccountId::decode(&mut TrailingZeroInput::new(&entropy[..]))
|
||||
.expect("infinite input; no invalid input; qed")
|
||||
}
|
||||
|
||||
/// Create a 32 byte slice based on the given number.
|
||||
|
||||
@@ -704,6 +704,7 @@ mod sanitizers {
|
||||
AvailabilityBitfield, GroupIndex, Hash, Id as ParaId, SignedAvailabilityBitfield,
|
||||
ValidatorIndex,
|
||||
};
|
||||
use sp_core::crypto::UncheckedFrom;
|
||||
|
||||
use crate::mock::Test;
|
||||
use futures::executor::block_on;
|
||||
@@ -921,14 +922,13 @@ mod sanitizers {
|
||||
|
||||
// check the validators signature
|
||||
{
|
||||
use primitives::v1::ValidatorSignature;
|
||||
let mut unchecked_bitfields = unchecked_bitfields.clone();
|
||||
|
||||
// insert a bad signature for the last bitfield
|
||||
let last_bit_idx = unchecked_bitfields.len() - 1;
|
||||
unchecked_bitfields
|
||||
.get_mut(last_bit_idx)
|
||||
.and_then(|u| Some(u.set_signature(ValidatorSignature::default())))
|
||||
.and_then(|u| Some(u.set_signature(UncheckedFrom::unchecked_from([1u8; 64]))))
|
||||
.expect("we are accessing a valid index");
|
||||
assert_eq!(
|
||||
&sanitize_bitfields::<Test>(
|
||||
|
||||
Reference in New Issue
Block a user