Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ resolver = "2"

[profile.production]
codegen-units = 1
features = [
"on-chain-release-build",
]
inherits = "release"
lto = true
strip = "symbols"
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ pub mod pallet {
// choose the top TotalSelected qualified candidates, ordered by stake
let collators = Self::compute_top_candidates();
if collators.is_empty() {
// SELECTION FAILED TO SELECT >=1 COLLATOR => select collators from previous round
log::error!("FAILED TO SELECT >=1 COLLATOR => using collators from previous round");
Comment thread
Garandor marked this conversation as resolved.
let last_round = now.saturating_sub(1u32);
let mut total_per_candidate: BTreeMap<T::AccountId, BalanceOf<T>> = BTreeMap::new();
// set this round AtStake to last round AtStake
Expand Down
6 changes: 6 additions & 0 deletions runtime/calamari/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,9 @@ std = [
'pallet-manta-sbt/std',
'manta-support/std',
]
# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = [
"sp-api/disable-logging",
]
6 changes: 6 additions & 0 deletions runtime/manta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,9 @@ std = [
'orml-traits/std',
'orml-xtokens/std',
]
# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = [
"sp-api/disable-logging",
]
10 changes: 9 additions & 1 deletion runtime/manta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,15 @@ impl_runtime_apis! {
// manually check aura eligibility (in the new round)
// mirrors logic in `aura_style_filter`
let truncated_half_slot = (slot >> 1) as usize;
let active: Vec<AccountId> = pallet_parachain_staking::Pallet::<Self>::compute_top_candidates();
let mut active: Vec<AccountId> = pallet_parachain_staking::Pallet::<Self>::compute_top_candidates();
if active.is_empty() {
// `SelectedCandidates` remains unchanged from last round (fallback)
active = pallet_parachain_staking::Pallet::<Self>::selected_candidates();
if active.is_empty() {
log::error!("NimbusApi::can_author found no valid authors");
return false;
}
}
account == active[truncated_half_slot % active.len()]
} else {
// We're not changing rounds, `PotentialAuthors` is not changing, just use can_author
Expand Down