Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 0c670d8

Browse files
authored
Update BEEFY+MMR integration. (#3480)
* Update MMR leaf. * Revert to older substrate. * Add version docs. * Fix spellcheck.
1 parent 956d6ae commit 0c670d8

6 files changed

Lines changed: 81 additions & 278 deletions

File tree

Cargo.lock

Lines changed: 31 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/common/Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ serde = { version = "1.0.123", default-features = false }
1414
serde_derive = { version = "1.0.117", optional = true }
1515
static_assertions = "1.1.0"
1616

17-
beefy-primitives = { git = "https://github.com/paritytech/grandpa-bridge-gadget", branch = "master", default-features = false }
1817
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
1918
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
2019
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -36,8 +35,7 @@ pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "m
3635
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3736
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3837
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
39-
pallet-beefy = { git = "https://github.com/paritytech/grandpa-bridge-gadget", branch = "master", default-features = false }
40-
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
38+
pallet-beefy-mmr = { git = "https://github.com/paritytech/grandpa-bridge-gadget", branch = "master", default-features = false }
4139

4240
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
4341
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features=false, optional = true }
@@ -67,7 +65,6 @@ libsecp256k1 = "0.3.5"
6765
default = ["std"]
6866
no_std = []
6967
std = [
70-
"beefy-primitives/std",
7168
"bitvec/std",
7269
"parity-scale-codec/std",
7370
"log/std",
@@ -83,8 +80,7 @@ std = [
8380
"frame-support/std",
8481
"pallet-authorship/std",
8582
"pallet-balances/std",
86-
"pallet-beefy/std",
87-
"pallet-mmr/std",
83+
"pallet-beefy-mmr/std",
8884
"pallet-session/std",
8985
"pallet-staking/std",
9086
"pallet-timestamp/std",

runtime/common/src/lib.rs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub mod auctions;
2424
pub mod crowdloan;
2525
pub mod purchase;
2626
pub mod impls;
27-
pub mod mmr;
2827
pub mod paras_sudo_wrapper;
2928
pub mod paras_registrar;
3029
pub mod slot_range;
@@ -37,8 +36,7 @@ mod mock;
3736
#[cfg(test)]
3837
mod integration_tests;
3938

40-
use beefy_primitives::crypto::AuthorityId as BeefyId;
41-
use primitives::v1::{AccountId, AssignmentId, BlockNumber, ValidatorId};
39+
use primitives::v1::{AssignmentId, BlockNumber, ValidatorId};
4240
use sp_runtime::{Perquintill, Perbill, FixedPointNumber};
4341
use frame_system::limits;
4442
use frame_support::{
@@ -181,20 +179,6 @@ impl<T: pallet_session::Config> OneSessionHandler<T::AccountId> for AssignmentSe
181179
fn on_disabled(_: usize) { }
182180
}
183181

184-
/// Generates a `BeefyId` from the given `AccountId`. The resulting `BeefyId` is
185-
/// a dummy value and this is a utility function meant to be used when migration
186-
/// session keys.
187-
pub fn dummy_beefy_id_from_account_id(a: AccountId) -> BeefyId {
188-
let mut id = BeefyId::default();
189-
let id_raw: &mut [u8] = id.as_mut();
190-
191-
// NOTE: AccountId is 32 bytes, whereas BeefyId is 33 bytes.
192-
id_raw[1..].copy_from_slice(a.as_ref());
193-
id_raw[0..4].copy_from_slice(b"beef");
194-
195-
id
196-
}
197-
198182
#[cfg(test)]
199183
mod multiplier_tests {
200184
use super::*;
@@ -297,15 +281,4 @@ mod multiplier_tests {
297281
println!("block = {} multiplier {:?}", blocks, multiplier);
298282
}
299283
}
300-
301-
#[test]
302-
fn generate_dummy_unique_beefy_id_from_account_id() {
303-
let acc1 = AccountId::new([0; 32]);
304-
let acc2 = AccountId::new([1; 32]);
305-
306-
let beefy_id1 = dummy_beefy_id_from_account_id(acc1);
307-
let beefy_id2 = dummy_beefy_id_from_account_id(acc2);
308-
309-
assert_ne!(beefy_id1, beefy_id2);
310-
}
311284
}

runtime/common/src/mmr.rs

Lines changed: 0 additions & 226 deletions
This file was deleted.

0 commit comments

Comments
 (0)