Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BEEFY finality pallet with basic functionality #1606

Merged
merged 8 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
396 changes: 223 additions & 173 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions bin/rialto/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ bp-relayers = { path = "../../../primitives/relayers", default-features = false
bp-rialto = { path = "../../../primitives/chain-rialto", default-features = false }
bp-runtime = { path = "../../../primitives/runtime", default-features = false }
bridge-runtime-common = { path = "../../runtime-common", default-features = false }
pallet-bridge-beefy = { path = "../../../modules/beefy", default-features = false }
pallet-bridge-grandpa = { path = "../../../modules/grandpa", default-features = false }
pallet-bridge-messages = { path = "../../../modules/messages", default-features = false }
pallet-bridge-relayers = { path = "../../../modules/relayers", default-features = false }
Expand Down Expand Up @@ -99,6 +100,7 @@ std = [
"pallet-balances/std",
"pallet-beefy/std",
"pallet-beefy-mmr/std",
"pallet-bridge-beefy/std",
"pallet-bridge-grandpa/std",
"pallet-bridge-messages/std",
"pallet-bridge-relayers/std",
Expand Down
11 changes: 11 additions & 0 deletions bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub use frame_support::{

pub use frame_system::Call as SystemCall;
pub use pallet_balances::Call as BalancesCall;
pub use pallet_bridge_beefy::Call as BridgeBeefyCall;
pub use pallet_bridge_grandpa::Call as BridgeGrandpaCall;
pub use pallet_bridge_messages::Call as MessagesCall;
pub use pallet_sudo::Call as SudoCall;
Expand Down Expand Up @@ -487,6 +488,13 @@ impl pallet_bridge_messages::Config<WithMillauMessagesInstance> for Runtime {
type BridgedChainId = BridgedChainId;
}

pub type MillauBeefyInstance = ();
impl pallet_bridge_beefy::Config<MillauBeefyInstance> for Runtime {
type MaxRequests = frame_support::traits::ConstU32<16>;
type CommitmentsToKeep = frame_support::traits::ConstU32<8>;
type BridgedChain = bp_millau::Millau;
}

construct_runtime!(
pub enum Runtime where
Block = Block,
Expand Down Expand Up @@ -519,6 +527,9 @@ construct_runtime!(
BridgeMillauGrandpa: pallet_bridge_grandpa::{Pallet, Call, Storage},
BridgeMillauMessages: pallet_bridge_messages::{Pallet, Call, Storage, Event<T>, Config<T>},

// Millau bridge modules (BEEFY based).
BridgeMillauBeefy: pallet_bridge_beefy::{Pallet, Call, Storage},

// Parachain modules.
ParachainsOrigin: polkadot_runtime_parachains::origin::{Pallet, Origin},
Configuration: polkadot_runtime_parachains::configuration::{Pallet, Call, Storage, Config<T>},
Expand Down
54 changes: 54 additions & 0 deletions modules/beefy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[package]
name = "pallet-bridge-beefy"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
log = { version = "0.4.14", default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
serde = { version = "1.0", optional = true }

# Bridge Dependencies

bp-beefy = { path = "../../primitives/beefy", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }

# Substrate Dependencies

beefy-merkle-tree = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
primitive-types = { version = "0.12.0", default-features = false, features = ["impl-codec"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

[dev-dependencies]
beefy-primitives = { git = "https://github.com/paritytech/substrate", branch = "master" }
mmr-lib = { package = "ckb-merkle-mountain-range", version = "0.3.2" }
pallet-beefy-mmr = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master" }
rand = "0.8"
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
bp-test-utils = { path = "../../primitives/test-utils" }

[features]
default = ["std"]
std = [
"beefy-merkle-tree/std",
"bp-beefy/std",
"bp-runtime/std",
"codec/std",
"frame-support/std",
"frame-system/std",
"log/std",
"primitive-types/std",
"scale-info/std",
"serde",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
]
Loading