mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 14:31:02 +00:00
ChainWithGrandpa in primitives (#1885)
* ChainWithGrandpa in primitives * clippy ++ spelling * fix benchmarks comppilation
This commit is contained in:
committed by
Bastian Köcher
parent
914213d0af
commit
c6c39be967
@@ -10,6 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-header-chain = { path = "../header-chain", default-features = false }
|
||||
bp-messages = { path = "../messages", default-features = false }
|
||||
bp-runtime = { path = "../runtime", default-features = false }
|
||||
|
||||
@@ -25,6 +26,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", d
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-header-chain/std",
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"frame-support/std",
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// RuntimeApi generated functions
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
use bp_header_chain::ChainWithGrandpa;
|
||||
use bp_messages::{
|
||||
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
|
||||
};
|
||||
@@ -72,6 +73,27 @@ pub const SESSION_LENGTH: BlockNumber = 4;
|
||||
/// Maximal number of GRANDPA authorities at Rialto.
|
||||
pub const MAX_AUTHORITIES_COUNT: u32 = 5;
|
||||
|
||||
/// Reasonable number of headers in the `votes_ancestries` on Rialto chain.
|
||||
///
|
||||
/// See [`bp_header_chain::ChainWithGrandpa`] for more details.
|
||||
pub const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 = 8;
|
||||
|
||||
/// Approximate average header size in `votes_ancestries` field of justification on Rialto chain.
|
||||
///
|
||||
/// See [`bp_header_chain::ChainWithGrandpa`] for more details.
|
||||
pub const AVERAGE_HEADER_SIZE_IN_JUSTIFICATION: u32 = 256;
|
||||
|
||||
/// Approximate maximal header size on Rialto chain.
|
||||
///
|
||||
/// We expect maximal header to have digest item with the new authorities set for every consensus
|
||||
/// engine (GRANDPA, Babe, BEEFY, ...) - so we multiply it by 3. And also
|
||||
/// `AVERAGE_HEADER_SIZE_IN_JUSTIFICATION` bytes for other stuff.
|
||||
///
|
||||
/// See [`bp_header_chain::ChainWithGrandpa`] for more details.
|
||||
pub const MAX_HEADER_SIZE: u32 = MAX_AUTHORITIES_COUNT
|
||||
.saturating_mul(3)
|
||||
.saturating_add(AVERAGE_HEADER_SIZE_IN_JUSTIFICATION);
|
||||
|
||||
/// Maximal size of encoded `bp_parachains::ParaStoredHeaderData` structure among all Rialto
|
||||
/// parachains.
|
||||
///
|
||||
@@ -160,6 +182,15 @@ impl Chain for Rialto {
|
||||
}
|
||||
}
|
||||
|
||||
impl ChainWithGrandpa for Rialto {
|
||||
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_RIALTO_GRANDPA_PALLET_NAME;
|
||||
const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT;
|
||||
const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 =
|
||||
REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY;
|
||||
const MAX_HEADER_SIZE: u32 = MAX_HEADER_SIZE;
|
||||
const AVERAGE_HEADER_SIZE_IN_JUSTIFICATION: u32 = AVERAGE_HEADER_SIZE_IN_JUSTIFICATION;
|
||||
}
|
||||
|
||||
frame_support::parameter_types! {
|
||||
pub BlockLength: limits::BlockLength =
|
||||
limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
||||
|
||||
Reference in New Issue
Block a user