Skip to content

Commit

Permalink
Feature/plmc 412 on initialize benchmarks (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuaniRios committed Feb 14, 2024
1 parent 4c26ce0 commit 31e30f3
Show file tree
Hide file tree
Showing 30 changed files with 3,268 additions and 1,498 deletions.
839 changes: 423 additions & 416 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate"
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" }
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" }
sp-debug-derive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" }
sp-staking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" }
Expand Down
2 changes: 1 addition & 1 deletion nodes/parachain/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use std::sync::Arc;

use sc_client_api::AuxStore;
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
pub use sc_rpc::DenyUnsafe;
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
Expand Down
6 changes: 3 additions & 3 deletions pallets/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ pub mod pallet {
if let Some((ext_proposal, _)) = NextExternal::<T>::get() {
ensure!(proposal_hash == ext_proposal.hash(), Error::<T>::ProposalMissing);
} else {
return Err(Error::<T>::NoProposal.into())
return Err(Error::<T>::NoProposal.into());
}

let mut existing_vetoers = <Blacklist<T>>::get(&proposal_hash).map(|pair| pair.1).unwrap_or_default();
Expand Down Expand Up @@ -1482,7 +1482,7 @@ impl<T: Config> Pallet<T> {
Self::transfer_metadata(MetadataOwner::External, MetadataOwner::Referendum(ref_index));
Ok(())
} else {
return Err(Error::<T>::NoneWaiting.into())
return Err(Error::<T>::NoneWaiting.into());
}
}

Expand Down Expand Up @@ -1512,7 +1512,7 @@ impl<T: Config> Pallet<T> {
}
Ok(())
} else {
return Err(Error::<T>::NoneWaiting.into())
return Err(Error::<T>::NoneWaiting.into());
}
}

Expand Down
10 changes: 5 additions & 5 deletions pallets/democracy/src/vote_threshold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ fn compare_rationals<T: Zero + Mul<T, Output = T> + Div<T, Output = T> + Rem<T,
let q1 = n1 / d1;
let q2 = n2 / d2;
if q1 < q2 {
return true
return true;
}
if q2 < q1 {
return false
return false;
}
let r1 = n1 % d1;
let r2 = n2 % d2;
if r2.is_zero() {
return false
return false;
}
if r1.is_zero() {
return true
return true;
}
n1 = d2;
n2 = d1;
Expand All @@ -85,7 +85,7 @@ impl<
let sqrt_voters = tally.turnout.integer_sqrt();
let sqrt_electorate = electorate.integer_sqrt();
if sqrt_voters.is_zero() {
return false
return false;
}
match *self {
VoteThreshold::SuperMajorityApprove =>
Expand Down
4 changes: 2 additions & 2 deletions pallets/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ impl<T: Config> Pallet<T> {

if candidates_and_deposit.len().is_zero() {
Self::deposit_event(Event::EmptyTerm);
return T::DbWeight::get().reads(3)
return T::DbWeight::get().reads(3);
}

// All of the new winners that come out of phragmen will thus have a deposit recorded.
Expand Down Expand Up @@ -921,7 +921,7 @@ impl<T: Config> Pallet<T> {
"Failed to run election. Number of voters exceeded",
);
Self::deposit_event(Event::ElectionError);
return T::DbWeight::get().reads(3 + max_voters as u64)
return T::DbWeight::get().reads(3 + max_voters as u64);
},
}

Expand Down
Loading

0 comments on commit 31e30f3

Please sign in to comment.