Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

approval-voting improvement: include all tranche0 assignments in one certificate #1178

Merged
merged 49 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7230df4
merge from archived repo
sandreim Aug 25, 2023
d04c182
cargo lock
sandreim Aug 25, 2023
f4f0e70
Merge remote-tracking branch 'origin' into sandreim/the_v2_assignments
sandreim Aug 25, 2023
442b1e4
Merge branch 'master' of github.com:paritytech/polkadot-sdk into sand…
sandreim Aug 28, 2023
9850b2f
fix zombienet test
sandreim Aug 28, 2023
f71eb31
Merge branch 'master' of github.com:paritytech/polkadot-sdk into sand…
sandreim Aug 29, 2023
46cfaf1
cargo lock
sandreim Aug 29, 2023
0086502
Merge branch 'master' of github.com:paritytech/polkadot-sdk into sand…
sandreim Aug 30, 2023
47beabd
superfluous
sandreim Aug 30, 2023
ee88408
Merge branch 'master' into sandreim/the_v2_assignments
sandreim Aug 31, 2023
5832ad7
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Sep 26, 2023
e70b113
Fixup failure of lint-markdown
alexggh Sep 26, 2023
85939bb
Fixup test-rustdoc job
alexggh Sep 26, 2023
6dd5173
pipeline/zombinet: fix 0006 test name
alexggh Sep 27, 2023
566d7f5
Comment vstaging
alexggh Sep 29, 2023
460bab2
Revert "Comment vstaging"
alexggh Sep 29, 2023
85acb51
Add v3 protocol
alexggh Sep 29, 2023
6a1fb87
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Sep 29, 2023
56055c1
Fixup
alexggh Sep 30, 2023
477a4bb
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Oct 10, 2023
595000d
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Oct 10, 2023
5579719
Fix cargo fmt
alexggh Oct 11, 2023
03d92ce
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Oct 11, 2023
b053f92
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Oct 17, 2023
deccd98
Fixup clippy
alexggh Oct 17, 2023
807308e
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Oct 17, 2023
183ba64
Fix review typo
alexggh Oct 19, 2023
fc28618
Remove the need for CollationVersion::VStaging
alexggh Oct 19, 2023
056713b
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Oct 19, 2023
a8d234c
Addressed review comments
alexggh Oct 19, 2023
d728cf2
Make clippy happy
alexggh Oct 19, 2023
05ea75d
Build a test image with `network-protocol-staging`
alexggh Oct 19, 2023
261285f
Enable assignments
alexggh Oct 20, 2023
db9c3a9
Revert "Enable assignments v2 used for testing"
alexggh Oct 20, 2023
3893f16
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Oct 25, 2023
15eaa0a
Cleanup un-needed dependency to test-helpers
alexggh Oct 26, 2023
c8eff61
Modify the way we are doing the sampling
alexggh Oct 31, 2023
64f2195
Fixup check_rejects_delay_bad_vrf
alexggh Oct 31, 2023
059ce03
Merge remote-tracking branch 'origin/master' into sandreim/the_v2_ass…
alexggh Nov 1, 2023
3af9517
Address review feedback in relay_vrf_modulo_cores
alexggh Nov 3, 2023
7a1c88c
Add few more tests
alexggh Nov 3, 2023
ec71215
Fix unittest
alexggh Nov 5, 2023
552e6fa
Add pr_doc
alexggh Nov 5, 2023
2625def
Build a test image with `network-protocol-staging`
alexggh Oct 19, 2023
43f5529
Build a test image with assignments enabled
alexggh Oct 20, 2023
590b59e
Cleanup un-needed structures
alexggh Nov 5, 2023
bd76cf6
Revert test configurations
alexggh Nov 5, 2023
20cb37a
Fix upgrade to latest zombienet version
alexggh Nov 6, 2023
311b573
Set correct log level
alexggh Nov 6, 2023
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
8 changes: 8 additions & 0 deletions .gitlab/pipeline/zombienet/polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ zombienet-polkadot-functional-0005-parachains-disputes-past-session:
--local-dir="${LOCAL_DIR}/functional"
--test="0005-parachains-disputes-past-session.zndsl"

zombienet-polkadot-functional-0006-parachains-max-tranche0:
extends:
- .zombienet-polkadot-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/functional"
--test="0006-parachains-max-tranche0.zndsl"

