mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Simplify BABE pre-digest definitions (#5289)
* Init vrf crate without type alias * Generic PreDigest definition for BABE * Fix BABE vrf interface change * Missing default-features def in sp-consensus-babe * Fix sp-consensus-babe compile * frame-babe: fix type inference * Unify type definitions of vrf output/proof and randomness * frame-babe: fix tests * Bump node impl version * Update cargo lock * Derive Copy for RawVRFOutput and RawVRFProof * Fix duplicated derive Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -9,7 +9,6 @@ homepage = "https://substrate.dev"
|
||||
repository = "https://github.com/paritytech/substrate/"
|
||||
documentation = "https://docs.rs/sc-consensus-babe"
|
||||
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "1.2.0", features = ["derive"] }
|
||||
sp-consensus-babe = { version = "0.8.0-alpha.4", path = "../../../primitives/consensus/babe" }
|
||||
@@ -32,6 +31,7 @@ sp-api = { version = "2.0.0-alpha.4", path = "../../../primitives/api" }
|
||||
sp-block-builder = { version = "2.0.0-alpha.4", path = "../../../primitives/block-builder" }
|
||||
sp-blockchain = { version = "2.0.0-alpha.4", path = "../../../primitives/blockchain" }
|
||||
sp-consensus = { version = "0.8.0-alpha.4", path = "../../../primitives/consensus/common" }
|
||||
sp-consensus-vrf = { version = "0.8.0-alpha.4", path = "../../../primitives/consensus/vrf" }
|
||||
sc-consensus-uncles = { version = "0.8.0-alpha.4", path = "../uncles" }
|
||||
sc-consensus-slots = { version = "0.8.0-alpha.4", path = "../slots" }
|
||||
sp-runtime = { version = "2.0.0-alpha.4", path = "../../../primitives/runtime" }
|
||||
|
||||
@@ -22,6 +22,7 @@ use sp_consensus_babe::{
|
||||
SlotNumber, AuthorityPair, BabeConfiguration
|
||||
};
|
||||
use sp_consensus_babe::digests::PreDigest;
|
||||
use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof};
|
||||
use sp_core::{U256, blake2_256};
|
||||
use codec::Encode;
|
||||
use schnorrkel::vrf::VRFInOut;
|
||||
@@ -201,8 +202,8 @@ fn claim_primary_slot(
|
||||
.map(|s| {
|
||||
PreDigest::Primary {
|
||||
slot_number,
|
||||
vrf_output: s.0.to_output(),
|
||||
vrf_proof: s.1,
|
||||
vrf_output: VRFOutput(s.0.to_output()),
|
||||
vrf_proof: VRFProof(s.1),
|
||||
authority_index: authority_index as u32,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Verification for BABE headers.
|
||||
use schnorrkel::vrf::{VRFOutput, VRFProof};
|
||||
use sp_runtime::{traits::Header, traits::DigestItemFor};
|
||||
use sp_core::{Pair, Public};
|
||||
use sp_consensus_babe::{AuthoritySignature, SlotNumber, AuthorityIndex, AuthorityPair, AuthorityId};
|
||||
use sp_consensus_babe::digests::{PreDigest, CompatibleDigestItem};
|
||||
use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof};
|
||||
use sc_consensus_slots::CheckedHeader;
|
||||
use log::{debug, trace};
|
||||
use super::{find_pre_digest, babe_err, Epoch, BlockT, Error};
|
||||
|
||||
Reference in New Issue
Block a user