mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 15:55:49 +00:00
Fail early at obviously invalid approvals (#3152)
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
This commit is contained in:
committed by
GitHub
parent
5354097aa1
commit
261f4b713b
@@ -3621,6 +3621,33 @@ fn import_versioned_approval() {
|
||||
assert_eq!(approvals.len(), 1);
|
||||
}
|
||||
);
|
||||
|
||||
// send an obviously invalid approval
|
||||
let approval = IndirectSignedApprovalVote {
|
||||
block_hash: hash,
|
||||
// Invalid candidate index, should not pass sanitization.
|
||||
candidate_index: 16777284,
|
||||
validator: validator_index,
|
||||
signature: dummy_signature(),
|
||||
};
|
||||
let msg = protocol_v2::ApprovalDistributionMessage::Approvals(vec![approval.clone()]);
|
||||
send_message_from_peer_v2(overseer, &peer_a, msg).await;
|
||||
|
||||
expect_reputation_change(overseer, &peer_a, COST_OVERSIZED_BITFIELD).await;
|
||||
|
||||
// send an obviously invalid approval
|
||||
let approval = IndirectSignedApprovalVoteV2 {
|
||||
block_hash: hash,
|
||||
// Invalid candidates len, should not pass sanitization.
|
||||
candidate_indices: 16777284.into(),
|
||||
validator: validator_index,
|
||||
signature: dummy_signature(),
|
||||
};
|
||||
let msg = protocol_v3::ApprovalDistributionMessage::Approvals(vec![approval.clone()]);
|
||||
send_message_from_peer_v3(overseer, &peer_a, msg).await;
|
||||
|
||||
expect_reputation_change(overseer, &peer_a, COST_OVERSIZED_BITFIELD).await;
|
||||
|
||||
virtual_overseer
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user