zombienet-polkadot-smoke-0001-parachains-smoke-test:
extends:
- .zombienet-polkadot-common
Expand Down
10 changes: 10 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jemalloc-allocator = [
"polkadot-node-core-pvf/jemalloc-allocator",
"polkadot-overseer/jemalloc-allocator",
]
network-protocol-staging = [ "polkadot-cli/network-protocol-staging" ]


# Enables timeout-based tests supposed to be run only in CI environment as they may be flaky
# when run locally depending on system load
Expand Down
2 changes: 2 additions & 0 deletions polkadot/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ runtime-metrics = [
"polkadot-node-metrics/runtime-metrics",
"service/runtime-metrics",
]

network-protocol-staging = [ "service/network-protocol-staging" ]
6 changes: 6 additions & 0 deletions polkadot/node/core/approval-voting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ schnorrkel = "0.9.1"
kvdb = "0.13.0"
derive_more = "0.99.17"
thiserror = "1.0.48"
itertools = "0.10.5"

polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
Expand All @@ -30,6 +31,9 @@ sp-consensus = { path = "../../../../substrate/primitives/consensus/common", def
sp-consensus-slots = { path = "../../../../substrate/primitives/consensus/slots", default-features = false }
sp-application-crypto = { path = "../../../../substrate/primitives/application-crypto", default-features = false, features = ["full_crypto"] }
sp-runtime = { path = "../../../../substrate/primitives/runtime", default-features = false }
rand_core = "0.5.1"
rand_chacha = { version = "0.3.1" }
rand = "0.8.5"

[dev-dependencies]
async-trait = "0.1.57"
Expand All @@ -43,3 +47,5 @@ polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
assert_matches = "1.4.0"
kvdb-memorydb = "0.13.0"
test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../../primitives/test-helpers" }
log = "0.4.17"
env_logger = "0.9.0"
60 changes: 30 additions & 30 deletions polkadot/node/core/approval-voting/src/approval_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! Utilities for checking whether a candidate has been approved under a given block.

use bitvec::{order::Lsb0 as BitOrderLsb0, slice::BitSlice};
use polkadot_node_primitives::approval::DelayTranche;
use polkadot_node_primitives::approval::v1::DelayTranche;
use polkadot_primitives::ValidatorIndex;

use crate::{
Expand Down Expand Up @@ -472,9 +472,9 @@ mod tests {
}
.into();

let approval_entry = approval_db::v1::ApprovalEntry {
let approval_entry = approval_db::v2::ApprovalEntry {
tranches: Vec::new(),
assignments: BitVec::default(),
assigned_validators: BitVec::default(),
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -509,22 +509,22 @@ mod tests {
candidate.mark_approval(ValidatorIndex(i));
}

let approval_entry = approval_db::v1::ApprovalEntry {
let approval_entry = approval_db::v2::ApprovalEntry {
tranches: vec![
approval_db::v1::TrancheEntry {
approval_db::v2::TrancheEntry {
tranche: 0,
assignments: (0..2).map(|i| (ValidatorIndex(i), 0.into())).collect(),
},
approval_db::v1::TrancheEntry {
approval_db::v2::TrancheEntry {
tranche: 1,
assignments: (2..5).map(|i| (ValidatorIndex(i), 1.into())).collect(),
},
approval_db::v1::TrancheEntry {
approval_db::v2::TrancheEntry {
tranche: 2,
assignments: (5..10).map(|i| (ValidatorIndex(i), 0.into())).collect(),
},
],
assignments: bitvec![u8, BitOrderLsb0; 1; 10],
assigned_validators: bitvec![u8, BitOrderLsb0; 1; 10],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -581,22 +581,22 @@ mod tests {
candidate.mark_approval(ValidatorIndex(i));
}

let approval_entry = approval_db::v1::ApprovalEntry {
let approval_entry = approval_db::v2::ApprovalEntry {
tranches: vec![
approval_db::v1::TrancheEntry {
approval_db::v2::TrancheEntry {
tranche: 0,
assignments: (0..4).map(|i| (ValidatorIndex(i), 0.into())).collect(),
},
approval_db::v1::TrancheEntry {
approval_db::v2::TrancheEntry {
tranche: 1,
assignments: (4..6).map(|i| (ValidatorIndex(i), 1.into())).collect(),
},
approval_db::v1::TrancheEntry {
approval_db::v2::TrancheEntry {
tranche: 2,
assignments: (6..10).map(|i| (ValidatorIndex(i), 0.into())).collect(),
},
],
assignments: bitvec![u8, BitOrderLsb0; 1; 10],
assigned_validators: bitvec![u8, BitOrderLsb0; 1; 10],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -647,9 +647,9 @@ mod tests {
let no_show_duration = 10;
let needed_approvals = 4;

let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
let mut approval_entry: ApprovalEntry = approval_db::v2::ApprovalEntry {
tranches: Vec::new(),
assignments: bitvec![u8, BitOrderLsb0; 0; 5],
assigned_validators: bitvec![u8, BitOrderLsb0; 0; 5],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -691,9 +691,9 @@ mod tests {
let no_show_duration = 10;
let needed_approvals = 4;

let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
let mut approval_entry: ApprovalEntry = approval_db::v2::ApprovalEntry {
tranches: Vec::new(),
assignments: bitvec![u8, BitOrderLsb0; 0; 10],
assigned_validators: bitvec![u8, BitOrderLsb0; 0; 10],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -731,9 +731,9 @@ mod tests {
let no_show_duration = 10;
let needed_approvals = 4;

let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
let mut approval_entry: ApprovalEntry = approval_db::v2::ApprovalEntry {
tranches: Vec::new(),
assignments: bitvec![u8, BitOrderLsb0; 0; 10],
assigned_validators: bitvec![u8, BitOrderLsb0; 0; 10],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -776,9 +776,9 @@ mod tests {
let needed_approvals = 4;
let n_validators = 8;

let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
let mut approval_entry: ApprovalEntry = approval_db::v2::ApprovalEntry {
tranches: Vec::new(),
assignments: bitvec![u8, BitOrderLsb0; 0; n_validators],
assigned_validators: bitvec![u8, BitOrderLsb0; 0; n_validators],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -843,9 +843,9 @@ mod tests {
let needed_approvals = 4;
let n_validators = 8;

let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
let mut approval_entry: ApprovalEntry = approval_db::v2::ApprovalEntry {
tranches: Vec::new(),
assignments: bitvec![u8, BitOrderLsb0; 0; n_validators],
assigned_validators: bitvec![u8, BitOrderLsb0; 0; n_validators],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -934,9 +934,9 @@ mod tests {
let needed_approvals = 4;
let n_validators = 8;

let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
let mut approval_entry: ApprovalEntry = approval_db::v2::ApprovalEntry {
tranches: Vec::new(),
assignments: bitvec![u8, BitOrderLsb0; 0; n_validators],
assigned_validators: bitvec![u8, BitOrderLsb0; 0; n_validators],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -1041,15 +1041,15 @@ mod tests {
candidate.mark_approval(ValidatorIndex(i));
}

let approval_entry = approval_db::v1::ApprovalEntry {
let approval_entry = approval_db::v2::ApprovalEntry {
tranches: vec![
// Assignments with invalid validator indexes.
approval_db::v1::TrancheEntry {
approval_db::v2::TrancheEntry {
tranche: 1,
assignments: (2..5).map(|i| (ValidatorIndex(i), 1.into())).collect(),
},
],
assignments: bitvec![u8, BitOrderLsb0; 1; 3],
assigned_validators: bitvec![u8, BitOrderLsb0; 1; 3],
our_assignment: None,
our_approval_sig: None,
backing_group: GroupIndex(0),
Expand Down Expand Up @@ -1094,12 +1094,12 @@ mod tests {
];

for test_tranche in test_tranches {
let mut approval_entry: ApprovalEntry = approval_db::v1::ApprovalEntry {
let mut approval_entry: ApprovalEntry = approval_db::v2::ApprovalEntry {
tranches: Vec::new(),
backing_group: GroupIndex(0),
our_assignment: None,
our_approval_sig: None,
assignments: bitvec![u8, BitOrderLsb0; 0; 3],
assigned_validators: bitvec![u8, BitOrderLsb0; 0; 3],
approved: false,
}
.into();
Expand Down
1 change: 1 addition & 0 deletions polkadot/node/core/approval-voting/src/approval_db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
//! time being we share the same DB with the rest of Substrate.

pub mod v1;
pub mod v2;
Loading
Loading