mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
@@ -24,12 +24,17 @@ use sp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId};
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// Set of test accounts with friendly names.
|
||||
/// Set of test accounts with friendly names: Alice.
|
||||
pub const ALICE: Account = Account(0);
|
||||
/// Set of test accounts with friendly names: Bob.
|
||||
pub const BOB: Account = Account(1);
|
||||
/// Set of test accounts with friendly names: Charlie.
|
||||
pub const CHARLIE: Account = Account(2);
|
||||
/// Set of test accounts with friendly names: Dave.
|
||||
pub const DAVE: Account = Account(3);
|
||||
/// Set of test accounts with friendly names: Eve.
|
||||
pub const EVE: Account = Account(4);
|
||||
/// Set of test accounts with friendly names: Ferdie.
|
||||
pub const FERDIE: Account = Account(5);
|
||||
|
||||
/// A test account which can be used to sign messages.
|
||||
@@ -37,10 +42,12 @@ pub const FERDIE: Account = Account(5);
|
||||
pub struct Account(pub u16);
|
||||
|
||||
impl Account {
|
||||
/// Returns public key of this account.
|
||||
pub fn public(&self) -> VerifyingKey {
|
||||
self.pair().verifying_key()
|
||||
}
|
||||
|
||||
/// Returns key pair, used to sign data on behalf of this account.
|
||||
pub fn pair(&self) -> SigningKey {
|
||||
let data = self.0.encode();
|
||||
let mut bytes = [0_u8; 32];
|
||||
@@ -48,6 +55,7 @@ impl Account {
|
||||
SigningKey::from_bytes(&bytes)
|
||||
}
|
||||
|
||||
/// Generate a signature of given message.
|
||||
pub fn sign(&self, msg: &[u8]) -> Signature {
|
||||
use ed25519_dalek::Signer;
|
||||
self.pair().sign(msg)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
//! Utilities for testing runtime code.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use bp_header_chain::justification::{required_justification_precommits, GrandpaJustification};
|
||||
@@ -33,8 +34,11 @@ pub use keyring::*;
|
||||
|
||||
mod keyring;
|
||||
|
||||
/// GRANDPA round number used across tests.
|
||||
pub const TEST_GRANDPA_ROUND: u64 = 1;
|
||||
/// GRANDPA validators set id used across tests.
|
||||
pub const TEST_GRANDPA_SET_ID: SetId = 1;
|
||||
/// Name of the `Paras` pallet used across tests.
|
||||
pub const PARAS_PALLET_NAME: &str = "Paras";
|
||||
|
||||
/// Configuration parameters when generating test GRANDPA justifications.
|
||||
@@ -190,7 +194,7 @@ pub fn prepare_parachain_heads_proof<H: HeaderT>(
|
||||
.map_err(|_| "record_all_trie_keys has failed")
|
||||
.expect("record_all_trie_keys should not fail in benchmarks");
|
||||
|
||||
(root, ParaHeadsProof(storage_proof), parachains)
|
||||
(root, ParaHeadsProof { storage_proof }, parachains)
|
||||
}
|
||||
|
||||
/// Create signed precommit with given target.
|
||||
|
||||
Reference in New Issue
Block a user