mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
Remove pallet::without_storage_info from bridge GRANDPA pallet (#1478)
* remove pallet::without_storage_info from bridge GRANDPA pallet * StoredBridgedHeader * spelling * fix benchmarks * MAX_BRIDGED_AUTHORITIES: 256 -> 2048 * Update modules/grandpa/src/storage_types.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * Update modules/grandpa/src/storage_types.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * moved max authorities + header size to chain primitives * removed unused code * new -> try_new * fix benchmarks compilation Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
6f9bda5db0
commit
f38852f661
@@ -109,6 +109,12 @@ pub const PAY_INBOUND_DISPATCH_FEE_WEIGHT: Weight = 700_000_000;
|
||||
/// conditions.
|
||||
pub const SESSION_LENGTH: BlockNumber = 5 * time_units::MINUTES;
|
||||
|
||||
/// Maximal number of GRANDPA authorities at Millau.
|
||||
pub const MAX_AUTHORITIES_COUNT: u32 = 5;
|
||||
|
||||
/// Maximal SCALE-encoded header size (in bytes) at Millau.
|
||||
pub const MAX_HEADER_SIZE: u32 = 512;
|
||||
|
||||
/// Re-export `time_units` to make usage easier.
|
||||
pub use time_units::*;
|
||||
|
||||
|
||||
@@ -100,6 +100,12 @@ pub const PAY_INBOUND_DISPATCH_FEE_WEIGHT: Weight = 700_000_000;
|
||||
/// conditions.
|
||||
pub const SESSION_LENGTH: BlockNumber = 4;
|
||||
|
||||
/// Maximal number of GRANDPA authorities at Rialto.
|
||||
pub const MAX_AUTHORITIES_COUNT: u32 = 5;
|
||||
|
||||
/// Maximal SCALE-encoded header size (in bytes) at Rialto.
|
||||
pub const MAX_HEADER_SIZE: u32 = 512;
|
||||
|
||||
/// Re-export `time_units` to make usage easier.
|
||||
pub use time_units::*;
|
||||
|
||||
|
||||
@@ -58,6 +58,18 @@ pub const WITH_WESTEND_BRIDGE_PARAS_PALLET_NAME: &str = "BridgeWestendParachains
|
||||
/// conditions.
|
||||
pub const SESSION_LENGTH: BlockNumber = 10 * time_units::MINUTES;
|
||||
|
||||
/// Maximal number of GRANDPA authorities at Westend.
|
||||
///
|
||||
/// Corresponds to the `MaxAuthorities` constant value from the Westend runtime configuration.
|
||||
pub const MAX_AUTHORITIES_COUNT: u32 = 100_000;
|
||||
|
||||
/// Maximal SCALE-encoded header size (in bytes) at Westend.
|
||||
///
|
||||
/// Let's assume that the largest header is header that enacts new authorities set with
|
||||
/// `MAX_AUTHORITES_COUNT`. Every authority means 32-byte key and 8-byte weight. Let's also have
|
||||
/// some fixed reserve for other things (digest, block hash and number, ...) as well.
|
||||
pub const MAX_HEADER_SIZE: u32 = 4096 + MAX_AUTHORITIES_COUNT * 40;
|
||||
|
||||
/// Identifier of Westmint parachain at the Westend relay chain.
|
||||
pub const WESTMINT_PARACHAIN_ID: u32 = 2000;
|
||||
|
||||
|
||||
@@ -71,47 +71,6 @@ pub struct InitializationData<H: HeaderT> {
|
||||
pub operating_mode: BasicOperatingMode,
|
||||
}
|
||||
|
||||
/// base trait for verifying transaction inclusion proofs.
|
||||
pub trait InclusionProofVerifier {
|
||||
/// Transaction type.
|
||||
type Transaction: Parameter;
|
||||
/// Transaction inclusion proof type.
|
||||
type TransactionInclusionProof: Parameter;
|
||||
|
||||
/// Verify that transaction is a part of given block.
|
||||
///
|
||||
/// Returns Some(transaction) if proof is valid and None otherwise.
|
||||
fn verify_transaction_inclusion_proof(
|
||||
proof: &Self::TransactionInclusionProof,
|
||||
) -> Option<Self::Transaction>;
|
||||
}
|
||||
|
||||
/// A trait for pallets which want to keep track of finalized headers from a bridged chain.
|
||||
pub trait HeaderChain<H, E> {
|
||||
/// Get the best finalized header known to the header chain.
|
||||
fn best_finalized() -> Option<H>;
|
||||
|
||||
/// Get the best authority set known to the header chain.
|
||||
fn authority_set() -> AuthoritySet;
|
||||
|
||||
/// Write a header finalized by GRANDPA to the underlying pallet storage.
|
||||
fn append_header(header: H) -> Result<(), E>;
|
||||
}
|
||||
|
||||
impl<H: Default, E> HeaderChain<H, E> for () {
|
||||
fn best_finalized() -> Option<H> {
|
||||
None
|
||||
}
|
||||
|
||||
fn authority_set() -> AuthoritySet {
|
||||
AuthoritySet::default()
|
||||
}
|
||||
|
||||
fn append_header(_header: H) -> Result<(), E> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Abstract finality proof that is justifying block finality.
|
||||
pub trait FinalityProof<Number>: Clone + Send + Sync + Debug {
|
||||
/// Return number of header that this proof is generated for.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::HeaderIdProvider;
|
||||
use codec::{Decode, Encode};
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use frame_support::{weights::Weight, Parameter};
|
||||
use num_traits::{AsPrimitive, Bounded, CheckedSub, Saturating, SaturatingAdd, Zero};
|
||||
use sp_runtime::{
|
||||
@@ -111,6 +111,7 @@ pub trait Chain: Send + Sync + 'static {
|
||||
+ AsPrimitive<usize>
|
||||
+ Default
|
||||
+ Saturating
|
||||
+ MaxEncodedLen
|
||||
// original `sp_runtime::traits::Header::BlockNumber` doesn't have this trait, but
|
||||
// `sp_runtime::generic::Era` requires block number -> `u64` conversion.
|
||||
+ Into<u64>;
|
||||
@@ -130,7 +131,8 @@ pub trait Chain: Send + Sync + 'static {
|
||||
+ SimpleBitOps
|
||||
+ AsRef<[u8]>
|
||||
+ AsMut<[u8]>
|
||||
+ MaybeMallocSizeOf;
|
||||
+ MaybeMallocSizeOf
|
||||
+ MaxEncodedLen;
|
||||
|
||||
/// A type that fulfills the abstract idea of what a Substrate hasher (a type
|
||||
/// that produces hashes) is.
|
||||
@@ -148,7 +150,13 @@ pub trait Chain: Send + Sync + 'static {
|
||||
+ MaybeSerializeDeserialize;
|
||||
|
||||
/// The user account identifier type for the runtime.
|
||||
type AccountId: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + Ord;
|
||||
type AccountId: Parameter
|
||||
+ Member
|
||||
+ MaybeSerializeDeserialize
|
||||
+ Debug
|
||||
+ MaybeDisplay
|
||||
+ Ord
|
||||
+ MaxEncodedLen;
|
||||
/// Balance of an account in native tokens.
|
||||
///
|
||||
/// The chain may support multiple tokens, but this particular type is for token that is used
|
||||
@@ -165,7 +173,8 @@ pub trait Chain: Send + Sync + 'static {
|
||||
+ PartialOrd
|
||||
+ SaturatingAdd
|
||||
+ Zero
|
||||
+ TryFrom<sp_core::U256>;
|
||||
+ TryFrom<sp_core::U256>
|
||||
+ MaxEncodedLen;
|
||||
/// Index of a transaction used by the chain.
|
||||
type Index: Parameter
|
||||
+ Member
|
||||
@@ -175,7 +184,8 @@ pub trait Chain: Send + Sync + 'static {
|
||||
+ MaybeDisplay
|
||||
+ MaybeSerializeDeserialize
|
||||
+ AtLeast32Bit
|
||||
+ Copy;
|
||||
+ Copy
|
||||
+ MaxEncodedLen;
|
||||
/// Signature type, used on this chain.
|
||||
type Signature: Parameter + Verify;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user