Add individual processing for ef tests (#745)

* Add Individual signature verification for ef tests

* Add clone state to avoid errors in ef tests

* Add state verification for VerifyIndividual in ef tests

* Add Clone derive for errors

* Update comments
This commit is contained in:
pscott
2020-01-08 00:24:44 +01:00
committed by Michael Sproul
parent 95cc5dd22f
commit 8e1e6838d2
6 changed files with 47 additions and 23 deletions

View File

@@ -7,7 +7,7 @@ use types::*;
/// Any of the `...Error` variants indicate that at some point during block (and block operation)
/// verification, there was an error. There is no indication as to _where_ that error happened
/// (e.g., when processing attestations instead of when processing deposits).
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum BlockProcessingError {
RandaoSignatureInvalid,
BulkSignatureVerificationFailed,
@@ -122,7 +122,7 @@ pub type AttestationValidationError = BlockOperationError<AttestationInvalid>;
pub type DepositValidationError = BlockOperationError<DepositInvalid>;
pub type ExitValidationError = BlockOperationError<ExitInvalid>;
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum BlockOperationError<T> {
Invalid(T),
BeaconStateError(BeaconStateError),
@@ -153,7 +153,7 @@ impl<T> From<ssz_types::Error> for BlockOperationError<T> {
}
}
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum HeaderInvalid {
ProposalSignatureInvalid,
StateSlotMismatch,
@@ -161,7 +161,7 @@ pub enum HeaderInvalid {
ProposerSlashed(usize),
}
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum ProposerSlashingInvalid {
/// The proposer index is not a known validator.
ProposerUnknown(u64),
@@ -179,7 +179,7 @@ pub enum ProposerSlashingInvalid {
BadProposal2Signature,
}
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum AttesterSlashingInvalid {
/// The attestations were not in conflict.
NotSlashable,
@@ -196,7 +196,7 @@ pub enum AttesterSlashingInvalid {
}
/// Describes why an object is invalid.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum AttestationInvalid {
/// Commmittee index exceeds number of committees in that slot.
BadCommitteeIndex,
@@ -251,7 +251,7 @@ impl From<BlockOperationError<IndexedAttestationInvalid>>
}
}
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum IndexedAttestationInvalid {
/// The number of indices exceeds the global maximum.
///
@@ -270,7 +270,7 @@ pub enum IndexedAttestationInvalid {
SignatureSetError(SignatureSetError),
}
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum DepositInvalid {
/// The signature (proof-of-possession) does not match the given pubkey.
BadSignature,
@@ -281,7 +281,7 @@ pub enum DepositInvalid {
BadMerkleProof,
}
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum ExitInvalid {
/// The specified validator is not active.
NotActive(u64),

View File

@@ -14,7 +14,7 @@ use types::{
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum Error {
/// Signature verification failed. The block is invalid.
SignatureInvalid,