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

Recursive election provider as fallback #9648

Merged
14 commits merged into from
Sep 12, 2021
Prev Previous commit
Next Next commit
Fix test
kianenigma committed Sep 1, 2021
commit f2fa5572dbaf412364076c6e5628884ffb540465
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion frame/election-provider-support/Cargo.toml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ frame-system = { version = "4.0.0-dev", default-features = false, path = "../sys
sp-npos-elections = { version = "4.0.0-dev", path = "../../primitives/npos-elections" }
sp-runtime = { version = "4.0.0-dev", path = "../../primitives/runtime" }
sp-core = { version = "4.0.0-dev", path = "../../primitives/core" }
frame-support-test = { version = "3.0.0", path = "../support/test" }
sp-io = { version = "4.0.0-dev", path = "../../primitives/io" }

[features]
default = ["std"]
18 changes: 10 additions & 8 deletions frame/election-provider-support/src/onchain.rs
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ mod tests {
type BlockLength = ();
type BlockWeights = ();
type Version = ();
type PalletInfo = frame_support_test::PanicPalletInfo;
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -185,12 +185,14 @@ mod tests {

#[test]
fn onchain_seq_phragmen_works() {
assert_eq!(
OnChainPhragmen::elect().unwrap(),
vec![
(10, Support { total: 25, voters: vec![(1, 10), (3, 15)] }),
(30, Support { total: 35, voters: vec![(2, 20), (3, 15)] })
]
);
sp_io::TestExternalities::new_empty().execute_with(|| {
assert_eq!(
OnChainPhragmen::elect().unwrap(),
vec![
(10, Support { total: 25, voters: vec![(1, 10), (3, 15)] }),
(30, Support { total: 35, voters: vec![(2, 20), (3, 15)] })
]
);
})
}
}