From a8f91d181f75cc7988c7452ecd3b64f5e5a00445 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Thu, 3 Sep 2020 16:52:40 +0200 Subject: [PATCH] Fix compact npos solution edge count calculation This edge count is used for weighing, and it is somewhat trivial to review and verify that the current implementation was ignoring `votes16` field of the struct. As reminder, the struct is like this: ```rust struct Compact { votes1: ... , votes2: ..., ..., votes16: ..., } ``` I already will fix this in https://github.com/paritytech/substrate/pull/7007, but since it might take a while, this one can go in asap and make it to the very next runtime. --- primitives/npos-elections/compact/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primitives/npos-elections/compact/src/lib.rs b/primitives/npos-elections/compact/src/lib.rs index 03526d17981f9..54c94b6df65c2 100644 --- a/primitives/npos-elections/compact/src/lib.rs +++ b/primitives/npos-elections/compact/src/lib.rs @@ -157,7 +157,7 @@ fn struct_def( ) }).collect::(); - let edge_count_impl = (1..count).map(|c| { + let edge_count_impl = (1..=count).map(|c| { let field_name = field_name_for(c); quote!( all_edges = all_edges.saturating_add(