This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce target candidate is part of the signature
Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
- Loading branch information
Showing
6 changed files
with
68 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1330,24 +1330,29 @@ fn check_signature( | |
statement: &DisputeStatement, | ||
validator_signature: &ValidatorSignature, | ||
) -> Result<(), ()> { | ||
let payload = match *statement { | ||
let payload = match statement { | ||
DisputeStatement::Valid(ValidDisputeStatementKind::Explicit) => | ||
ExplicitDisputeStatement { valid: true, candidate_hash, session }.signing_payload(), | ||
DisputeStatement::Valid(ValidDisputeStatementKind::BackingSeconded(inclusion_parent)) => | ||
CompactStatement::Seconded(candidate_hash).signing_payload(&SigningContext { | ||
session_index: session, | ||
parent_hash: inclusion_parent, | ||
parent_hash: *inclusion_parent, | ||
}), | ||
DisputeStatement::Valid(ValidDisputeStatementKind::BackingValid(inclusion_parent)) => | ||
CompactStatement::Valid(candidate_hash).signing_payload(&SigningContext { | ||
session_index: session, | ||
parent_hash: inclusion_parent, | ||
parent_hash: *inclusion_parent, | ||
}), | ||
DisputeStatement::Valid(ValidDisputeStatementKind::ApprovalChecking) => | ||
ApprovalVote(candidate_hash).signing_payload(session), | ||
DisputeStatement::Valid(ValidDisputeStatementKind::ApprovalCheckingV2(_)) => | ||
// TODO: Fixme | ||
ApprovalVoteMultipleCandidates(vec![candidate_hash]).signing_payload(session), | ||
DisputeStatement::Valid(ValidDisputeStatementKind::ApprovalCheckingMultipleCandidates( | ||
candidates, | ||
)) => | ||
if candidates.contains(&candidate_hash) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alexggh
Author
Contributor
|
||
ApprovalVoteMultipleCandidates(candidates).signing_payload(session) | ||
} else { | ||
return Err(()) | ||
}, | ||
DisputeStatement::Invalid(InvalidDisputeStatementKind::Explicit) => | ||
ExplicitDisputeStatement { valid: false, candidate_hash, session }.signing_payload(), | ||
}; | ||
|
This seems ~fine, though the linear complexity in the search isn't great IMO. The runtime is pretty resource constrained.