mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-05 13:54:36 +00:00
Gloas payload attestation consensus (#8827)
- Implement `process_payload_attestation` - Implement EF tests for payload attestations (allows simplification of handler now that we support all `operations` tests). - Update the `BlockSignatureVerifier` to signature-verify payload attestations Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -41,6 +41,10 @@ pub enum BlockProcessingError {
|
||||
index: usize,
|
||||
reason: AttestationInvalid,
|
||||
},
|
||||
PayloadAttestationInvalid {
|
||||
index: usize,
|
||||
reason: PayloadAttestationInvalid,
|
||||
},
|
||||
DepositInvalid {
|
||||
index: usize,
|
||||
reason: DepositInvalid,
|
||||
@@ -217,6 +221,7 @@ impl_into_block_processing_error_with_index!(
|
||||
AttesterSlashingInvalid,
|
||||
IndexedAttestationInvalid,
|
||||
AttestationInvalid,
|
||||
PayloadAttestationInvalid,
|
||||
DepositInvalid,
|
||||
ExitInvalid,
|
||||
BlsExecutionChangeInvalid
|
||||
@@ -422,6 +427,52 @@ pub enum IndexedAttestationInvalid {
|
||||
SignatureSetError(SignatureSetError),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum PayloadAttestationInvalid {
|
||||
/// Block root does not match the parent beacon block root.
|
||||
BlockRootMismatch {
|
||||
expected: Hash256,
|
||||
found: Hash256,
|
||||
},
|
||||
/// The attestation slot is not the previous slot.
|
||||
SlotMismatch {
|
||||
expected: Slot,
|
||||
found: Slot,
|
||||
},
|
||||
BadIndexedPayloadAttestation(IndexedPayloadAttestationInvalid),
|
||||
}
|
||||
|
||||
impl From<BlockOperationError<IndexedPayloadAttestationInvalid>>
|
||||
for BlockOperationError<PayloadAttestationInvalid>
|
||||
{
|
||||
fn from(e: BlockOperationError<IndexedPayloadAttestationInvalid>) -> Self {
|
||||
match e {
|
||||
BlockOperationError::Invalid(e) => BlockOperationError::invalid(
|
||||
PayloadAttestationInvalid::BadIndexedPayloadAttestation(e),
|
||||
),
|
||||
BlockOperationError::BeaconStateError(e) => BlockOperationError::BeaconStateError(e),
|
||||
BlockOperationError::SignatureSetError(e) => BlockOperationError::SignatureSetError(e),
|
||||
BlockOperationError::SszTypesError(e) => BlockOperationError::SszTypesError(e),
|
||||
BlockOperationError::BitfieldError(e) => BlockOperationError::BitfieldError(e),
|
||||
BlockOperationError::ConsensusContext(e) => BlockOperationError::ConsensusContext(e),
|
||||
BlockOperationError::ArithError(e) => BlockOperationError::ArithError(e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum IndexedPayloadAttestationInvalid {
|
||||
/// The number of indices is 0.
|
||||
IndicesEmpty,
|
||||
/// The validator indices were not in increasing order.
|
||||
BadValidatorIndicesOrdering,
|
||||
/// The indexed attestation aggregate signature was not valid.
|
||||
BadSignature,
|
||||
/// There was an error whilst attempting to get a set of signatures. The signatures may have
|
||||
/// been invalid or an internal error occurred.
|
||||
SignatureSetError(SignatureSetError),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum DepositInvalid {
|
||||
/// The signature (proof-of-possession) does not match the given pubkey.
|
||||
|
||||
Reference in New Issue
Block a user