Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #68 from Manta-Network/ghzlatarev/polkadot-v0.9.24
Browse files Browse the repository at this point in the history
Bump to polkadot-v0.9.24
  • Loading branch information
librelois committed Jul 18, 2022
2 parents bc69018 + f154d70 commit 9c31c56
Show file tree
Hide file tree
Showing 17 changed files with 1,614 additions and 1,852 deletions.
3,074 changes: 1,418 additions & 1,656 deletions Cargo.lock

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions nimbus-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ edition = "2021"
version = "0.9.0"
[dependencies]
# Substrate deps
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }

# Polkadot dependencies
polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.24", default-features = false }

# Cumulus dependencies
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "master" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" }

# Nimbus Dependencies
nimbus-primitives = { path = "../nimbus-primitives" }
Expand All @@ -34,6 +34,6 @@ nimbus-primitives = { path = "../nimbus-primitives" }
async-trait = "0.1.42"
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
futures = { version = "0.3.8", features = [ "compat" ] }
log = "0.4"
log = "0.4.17"
parking_lot = "0.12"
tracing = "0.1.22"
16 changes: 8 additions & 8 deletions nimbus-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ version = "0.9.0"
async-trait = { version = "0.1", optional = true }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }

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 }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
scale-info = { version = "2.0.0", default-features = false, features = [ "derive" ] }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-inherents = { 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 }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }

frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true, default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", optional = true, default-features = false }

[features]
default = [ "std" ]
Expand Down
10 changes: 5 additions & 5 deletions pallets/aura-style-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ edition = "2021"
version = "0.9.0"

[dependencies]
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 }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
nimbus-primitives = { path = "../../nimbus-primitives", default-features = false }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.0.0", default-features = false, features = [ "derive" ] }
serde = { version = "1.0.101", optional = true, features = [ "derive" ] }
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 }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }

[features]
default = [ "std" ]
Expand Down
27 changes: 14 additions & 13 deletions pallets/author-inherent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ license = "GPL-3.0-only"
version = "0.9.0"

