superstruct the AttesterSlashing (#5636)

* `superstruct` Attester Fork Variants

* Push a little further

* Deal with Encode / Decode of AttesterSlashing

* not so sure about this..

* Stop Encode/Decode Bounds from Propagating Out

* Tons of Changes..

* More Conversions to AttestationRef

* Add AsReference trait (#15)

* Add AsReference trait

* Fix some snafus

* Got it Compiling! :D

* Got Tests Building

* Get beacon chain tests compiling

---------

Co-authored-by: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
ethDreamer
2024-05-02 18:00:21 -05:00
committed by GitHub
parent 3b7132bc0d
commit e6c7f145dd
53 changed files with 1405 additions and 437 deletions

View File

@@ -7,10 +7,10 @@ use ssz::DecodeError;
use std::borrow::Cow;
use tree_hash::TreeHash;
use types::{
AbstractExecPayload, AggregateSignature, AttesterSlashing, BeaconBlockRef, BeaconState,
AbstractExecPayload, AggregateSignature, AttesterSlashingRef, BeaconBlockRef, BeaconState,
BeaconStateError, ChainSpec, DepositData, Domain, Epoch, EthSpec, Fork, Hash256,
InconsistentFork, IndexedAttestation, ProposerSlashing, PublicKey, PublicKeyBytes, Signature,
SignedAggregateAndProof, SignedBeaconBlock, SignedBeaconBlockHeader,
InconsistentFork, IndexedAttestation, IndexedAttestationRef, ProposerSlashing, PublicKey,
PublicKeyBytes, Signature, SignedAggregateAndProof, SignedBeaconBlock, SignedBeaconBlockHeader,
SignedBlsToExecutionChange, SignedContributionAndProof, SignedRoot, SignedVoluntaryExit,
SigningData, Slot, SyncAggregate, SyncAggregatorSelectionData, Unsigned,
};
@@ -272,7 +272,7 @@ pub fn indexed_attestation_signature_set<'a, 'b, E, F>(
state: &'a BeaconState<E>,
get_pubkey: F,
signature: &'a AggregateSignature,
indexed_attestation: &'b IndexedAttestation<E>,
indexed_attestation: IndexedAttestationRef<'b, E>,
spec: &'a ChainSpec,
) -> Result<SignatureSet<'a>>
where
@@ -335,7 +335,7 @@ where
pub fn attester_slashing_signature_sets<'a, E, F>(
state: &'a BeaconState<E>,
get_pubkey: F,
attester_slashing: &'a AttesterSlashing<E>,
attester_slashing: AttesterSlashingRef<'a, E>,
spec: &'a ChainSpec,
) -> Result<(SignatureSet<'a>, SignatureSet<'a>)>
where
@@ -346,15 +346,15 @@ where
indexed_attestation_signature_set(
state,
get_pubkey.clone(),
attester_slashing.attestation_1.signature(),
&attester_slashing.attestation_1,
attester_slashing.attestation_1().signature(),
attester_slashing.attestation_1(),
spec,
)?,
indexed_attestation_signature_set(
state,
get_pubkey,
attester_slashing.attestation_2.signature(),
&attester_slashing.attestation_2,
attester_slashing.attestation_2().signature(),
attester_slashing.attestation_2(),
spec,
)?,
))