mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
approval votes checking logs (#3233)
* approval-voting: logs for invalid votes * proper errors for assignment checks * proper errors for approval checks
This commit is contained in:
@@ -646,7 +646,7 @@ impl CollationGenerationMessage {
|
||||
}
|
||||
|
||||
/// The result type of [`ApprovalVotingMessage::CheckAndImportAssignment`] request.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum AssignmentCheckResult {
|
||||
/// The vote was accepted and should be propagated onwards.
|
||||
Accepted,
|
||||
@@ -655,16 +655,56 @@ pub enum AssignmentCheckResult {
|
||||
/// The vote was valid but too far in the future to accept right now.
|
||||
TooFarInFuture,
|
||||
/// The vote was bad and should be ignored, reporting the peer who propagated it.
|
||||
Bad,
|
||||
Bad(AssignmentCheckError),
|
||||
}
|
||||
|
||||
/// The error result type of [`ApprovalVotingMessage::CheckAndImportAssignment`] request.
|
||||
#[derive(Error, Debug, Clone, PartialEq, Eq)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum AssignmentCheckError {
|
||||
#[error("Unknown block: {0:?}")]
|
||||
UnknownBlock(Hash),
|
||||
#[error("Unknown session index: {0}")]
|
||||
UnknownSessionIndex(SessionIndex),
|
||||
#[error("Invalid candidate index: {0}")]
|
||||
InvalidCandidateIndex(CandidateIndex),
|
||||
#[error("Invalid candidate {0}: {1:?}")]
|
||||
InvalidCandidate(CandidateIndex, CandidateHash),
|
||||
#[error("Invalid cert: {0:?}")]
|
||||
InvalidCert(ValidatorIndex),
|
||||
#[error("Internal state mismatch: {0:?}, {1:?}")]
|
||||
Internal(Hash, CandidateHash),
|
||||
}
|
||||
|
||||
/// The result type of [`ApprovalVotingMessage::CheckAndImportApproval`] request.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ApprovalCheckResult {
|
||||
/// The vote was accepted and should be propagated onwards.
|
||||
Accepted,
|
||||
/// The vote was bad and should be ignored, reporting the peer who propagated it.
|
||||
Bad,
|
||||
Bad(ApprovalCheckError)
|
||||
}
|
||||
|
||||
/// The error result type of [`ApprovalVotingMessage::CheckAndImportApproval`] request.
|
||||
#[derive(Error, Debug, Clone, PartialEq, Eq)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum ApprovalCheckError {
|
||||
#[error("Unknown block: {0:?}")]
|
||||
UnknownBlock(Hash),
|
||||
#[error("Unknown session index: {0}")]
|
||||
UnknownSessionIndex(SessionIndex),
|
||||
#[error("Invalid candidate index: {0}")]
|
||||
InvalidCandidateIndex(CandidateIndex),
|
||||
#[error("Invalid validator index: {0:?}")]
|
||||
InvalidValidatorIndex(ValidatorIndex),
|
||||
#[error("Invalid candidate {0}: {1:?}")]
|
||||
InvalidCandidate(CandidateIndex, CandidateHash),
|
||||
#[error("Invalid signature: {0:?}")]
|
||||
InvalidSignature(ValidatorIndex),
|
||||
#[error("No assignment for {0:?}")]
|
||||
NoAssignment(ValidatorIndex),
|
||||
#[error("Internal state mismatch: {0:?}, {1:?}")]
|
||||
Internal(Hash, CandidateHash),
|
||||
}
|
||||
|
||||
/// Message to the Approval Voting subsystem.
|
||||
|
||||
Reference in New Issue
Block a user