[dependencies]
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 }
log = { version = "0.4", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
log = { version = "0.4.17", default-features = false }
nimbus-primitives = { path = "../../nimbus-primitives", default-features = false }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.0.0", default-features = false, features = [ "derive" ] }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-inherents = { 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 }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }

# Benchmarks
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true, default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", optional = true, default-features = false }

[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-support-test = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
frame-support-test = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }

[features]
default = [ "std" ]
Expand All @@ -50,3 +50,4 @@ runtime-benchmarks = [
"frame-benchmarking",
"nimbus-primitives/runtime-benchmarks",
]

6 changes: 3 additions & 3 deletions pallets/author-inherent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ pub mod pallet {
let digest = <frame_system::Pallet<T>>::digest();

let pre_runtime_digests = digest.logs.iter().filter_map(|d| d.as_pre_runtime());
Self::find_author(pre_runtime_digests).map(|author_account| {
if let Some(author_account) = Self::find_author(pre_runtime_digests) {
// Store the author so we can confirm eligibility after the inherents have executed
<Author<T>>::put(&author_account);

//TODO, should we reuse the same trait that Pallet Authorship uses?
// Notify any other pallets that are listening (eg rewards) about the author
T::EventHandler::note_author(author_account);
});
}

T::DbWeight::get().write * 2
}
Expand Down Expand Up @@ -208,7 +208,7 @@ pub mod pallet {
/// can ask this pallet directly. It will do the mapping for you.
impl<T: Config> CanAuthor<NimbusId> for Pallet<T> {
fn can_author(author: &NimbusId, slot: &u32) -> bool {
let account = match T::AccountLookup::lookup_account(&author) {
let account = match T::AccountLookup::lookup_account(author) {
Some(account) => account,
// Authors whose account lookups fail will not be eligible
None => {
Expand Down
18 changes: 9 additions & 9 deletions pallets/author-slot-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ edition = "2021"
version = "0.9.0"

[dependencies]
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 }
log = { version = "0.4", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
log = { version = "0.4.17", default-features = false }
nimbus-primitives = { path = "../../nimbus-primitives", default-features = false }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.0.0", default-features = false, features = [ "derive" ] }
serde = { version = "1.0.101", default-features = false, features = [ "derive" ] }
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 }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", default-features = false }

# Benchmarks
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true, default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24", optional = true, default-features = false }

[dev-dependencies]
frame-support-test = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master"}
frame-support-test = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24"}

[features]
default = [ "std" ]
Expand Down
7 changes: 4 additions & 3 deletions pallets/author-slot-filter/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ where
let old_value = <Pallet<T>>::eligible_ratio();
let total_authors = <T as Config>::PotentialAuthors::get().len();
let new_value = percent_of_num(old_value, total_authors as u32);
let new_value = NonZeroU32::new(new_value).unwrap_or(EligibilityValue::default());
let new_value = NonZeroU32::new(new_value).unwrap_or_else(EligibilityValue::default);
<EligibleCount<T>>::put(new_value);

T::DbWeight::get().reads_writes(1, 1)
Expand All @@ -53,7 +53,7 @@ where

let total_authors = <T as Config>::PotentialAuthors::get().len();
let new_value = percent_of_num(old_value, total_authors as u32);
let expected_value = NonZeroU32::new(new_value).unwrap_or(EligibilityValue::default());
let expected_value = NonZeroU32::new(new_value).unwrap_or_else(EligibilityValue::default);

Self::set_temp_storage(expected_value, "expected_eligible_count");

Expand All @@ -62,7 +62,8 @@ where

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
let expected = Self::get_temp_storage::<NonZeroU32>("expected_eligible_count");
let expected = Self::get_temp_storage::<NonZeroU32>("expected_eligible_count")
.expect("value must exist");
let actual = Some(<Pallet<T>>::eligible_count());

assert_eq!(expected, actual);
Expand Down
1 change: 0 additions & 1 deletion pallets/author-slot-filter/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use frame_support::sp_io;
use frame_support::traits::ConstU32;
use frame_support::weights::RuntimeDbWeight;
use frame_support_test::TestRandomness;
use frame_system;
use sp_core::H256;
use sp_runtime::{
testing::Header,
Expand Down
7 changes: 3 additions & 4 deletions pallets/author-slot-filter/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ fn test_migration_works_for_converting_existing_eligible_ratio_to_eligible_count
new_test_ext().execute_with(|| {
let input_eligible_ratio = Percent::from_percent(50);
let total_author_count = mock::Authors::get().len();
let eligible_author_count =
input_eligible_ratio.clone().mul_ceil(total_author_count) as u32;
let eligible_author_count = input_eligible_ratio.mul_ceil(total_author_count) as u32;
let expected_eligible_count = NonZeroU32::new_unchecked(eligible_author_count);
let expected_weight = TestDbWeight::get().write + TestDbWeight::get().read;

<EligibleRatio<Test>>::put(input_eligible_ratio.clone());
<EligibleRatio<Test>>::put(input_eligible_ratio);

let actual_weight = migration::EligibleRatioToEligiblityCount::<Test>::on_runtime_upgrade();
assert_eq!(expected_weight, actual_weight);
Expand All @@ -66,7 +65,7 @@ fn test_migration_works_for_converting_existing_zero_eligible_ratio_to_default_e
let expected_eligible_count = EligibilityValue::default();
let expected_weight = TestDbWeight::get().write + TestDbWeight::get().read;

<EligibleRatio<Test>>::put(input_eligible_ratio.clone());
<EligibleRatio<Test>>::put(input_eligible_ratio);

let actual_weight = migration::EligibleRatioToEligiblityCount::<Test>::on_runtime_upgrade();
assert_eq!(expected_weight, actual_weight);
Expand Down

0 comments on commit 9c31c56

Please sign in to comment.