mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 03:27:58 +00:00
* Companion for substrate #13889 * Remove leftover * Remove removed dependency * Remove sp-consensus-vrf from lock * Revert "Remove sp-consensus-vrf from lock" This reverts commit 2269ca1e32df89272e8fd4544292204db387f436. * Fix after substrate modifications * Fix tests to use new VRF Signature type * Don't rely of Deref trait * Fix test * Further code simplification * Reuse garbage_vrf_signature * update lockfile for {"substrate"} --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -17,15 +17,16 @@
|
||||
use super::{relay_chain_selection::*, *};
|
||||
|
||||
use futures::channel::oneshot::Receiver;
|
||||
use polkadot_node_primitives::approval::{VRFOutput, VRFProof};
|
||||
use polkadot_node_primitives::approval::VrfSignature;
|
||||
use polkadot_node_subsystem::messages::{AllMessages, BlockDescription};
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_test_client::Sr25519Keyring;
|
||||
use sp_consensus_babe::{
|
||||
digests::{CompatibleDigestItem, PreDigest, SecondaryVRFPreDigest},
|
||||
Transcript,
|
||||
VrfTranscript,
|
||||
};
|
||||
use sp_core::{crypto::VrfSigner, testing::TaskExecutor};
|
||||
use sp_runtime::{testing::*, DigestItem};
|
||||
use std::{
|
||||
collections::{BTreeMap, HashMap, HashSet},
|
||||
@@ -74,7 +75,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
|
||||
.filter_level(log::LevelFilter::Trace)
|
||||
.try_init();
|
||||
|
||||
let pool = sp_core::testing::TaskExecutor::new();
|
||||
let pool = TaskExecutor::new();
|
||||
let (mut context, virtual_overseer) = test_helpers::make_subsystem_context(pool);
|
||||
|
||||
let (finality_target_tx, finality_target_rx) = oneshot::channel::<Option<Hash>>();
|
||||
@@ -129,12 +130,9 @@ async fn overseer_recv_with_timeout(
|
||||
const TIMEOUT: Duration = Duration::from_millis(2000);
|
||||
|
||||
// used for generating assignments where the validity of the VRF doesn't matter.
|
||||
fn garbage_vrf() -> (VRFOutput, VRFProof) {
|
||||
let key = Sr25519Keyring::Alice.pair();
|
||||
let key = key.as_ref();
|
||||
|
||||
let (o, p, _) = key.vrf_sign(Transcript::new(b"test-garbage"));
|
||||
(VRFOutput(o.to_output()), VRFProof(p))
|
||||
fn garbage_vrf_signature() -> VrfSignature {
|
||||
let transcript = VrfTranscript::new(b"test-garbage", &[]);
|
||||
Sr25519Keyring::Alice.pair().vrf_sign(&transcript)
|
||||
}
|
||||
|
||||
/// Representation of a local representation
|
||||
@@ -316,13 +314,12 @@ impl ChainBuilder {
|
||||
fn make_header(parent_hash: Hash, number: u32) -> Header {
|
||||
let digest = {
|
||||
let mut digest = Digest::default();
|
||||
let (vrf_output, vrf_proof) = garbage_vrf();
|
||||
let vrf_signature = garbage_vrf_signature();
|
||||
digest.push(DigestItem::babe_pre_digest(PreDigest::SecondaryVRF(
|
||||
SecondaryVRFPreDigest {
|
||||
authority_index: 0,
|
||||
slot: 1.into(), // slot, unused
|
||||
vrf_output,
|
||||
vrf_proof,
|
||||
vrf_signature,
|
||||
},
|
||||
)));
|
||||
digest
|
||||
|
||||
Reference in New Issue
Block a user