Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Sandu <[email protected]>
  • Loading branch information
sandreim committed Nov 1, 2024
1 parent 4d6c45a commit 1bd9375
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl TestState {

let mut node_features = NodeFeatures::new();
if config.allow_v2_descriptors {
node_features.resize(4, false);
node_features.resize(FeatureIndex::FirstUnassigned as usize, false);
node_features.set(FeatureIndex::CandidateReceiptV2 as usize, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1041,9 +1041,9 @@ fn peer_reported_for_invalid_v2_descriptor() {
);
}

// Send a request to peer and mock its response to include invalid statements.
// Send a request to peer and mock its response to include a candidate with invalid core
// index.
{
// Sign statement with wrong signing context, leading to bad signature.
let b_seconded_invalid = state
.sign_statement(
v_b,
Expand Down Expand Up @@ -1104,9 +1104,9 @@ fn peer_reported_for_invalid_v2_descriptor() {
);
}

// Send a request to peer and mock its response to include invalid statements.
// Send a request to peer and mock its response to include a candidate with invalid session
// index.
{
// Sign statement with wrong signing context, leading to bad signature.
let b_seconded_invalid = state
.sign_statement(
v_b,
Expand Down Expand Up @@ -1165,9 +1165,8 @@ fn peer_reported_for_invalid_v2_descriptor() {
);
}

// Send a request to peer and mock its response to include invalid statements.
// Send a request to peer and mock its response to include a valid candidate.
{
// Sign statement with wrong signing context, leading to bad signature.
let b_seconded_invalid = state
.sign_statement(
v_b,
Expand Down Expand Up @@ -1318,9 +1317,9 @@ fn v2_descriptors_filtered(#[case] allow_v2_descriptors: bool) {
);
}

// Send a request to peer and mock its response to include invalid statements.
// Send a request to peer and mock its response to include a candidate with invalid core
// index.
{
// Sign statement with wrong signing context, leading to bad signature.
let b_seconded_invalid = state
.sign_statement(
v_b,
Expand Down
6 changes: 6 additions & 0 deletions polkadot/primitives/src/vstaging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ pub trait MutateDescriptorV2<H> {
fn set_version(&mut self, version: InternalVersion);
/// Set the PVD of the descriptor.
fn set_persisted_validation_data_hash(&mut self, persisted_validation_data_hash: Hash);
/// Set the validation code hash of the descriptor.
fn set_validation_code_hash(&mut self, validation_code_hash: ValidationCodeHash);
/// Set the erasure root of the descriptor.
fn set_erasure_root(&mut self, erasure_root: Hash);
/// Set the para head of the descriptor.
Expand Down Expand Up @@ -244,6 +246,10 @@ impl<H> MutateDescriptorV2<H> for CandidateDescriptorV2<H> {
self.persisted_validation_data_hash = persisted_validation_data_hash;
}

fn set_validation_code_hash(&mut self, validation_code_hash: ValidationCodeHash) {
self.validation_code_hash = validation_code_hash;
}

fn set_erasure_root(&mut self, erasure_root: Hash) {
self.erasure_root = erasure_root;
}
Expand Down
4 changes: 2 additions & 2 deletions polkadot/primitives/test-helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ pub fn make_candidate_v2(
para_id: ParaId,
parent_head: HeadData,
head_data: HeadData,
_validation_code_hash: ValidationCodeHash,
validation_code_hash: ValidationCodeHash,
) -> (CommittedCandidateReceiptV2, PersistedValidationData) {
let pvd = dummy_pvd(parent_head, relay_parent_number);
let commitments = CandidateCommitments {
Expand All @@ -276,7 +276,7 @@ pub fn make_candidate_v2(
dummy_candidate_descriptor_v2(relay_parent_hash);
descriptor.set_para_id(para_id);
descriptor.set_persisted_validation_data_hash(pvd.hash());
// descriptor.set_validation_code_hash(validation_code_hash);
descriptor.set_validation_code_hash(validation_code_hash);
let candidate =
CommittedCandidateReceiptV2 { descriptor, commitments };

Expand Down

0 comments on commit 1bd9375

Please sign in to comment.