Generalised proxies (#6156)

* Initial work

* It should work

* Fix node

* Fix tests

* Initial test

* Tests

* Expunge proxy functionality from democracy and elections

* Allow different proxy types

* Repotted

* Build

* Build

* Making a start on weights

* Undo breaking change

* Line widths.

* Fix

* fix tests

* finish benchmarks?

* Storage name!

* Utility -> Proxy

* proxy weight

* add proxy weight

* remove weights

* Update transfer constraint

* Again, fix constraints

* Fix negation

* Update frame/proxy/Cargo.toml

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Remove unneeded event.

* Grumbles

* Apply suggestions from code review

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Gavin Wood
2020-06-02 18:15:15 +02:00
committed by GitHub
parent ffea161765
commit 4adac40c07
20 changed files with 724 additions and 738 deletions
-39
View File
@@ -868,45 +868,6 @@ fn election_voting_should_work() {
});
}
#[test]
fn election_proxy_voting_should_work() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(Elections::submit_candidacy(Origin::signed(5), 0));
<Proxy<Test>>::insert(11, 1);
<Proxy<Test>>::insert(12, 2);
<Proxy<Test>>::insert(13, 3);
<Proxy<Test>>::insert(14, 4);
assert_ok!(
Elections::proxy_set_approvals(Origin::signed(11), vec![true], 0, 0, 10)
);
assert_ok!(
Elections::proxy_set_approvals(Origin::signed(14), vec![true], 0, 1, 40)
);
assert_eq!(Elections::all_approvals_of(&1), vec![true]);
assert_eq!(Elections::all_approvals_of(&4), vec![true]);
assert_eq!(voter_ids(), vec![1, 4]);
assert_ok!(Elections::submit_candidacy(Origin::signed(2), 1));
assert_ok!(Elections::submit_candidacy(Origin::signed(3), 2));
assert_ok!(
Elections::proxy_set_approvals(Origin::signed(12), vec![false, true], 0, 2, 20)
);
assert_ok!(
Elections::proxy_set_approvals(Origin::signed(13), vec![false, true], 0, 3, 30)
);
assert_eq!(Elections::all_approvals_of(&1), vec![true]);
assert_eq!(Elections::all_approvals_of(&4), vec![true]);
assert_eq!(Elections::all_approvals_of(&2), vec![false, true]);
assert_eq!(Elections::all_approvals_of(&3), vec![false, true]);
assert_eq!(voter_ids(), vec![1, 4, 2, 3]);
});
}
#[test]
fn election_simple_tally_should_work() {
ExtBuilder::default().build().execute_with(|| {