mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
@@ -17,6 +17,7 @@
|
||||
//! Defines traits which represent a common interface for Substrate pallets which want to
|
||||
//! incorporate bridge functionality.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use crate::justification::{
|
||||
@@ -145,6 +146,7 @@ pub trait ConsensusLogReader {
|
||||
pub struct GrandpaConsensusLogReader<Number>(sp_std::marker::PhantomData<Number>);
|
||||
|
||||
impl<Number: Codec> GrandpaConsensusLogReader<Number> {
|
||||
/// Find and return scheduled (regular) change digest item.
|
||||
pub fn find_scheduled_change(
|
||||
digest: &Digest,
|
||||
) -> Option<sp_consensus_grandpa::ScheduledChange<Number>> {
|
||||
@@ -158,6 +160,8 @@ impl<Number: Codec> GrandpaConsensusLogReader<Number> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Find and return forced change digest item. Or light client can't do anything
|
||||
/// with forced changes, so we can't accept header with the forced change digest.
|
||||
pub fn find_forced_change(
|
||||
digest: &Digest,
|
||||
) -> Option<(Number, sp_consensus_grandpa::ScheduledChange<Number>)> {
|
||||
@@ -229,12 +233,17 @@ pub enum BridgeGrandpaCall<Header: HeaderT> {
|
||||
/// `pallet-bridge-grandpa::Call::submit_finality_proof`
|
||||
#[codec(index = 0)]
|
||||
submit_finality_proof {
|
||||
/// The header that we are going to finalize.
|
||||
finality_target: Box<Header>,
|
||||
/// Finality justification for the `finality_target`.
|
||||
justification: justification::GrandpaJustification<Header>,
|
||||
},
|
||||
/// `pallet-bridge-grandpa::Call::initialize`
|
||||
#[codec(index = 1)]
|
||||
initialize { init_data: InitializationData<Header> },
|
||||
initialize {
|
||||
/// All data, required to initialize the pallet.
|
||||
init_data: InitializationData<Header>,
|
||||
},
|
||||
}
|
||||
|
||||
/// The `BridgeGrandpaCall` used by a chain.
|
||||
@@ -325,12 +334,15 @@ pub fn max_expected_submit_finality_proof_arguments_size<C: ChainWithGrandpa>(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use bp_runtime::ChainId;
|
||||
use frame_support::weights::Weight;
|
||||
use sp_runtime::{testing::H256, traits::BlakeTwo256, MultiSignature};
|
||||
|
||||
struct TestChain;
|
||||
|
||||
impl Chain for TestChain {
|
||||
const ID: ChainId = *b"test";
|
||||
|
||||
type BlockNumber = u32;
|
||||
type Hash = H256;
|
||||
type Hasher = BlakeTwo256;
|
||||
|
||||
Reference in New Issue
Block a user