mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 01:41:03 +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
@@ -8,11 +8,6 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
[dependencies]
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-beefy = { path = "../beefy", default-features = false }
|
||||
bp-messages = { path = "../messages", default-features = false }
|
||||
bp-runtime = { path = "../runtime", default-features = false }
|
||||
fixed-hash = { version = "0.8.0", default-features = false }
|
||||
hash256-std-hasher = { version = "0.15.2", default-features = false }
|
||||
impl-codec = { version = "0.6", default-features = false }
|
||||
@@ -21,6 +16,13 @@ parity-util-mem = { version = "0.12.0", default-features = false, features = ["p
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||
|
||||
# Bridge Dependencies
|
||||
|
||||
bp-beefy = { path = "../beefy", default-features = false }
|
||||
bp-header-chain = { path = "../header-chain", default-features = false }
|
||||
bp-messages = { path = "../messages", default-features = false }
|
||||
bp-runtime = { path = "../runtime", default-features = false }
|
||||
|
||||
# Substrate Based Dependencies
|
||||
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
@@ -36,6 +38,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master",
|
||||
default = ["std"]
|
||||
std = [
|
||||
"bp-beefy/std",
|
||||
"bp-header-chain/std",
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"fixed-hash/std",
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
mod millau_hash;
|
||||
|
||||
use bp_beefy::ChainWithBeefy;
|
||||
use bp_header_chain::ChainWithGrandpa;
|
||||
use bp_messages::{
|
||||
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
|
||||
};
|
||||
@@ -83,6 +84,27 @@ pub const SESSION_LENGTH: BlockNumber = 5 * time_units::MINUTES;
|
||||
/// Maximal number of GRANDPA authorities at Millau.
|
||||
pub const MAX_AUTHORITIES_COUNT: u32 = 5;
|
||||
|
||||
/// Reasonable number of headers in the `votes_ancestries` on Millau 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 Millau chain.
|
||||
///
|
||||
/// See [`bp_header_chain::ChainWithGrandpa`] for more details.
|
||||
pub const AVERAGE_HEADER_SIZE_IN_JUSTIFICATION: u32 = 256;
|
||||
|
||||
/// Approximate maximal header size on Millau 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);
|
||||
|
||||
/// Re-export `time_units` to make usage easier.
|
||||
pub use time_units::*;
|
||||
|
||||
@@ -156,6 +178,15 @@ impl Chain for Millau {
|
||||
}
|
||||
}
|
||||
|
||||
impl ChainWithGrandpa for Millau {
|
||||
const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_MILLAU_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;
|
||||
}
|
||||
|
||||
impl ChainWithBeefy for Millau {
|
||||
type CommitmentHasher = Keccak256;
|
||||
type MmrHashing = Keccak256;
|
||||
|
||||
Reference in New Issue
Block a user