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

Commit

Permalink
approval-voting: simplify v2 assignments (#6802)
Browse files Browse the repository at this point in the history
* Simplify v2 assignment cert

Signed-off-by: Andrei Sandu <[email protected]>

* disable v2 assignments again

Signed-off-by: Andrei Sandu <[email protected]>

* Review feedback

Signed-off-by: Andrei Sandu <[email protected]>

* fix comment

Signed-off-by: Andrei Sandu <[email protected]>

* doc update

Signed-off-by: Andrei Sandu <[email protected]>

* db migration

Signed-off-by: Andrei Sandu <[email protected]>

* Revert "disable v2 assignments again"

This reverts commit 321b9b7.

* Switch to using bitfield

Signed-off-by: Andrei Sandu <[email protected]>

* Introduce AssignmentBitfield

Signed-off-by: Andrei Sandu <[email protected]>

* Get rid of Vec<CoreIndex>

Signed-off-by: Andrei Sandu <[email protected]>

* leftovers

Signed-off-by: Andrei Sandu <[email protected]>

* Review feedback and code SPA

Signed-off-by: Andrei Sandu <[email protected]>

* clippy

Signed-off-by: Andrei Sandu <[email protected]>

* Disable v2 assignments, so node upgrade test can pass.

Signed-off-by: Andrei Sandu <[email protected]>

* refactor bitfields

Signed-off-by: Andrei Sandu <[email protected]>

* link issue in code

Signed-off-by: Andrei Sandu <[email protected]>

---------

Signed-off-by: Andrei Sandu <[email protected]>
  • Loading branch information
sandreim authored Mar 31, 2023
1 parent 24db36c commit 741e91d
Show file tree
Hide file tree
Showing 15 changed files with 692 additions and 284 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

11 changes: 8 additions & 3 deletions node/core/approval-voting/src/approval_db/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! Version 1 of the DB schema.
use parity_scale_codec::{Decode, Encode};
use polkadot_node_primitives::approval::{AssignmentCertV2, DelayTranche};
use polkadot_node_primitives::approval::{v2::CoreBitfield, AssignmentCertV2, DelayTranche};
use polkadot_node_subsystem::{SubsystemError, SubsystemResult};
use polkadot_node_subsystem_util::database::{DBTransaction, Database};
use polkadot_primitives::{
Expand Down Expand Up @@ -161,11 +161,16 @@ pub struct Config {
/// Details pertaining to our assignment on a block.
#[derive(Encode, Decode, Debug, Clone, PartialEq)]
pub struct OurAssignment {
/// Our assignment certificate.
pub cert: AssignmentCertV2,
/// The tranche for which the assignment refers to.
pub tranche: DelayTranche,
/// Our validator index for the session in which the candidates were included.
pub validator_index: ValidatorIndex,
// Whether the assignment has been triggered already.
/// Whether the assignment has been triggered already.
pub triggered: bool,
/// A subset of the core indices obtained from the VRF output.
pub assignment_bitfield: CoreBitfield,
}

/// Metadata regarding a specific tranche of assignments for a specific candidate.
Expand All @@ -186,7 +191,7 @@ pub struct ApprovalEntry {
pub our_assignment: Option<OurAssignment>,
pub our_approval_sig: Option<ValidatorSignature>,
// `n_validators` bits.
pub assignments: Bitfield,
pub assigned_validators: Bitfield,
pub approved: bool,
}

Expand Down
Loading

0 comments on commit 741e91d

Please sign in to comment.