Skip to content

Commit

Permalink
Add BEEFY finality pallet with basic functionality (paritytech#1606)
Browse files Browse the repository at this point in the history
* pallet-bridge-beefy: initial commit
  • Loading branch information
serban300 committed Apr 9, 2024
1 parent 1a35c6d commit db3df84
Show file tree
Hide file tree
Showing 11 changed files with 1,813 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bridges/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 @@ -98,6 +99,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 bridges/bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,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 @@ -474,6 +475,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 @@ -506,6 +514,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 bridges/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 <[email protected]>"]
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

0 comments on commit db3df84

Please sign in to comment.