Fixed some stuff in state processing (#3640)

This commit is contained in:
ethDreamer
2022-10-13 17:07:32 -05:00
committed by GitHub
parent 255fdf0724
commit c1c5dc0a64
5 changed files with 32 additions and 31 deletions

View File

@@ -7,8 +7,8 @@ use bls::{verify_signature_sets, PublicKey, PublicKeyBytes, SignatureSet};
use rayon::prelude::*;
use std::borrow::Cow;
use types::{
BeaconState, BeaconStateError, ChainSpec, EthSpec, ExecPayload, Hash256, IndexedAttestation,
SignedBeaconBlock,
AbstractExecPayload, BeaconState, BeaconStateError, ChainSpec, EthSpec, Hash256,
IndexedAttestation, SignedBeaconBlock,
};
pub type Result<T> = std::result::Result<T, Error>;
@@ -117,7 +117,7 @@ where
/// contains invalid signatures on deposits._
///
/// See `Self::verify` for more detail.
pub fn verify_entire_block<Payload: ExecPayload<T>>(
pub fn verify_entire_block<Payload: AbstractExecPayload<T>>(
state: &'a BeaconState<T>,
get_pubkey: F,
decompressor: D,
@@ -131,7 +131,7 @@ where
}
/// Includes all signatures on the block (except the deposit signatures) for verification.
pub fn include_all_signatures<Payload: ExecPayload<T>>(
pub fn include_all_signatures<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
block_root: Option<Hash256>,
@@ -144,7 +144,7 @@ where
/// Includes all signatures on the block (except the deposit signatures and the proposal
/// signature) for verification.
pub fn include_all_signatures_except_proposal<Payload: ExecPayload<T>>(
pub fn include_all_signatures_except_proposal<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
) -> Result<()> {
@@ -160,7 +160,7 @@ where
}
/// Includes the block signature for `self.block` for verification.
pub fn include_block_proposal<Payload: ExecPayload<T>>(
pub fn include_block_proposal<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
block_root: Option<Hash256>,
@@ -177,7 +177,7 @@ where
}
/// Includes the randao signature for `self.block` for verification.
pub fn include_randao_reveal<Payload: ExecPayload<T>>(
pub fn include_randao_reveal<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
) -> Result<()> {
@@ -192,7 +192,7 @@ where
}
/// Includes all signatures in `self.block.body.proposer_slashings` for verification.
pub fn include_proposer_slashings<Payload: ExecPayload<T>>(
pub fn include_proposer_slashings<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
) -> Result<()> {
@@ -221,7 +221,7 @@ where
}
/// Includes all signatures in `self.block.body.attester_slashings` for verification.
pub fn include_attester_slashings<Payload: ExecPayload<T>>(
pub fn include_attester_slashings<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
) -> Result<()> {
@@ -250,7 +250,7 @@ where
}
/// Includes all signatures in `self.block.body.attestations` for verification.
pub fn include_attestations<Payload: ExecPayload<T>>(
pub fn include_attestations<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
) -> Result<Vec<IndexedAttestation<T>>> {
@@ -289,7 +289,7 @@ where
}
/// Includes all signatures in `self.block.body.voluntary_exits` for verification.
pub fn include_exits<Payload: ExecPayload<T>>(
pub fn include_exits<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
) -> Result<()> {
@@ -313,7 +313,7 @@ where
}
/// Include the signature of the block's sync aggregate (if it exists) for verification.
pub fn include_sync_aggregate<Payload: ExecPayload<T>>(
pub fn include_sync_aggregate<Payload: AbstractExecPayload<T>>(
&mut self,
block: &'a SignedBeaconBlock<T, Payload>,
) -> Result<()> {

View File

@@ -9,7 +9,7 @@ use crate::VerifySignatures;
use safe_arith::SafeArith;
use types::consts::altair::{PARTICIPATION_FLAG_WEIGHTS, PROPOSER_WEIGHT, WEIGHT_DENOMINATOR};
pub fn process_operations<'a, T: EthSpec, Payload: ExecPayload<T>>(
pub fn process_operations<'a, T: EthSpec, Payload: AbstractExecPayload<T>>(
state: &mut BeaconState<T>,
block_body: BeaconBlockBodyRef<'a, T, Payload>,
proposer_index: u64,
@@ -219,7 +219,7 @@ pub fn process_attester_slashings<T: EthSpec>(
}
/// Wrapper function to handle calling the correct version of `process_attestations` based on
/// the fork.
pub fn process_attestations<'a, T: EthSpec, Payload: ExecPayload<T>>(
pub fn process_attestations<'a, T: EthSpec, Payload: AbstractExecPayload<T>>(
state: &mut BeaconState<T>,
block_body: BeaconBlockBodyRef<'a, T, Payload>,
proposer_index: u64,

View File

@@ -7,9 +7,9 @@ use ssz::DecodeError;
use std::borrow::Cow;
use tree_hash::TreeHash;
use types::{
AggregateSignature, AttesterSlashing, BeaconBlockRef, BeaconState, BeaconStateError, ChainSpec,
DepositData, Domain, Epoch, EthSpec, ExecPayload, Fork, Hash256, InconsistentFork,
IndexedAttestation, ProposerSlashing, PublicKey, PublicKeyBytes, Signature,
AbstractExecPayload, AggregateSignature, AttesterSlashing, BeaconBlockRef, BeaconState,
BeaconStateError, ChainSpec, DepositData, Domain, Epoch, EthSpec, ExecPayload, Fork, Hash256,
InconsistentFork, IndexedAttestation, ProposerSlashing, PublicKey, PublicKeyBytes, Signature,
SignedAggregateAndProof, SignedBeaconBlock, SignedBeaconBlockHeader,
SignedContributionAndProof, SignedRoot, SignedVoluntaryExit, SigningData, Slot, SyncAggregate,
SyncAggregatorSelectionData, Unsigned,
@@ -71,7 +71,7 @@ where
}
/// A signature set that is valid if a block was signed by the expected block producer.
pub fn block_proposal_signature_set<'a, T, F, Payload: ExecPayload<T>>(
pub fn block_proposal_signature_set<'a, T, F, Payload: AbstractExecPayload<T>>(
state: &'a BeaconState<T>,
get_pubkey: F,
signed_block: &'a SignedBeaconBlock<T, Payload>,
@@ -108,7 +108,7 @@ where
/// Unlike `block_proposal_signature_set` this does **not** check that the proposer index is
/// correct according to the shuffling. It should only be used if no suitable `BeaconState` is
/// available.
pub fn block_proposal_signature_set_from_parts<'a, T, F, Payload: ExecPayload<T>>(
pub fn block_proposal_signature_set_from_parts<'a, T, F, Payload: AbstractExecPayload<T>>(
signed_block: &'a SignedBeaconBlock<T, Payload>,
block_root: Option<Hash256>,
proposer_index: u64,
@@ -152,7 +152,7 @@ where
}
/// A signature set that is valid if the block proposers randao reveal signature is correct.
pub fn randao_signature_set<'a, T, F, Payload: ExecPayload<T>>(
pub fn randao_signature_set<'a, T, F, Payload: AbstractExecPayload<T>>(
state: &'a BeaconState<T>,
get_pubkey: F,
block: BeaconBlockRef<'a, T, Payload>,