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

Fix Block Producer Selection #818

Merged
merged 8 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from 7 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
9 changes: 4 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ cumulus-relay-chain-interface = { git = 'https://github.com/paritytech/cumulus.g
cumulus-relay-chain-rpc-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.26" }

# Nimbus dependencies
nimbus-consensus = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0" }
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0" }
pallet-author-inherent = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0" }
nimbus-consensus = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1" }
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1" }
pallet-author-inherent = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1" }

# Polkadot dependencies
polkadot-cli = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.26" }
Expand Down
2 changes: 1 addition & 1 deletion pallets/collator-selection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ serde = { version = "1.0.140", default-features = false }
frame-benchmarking = { git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "polkadot-v0.9.26", optional = true }
frame-support = { git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "polkadot-v0.9.26" }
frame-system = { git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "polkadot-v0.9.26" }
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1", default-features = false }
pallet-authorship = { git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "polkadot-v0.9.26" }
pallet-session = { git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "polkadot-v0.9.26" }
sp-arithmetic = { git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "polkadot-v0.9.26" }
Expand Down
2 changes: 1 addition & 1 deletion pallets/manta-pay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ pub mod pallet {
}
}
(
VoidNumberSetInsertionOrder::<T>::contains_key(max_sender_index as u64),
VoidNumberSetInsertionOrder::<T>::contains_key(max_sender_index),
senders,
)
}
Expand Down
4 changes: 0 additions & 4 deletions pallets/parachain-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "po
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26", default-features = false }
substrate-fixed = { git = "https://github.com/Manta-Network/substrate-fixed.git", tag = "v0.5.9", default-features = false }

# Nimbus
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }

# Manta
manta-primitives = { path = '../../primitives/manta', default-features = false }
# TODO: remove after whitelist period
Expand Down Expand Up @@ -54,7 +51,6 @@ std = [
"log/std",
"manta-primitives/std",
"manta-collator-selection/std",
"nimbus-primitives/std",
'pallet-session/std',
"parity-scale-codec/std",
"scale-info/std",
Expand Down
27 changes: 1 addition & 26 deletions pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,38 +1830,13 @@ pub mod pallet {
}
}

impl<T> nimbus_primitives::CanAuthor<T::AccountId> for Pallet<T>
where
T: Config + manta_collator_selection::Config,
manta_collator_selection::Pallet<T>:
nimbus_primitives::CanAuthor<T::AccountId> + Get<Vec<T::AccountId>>,
{
fn can_author(account: &T::AccountId, _slot: &u32) -> bool {
// Migration specifics: If we have no eligible block producers yet, use the old selection method
if Self::selected_candidates().is_empty() {
manta_collator_selection::Pallet::<T>::can_author(account, _slot)
} else {
Self::is_selected_candidate(account)
}
}
#[cfg(feature = "runtime-benchmarks")]
fn get_authors(_slot: &u32) -> Vec<T::AccountId> {
Self::get()
}
}

impl<T> Get<Vec<T::AccountId>> for Pallet<T>
where
T: Config + manta_collator_selection::Config,
manta_collator_selection::Pallet<T>: Get<Vec<T::AccountId>>,
{
fn get() -> Vec<T::AccountId> {
// Migration specifics: If we have no eligible block producers yet, use the old selection method
if Self::selected_candidates().is_empty() {
manta_collator_selection::Pallet::<T>::get()
} else {
Self::selected_candidates()
}
Self::selected_candidates()
}
}
}
4 changes: 2 additions & 2 deletions primitives/session-keys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ version = "3.4.0"

[dependencies]
manta-primitives = { path = "../manta", default-features = false }
# `manta-v3.3.0` is a temporary branch until the official v0.9.26 Nimbus release.
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }
# `manta-v3.4.1` is a temporary branch until the official v0.9.26 Nimbus release.
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1", default-features = false }
parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive"] }
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
sp-application-crypto = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26", default-features = false }
Expand Down
9 changes: 5 additions & 4 deletions runtime/calamari/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ cumulus-primitives-utility = { git = 'https://github.com/paritytech/cumulus.git'
parachain-info = { git = 'https://github.com/paritytech/cumulus.git', default-features = false, branch = "polkadot-v0.9.26" }

# Nimbus Dependencies
# `manta-v3.3.0` is a temporary branch until the official v0.9.26 Nimbus release.
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }
pallet-aura-style-filter = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }
pallet-author-inherent = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }
# `manta-v3.4.1` is a temporary branch until the official v0.9.26 Nimbus release.
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1", default-features = false }
pallet-aura-style-filter = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1", default-features = false }
pallet-author-inherent = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1", default-features = false }

# Polkadot dependencies
pallet-xcm = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.26" }
Expand Down Expand Up @@ -122,6 +122,7 @@ runtime-benchmarks = [
'frame-system/runtime-benchmarks',
'manta-collator-selection/runtime-benchmarks',
'nimbus-primitives/runtime-benchmarks',
'pallet-aura-style-filter/runtime-benchmarks',
'pallet-author-inherent/runtime-benchmarks',
'pallet-balances/runtime-benchmarks',
'pallet-multisig/runtime-benchmarks',
Expand Down
2 changes: 1 addition & 1 deletion runtime/calamari/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ impl pallet_author_inherent::Config for Runtime {
type WeightInfo = weights::pallet_author_inherent::SubstrateWeight<Runtime>;
/// Nimbus filter pipeline step 1:
/// Filters out NimbusIds not registered as SessionKeys of some AccountId
type CanAuthor = ParachainStaking;
type CanAuthor = AuraAuthorFilter;
}

parameter_types! {
Expand Down
8 changes: 4 additions & 4 deletions runtime/dolphin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ cumulus-primitives-utility = { git = 'https://github.com/paritytech/cumulus.git'
parachain-info = { git = 'https://github.com/paritytech/cumulus.git', default-features = false, branch = "polkadot-v0.9.26" }

# Nimbus Dependencies
# `manta-v3.3.0` is a temporary branch until the official v0.9.26 Nimbus release.
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }
pallet-aura-style-filter = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }
pallet-author-inherent = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.3.0", default-features = false }
# `manta-v3.4.1` is a temporary branch until the official v0.9.26 Nimbus release.
nimbus-primitives = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1", default-features = false }
pallet-aura-style-filter = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1", default-features = false }
pallet-author-inherent = { git = "https://github.com/manta-network/nimbus.git", branch = "manta-v3.4.1", default-features = false }

# Polkadot dependencies
pallet-xcm = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.26" }
Expand Down