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

Fix elections-phragmen and proxy issue #7040

Merged
98 commits merged into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
dd4607b
Fix elections-phragmen and proxy issue
kianenigma Sep 7, 2020
6bd6221
remove TODO
kianenigma Sep 7, 2020
57de14e
Update bond to be per-vote
kianenigma Sep 8, 2020
684802e
Update frame/elections-phragmen/src/lib.rs
kianenigma Sep 9, 2020
70852fa
Fix benchmakrs
kianenigma Sep 9, 2020
4b7d0a6
Merge branch 'kiz-fix-proxy-election-drain' of github.com:paritytech/…
kianenigma Sep 9, 2020
77caa5c
Fix weight as well.
kianenigma Sep 9, 2020
06a0aa0
Add license
kianenigma Sep 9, 2020
9943042
Make weight interpreted wasm! 🤦🏻‍♂️
kianenigma Sep 9, 2020
f9bd4a3
Merge branch 'master' into kiz-fix-proxy-election-drain
gavofyork Sep 14, 2020
f9ea73a
Remove a bunch of TODOs
kianenigma Sep 14, 2020
24c416b
Add migration
kianenigma Sep 14, 2020
10e3687
Better storage version.
kianenigma Sep 14, 2020
4495ead
Functionify.
kianenigma Sep 14, 2020
3c1a2ef
Fix deposit scheme.
kianenigma Sep 17, 2020
1b95224
remove legacy bond.
kianenigma Sep 17, 2020
2c677c2
Master.into()
kianenigma Sep 17, 2020
d2ec181
Master.into()
kianenigma Sep 17, 2020
a628850
better logging.
kianenigma Sep 17, 2020
f6189d5
Fix benchmarking test
kianenigma Sep 17, 2020
e812815
Fix confused deposit collection.
kianenigma Sep 18, 2020
498376c
Add fine
kianenigma Sep 21, 2020
d9b2204
Merge branch 'master' of github.com:paritytech/substrate into kiz-fix…
kianenigma Sep 21, 2020
4691703
Merge branch 'master' of github.com:paritytech/substrate into kiz-fix…
kianenigma Sep 21, 2020
88db61d
Master.into()
kianenigma Sep 23, 2020
b4e2a7c
Master.into()
kianenigma Oct 12, 2020
c871c81
Better name for storage item
kianenigma Oct 12, 2020
12c18d5
Fix name again.
kianenigma Oct 12, 2020
f900b68
remove unused
kianenigma Oct 12, 2020
6c942b4
Update frame/elections-phragmen/src/lib.rs
kianenigma Oct 13, 2020
8e3c2eb
Update frame/elections-phragmen/src/lib.rs
kianenigma Oct 13, 2020
e674a60
Merge branch 'master' of github.com:paritytech/substrate into kiz-fix…
kianenigma Oct 13, 2020
a99bebc
Merge remote-tracking branch 'origin/master' into kiz-fix-proxy-elect…
shawntabrizi Oct 13, 2020
f5700cf
cargo run --release --features runtime-benchmarks --manifest-path bin…
shawntabrizi Oct 13, 2020
0564e59
new weight fns
kianenigma Oct 13, 2020
60d7d38
Merge branch 'kiz-fix-proxy-election-drain' of github.com:paritytech/…
kianenigma Oct 13, 2020
1b48d0d
Fix build
kianenigma Oct 13, 2020
960a474
Fix line width
kianenigma Oct 13, 2020
19e9436
fix benchmakrs
kianenigma Oct 13, 2020
76cb36f
fix warning
kianenigma Oct 13, 2020
820d76f
cargo run --release --features runtime-benchmarks --manifest-path bin…
Oct 13, 2020
4caea9f
Tune the stake again
kianenigma Oct 13, 2020
0c1043f
Merge branch 'kiz-fix-proxy-election-drain' of github.com:paritytech/…
kianenigma Oct 13, 2020
df267fa
cargo run --release --features runtime-benchmarks --manifest-path bin…
Oct 13, 2020
1621131
Merge branch 'master' of github.com:paritytech/substrate into kiz-fix…
kianenigma Oct 22, 2020
c79b522
Merge branch 'kiz-fix-proxy-election-drain' of github.com:paritytech/…
kianenigma Oct 22, 2020
50fa257
Fix builds
kianenigma Nov 17, 2020
8bd074f
All tests work again.
kianenigma Nov 18, 2020
29880e4
A large number of fixes.
kianenigma Nov 18, 2020
d78f6bb
Fix event as well.
kianenigma Nov 18, 2020
5d09983
more fixes.
kianenigma Nov 19, 2020
6668ac1
Fix node build
kianenigma Nov 19, 2020
3dd01d8
Some fixes to benchmarks
kianenigma Nov 19, 2020
694e42a
Merge remote-tracking branch 'origin/master' into kiz-fix-proxy-elect…
Nov 19, 2020
cf94f49
Fix some warnings.
kianenigma Nov 19, 2020
ea69a54
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
Nov 20, 2020
b2f36bd
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
Nov 20, 2020
1fd2b08
Update frame/elections-phragmen/src/lib.rs
kianenigma Nov 25, 2020
585e599
a batch of review comments.
kianenigma Nov 25, 2020
4b9b207
Merge branch 'kiz-fix-proxy-election-drain' of github.com:paritytech/…
kianenigma Nov 25, 2020
ea17535
Master.into()
kianenigma Nov 25, 2020
4b34e72
Fix a test.
kianenigma Nov 25, 2020
ecb0e4e
Fix some more tests.
kianenigma Nov 25, 2020
e810cc7
do migration with pallet version???
kianenigma Nov 25, 2020
e650c02
Master.into()
kianenigma Nov 25, 2020
8742865
Final touches.
kianenigma Nov 26, 2020
d6de615
Remove unused storage.
kianenigma Nov 27, 2020
6cae3da
another rounds of changes and fixes.
kianenigma Nov 30, 2020
3c0d341
Update frame/elections-phragmen/src/lib.rs
kianenigma Nov 30, 2020
3ca1590
Update frame/elections-phragmen/src/lib.rs
kianenigma Nov 30, 2020
9c9819b
Review grumbles.
kianenigma Nov 30, 2020
68ff142
Merge branch 'kiz-fix-proxy-election-drain' of github.com:paritytech/…
kianenigma Nov 30, 2020
797d04c
Fix ocnflics
kianenigma Dec 2, 2020
73a3537
Fix a bit more.
kianenigma Dec 2, 2020
98f349e
Fix build
kianenigma Dec 2, 2020
9454a68
Experimental: independent migration.
kianenigma Dec 2, 2020
c750f74
WIP: isolated migration logics
gui1117 Dec 2, 2020
e11a216
clean up.
kianenigma Dec 2, 2020
1e2c8e9
make migration struct private and move migration to own file
gui1117 Dec 3, 2020
583aa82
add doc
gui1117 Dec 3, 2020
dca4bd5
Merge remote-tracking branch 'origin/master' into kiz-fix-proxy-elect…
gui1117 Dec 3, 2020
c90d25a
Merge remote-tracking branch 'origin/master' into kiz-fix-proxy-elect…
gui1117 Dec 3, 2020
586c61c
fix StorageInstance new syntax
gui1117 Dec 3, 2020
0a0ef71
Update frame/elections-phragmen/src/migrations_3_0_0.rs
gui1117 Dec 4, 2020
a205401
Master.into()
kianenigma Dec 17, 2020
63a4c56
another round of self-review.
kianenigma Dec 17, 2020
ec067c9
bit better formatting
kianenigma Dec 17, 2020
5dab8bc
Merge remote-tracking branch 'origin/master' into kiz-fix-proxy-elect…
Dec 17, 2020
32cb6c1
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
Dec 17, 2020
38881e0
Fix tests.
kianenigma Dec 21, 2020
e4d7464
Master.into()
kianenigma Dec 21, 2020
79d1d5b
Master.into()
kianenigma Jan 19, 2021
7d95b15
Round of self-review
kianenigma Jan 20, 2021
ba12aec
Clean migrations
kianenigma Jan 20, 2021
673aed7
Merge remote-tracking branch 'origin/master' into kiz-fix-proxy-elect…
Jan 20, 2021
99f5fd2
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
Jan 20, 2021
92dbabe
Revert unwanted change to construct-runtime
kianenigma Jan 20, 2021
c688a6f
Merge branch 'kiz-fix-proxy-election-drain' of github.com:paritytech/…
kianenigma Jan 20, 2021
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
5 changes: 4 additions & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ impl pallet_collective::Trait<CouncilCollective> for Runtime {

parameter_types! {
pub const CandidacyBond: Balance = 10 * DOLLARS;
pub const VotingBondBase: Balance = 1 * DOLLARS;
pub const VotingBondFactor: Balance = 50 * CENTS; // per 32 bytes on-chain
pub const VotingBond: Balance = 1 * DOLLARS;
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
pub const TermDuration: BlockNumber = 7 * DAYS;
pub const DesiredMembers: u32 = 13;
Expand All @@ -579,7 +581,8 @@ impl pallet_elections_phragmen::Trait for Runtime {
type InitializeMembers = Council;
type CurrencyToVote = U128CurrencyToVote;
type CandidacyBond = CandidacyBond;
type VotingBond = VotingBond;
type VotingBondBase = VotingBondBase;
type VotingBondFactor = VotingBondFactor;
type LoserCandidate = ();
type BadReport = ();
type KickedMember = ();
Expand Down
20 changes: 5 additions & 15 deletions frame/elections-phragmen/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn candidate_count<T: Trait>() -> u32 {

/// Get the number of votes of a voter.
fn vote_count_of<T: Trait>(who: &T::AccountId) -> u32 {
<Voting<T>>::get(who).1.len() as u32
<Voting<T>>::get(who).votes.len() as u32
}

/// A `DefunctVoter` struct with correct value
Expand Down Expand Up @@ -103,15 +103,15 @@ fn submit_candidates_with_self_vote<T: Trait>(c: u32, prefix: &'static str)
let candidates = submit_candidates::<T>(c, prefix)?;
let stake = default_stake::<T>(BALANCE_FACTOR);
let _ = candidates.iter().map(|c|
submit_voter::<T>(c.clone(), vec![c.clone()], stake)
submit_voter::<T>(c.clone(), vec![c.clone()], stake).map(|_| ())
).collect::<Result<_, _>>()?;
Ok(candidates)
}


/// Submit one voter.
fn submit_voter<T: Trait>(caller: T::AccountId, votes: Vec<T::AccountId>, stake: BalanceOf<T>)
-> Result<(), sp_runtime::DispatchError>
-> frame_support::dispatch::DispatchResultWithPostInfo
{
<Elections<T>>::vote(RawOrigin::Signed(caller).into(), votes, stake)
}
Expand Down Expand Up @@ -242,13 +242,8 @@ benchmarks! {
let bailing_candidates = submit_candidates::<T>(v, "bailing_candidates")?;
let all_candidates = submit_candidates::<T>(c, "all_candidates")?;

// account 1 is the reporter and must be whitelisted, and a voter.
// account 1 is the reporter and must be whitelisted.
let account_1 = endowed_account::<T>("caller", 0);
submit_voter::<T>(
account_1.clone(),
all_candidates.iter().take(1).cloned().collect(),
stake,
)?;

// account 2 votes for all of the mentioned candidates.
let account_2 = endowed_account::<T>("caller_2", 1);
Expand Down Expand Up @@ -304,13 +299,8 @@ benchmarks! {
// create a bunch of candidates as well.
let all_candidates = submit_candidates::<T>(c, "candidates")?;

// account 1 is the reporter and need to be whitelisted, and a voter.
// account 1 is the reporter and need to be whitelisted.
let account_1 = endowed_account::<T>("caller", 0);
submit_voter::<T>(
account_1.clone(),
all_candidates.iter().take(1).cloned().collect(),
stake,
)?;

// account 2 votes for a bunch of crap, and finally a correct candidate.
let account_2 = endowed_account::<T>("caller_2", 1);
Expand Down
Loading