mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 10:52:43 +00:00
Use E for EthSpec globally (#5264)
* Use `E` for `EthSpec` globally * Fix tests * Merge branch 'unstable' into e-ethspec * Merge branch 'unstable' into e-ethspec # Conflicts: # beacon_node/execution_layer/src/engine_api.rs # beacon_node/execution_layer/src/engine_api/http.rs # beacon_node/execution_layer/src/engine_api/json_structures.rs # beacon_node/execution_layer/src/test_utils/handle_rpc.rs # beacon_node/store/src/partial_beacon_state.rs # consensus/types/src/beacon_block.rs # consensus/types/src/beacon_block_body.rs # consensus/types/src/beacon_state.rs # consensus/types/src/config_and_preset.rs # consensus/types/src/execution_payload.rs # consensus/types/src/execution_payload_header.rs # consensus/types/src/light_client_optimistic_update.rs # consensus/types/src/payload.rs # lcli/src/parse_ssz.rs
This commit is contained in:
@@ -15,13 +15,13 @@ fn error(reason: Invalid) -> BlockOperationError<Invalid> {
|
||||
/// to `state`. Otherwise, returns a descriptive `Err`.
|
||||
///
|
||||
/// Optionally verifies the aggregate signature, depending on `verify_signatures`.
|
||||
pub fn verify_attestation_for_block_inclusion<'ctxt, T: EthSpec>(
|
||||
state: &BeaconState<T>,
|
||||
attestation: &Attestation<T>,
|
||||
ctxt: &'ctxt mut ConsensusContext<T>,
|
||||
pub fn verify_attestation_for_block_inclusion<'ctxt, E: EthSpec>(
|
||||
state: &BeaconState<E>,
|
||||
attestation: &Attestation<E>,
|
||||
ctxt: &'ctxt mut ConsensusContext<E>,
|
||||
verify_signatures: VerifySignatures,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<&'ctxt IndexedAttestation<T>> {
|
||||
) -> Result<&'ctxt IndexedAttestation<E>> {
|
||||
let data = &attestation.data;
|
||||
|
||||
verify!(
|
||||
@@ -38,7 +38,7 @@ pub fn verify_attestation_for_block_inclusion<'ctxt, T: EthSpec>(
|
||||
| BeaconState::Merge(_)
|
||||
| BeaconState::Capella(_) => {
|
||||
verify!(
|
||||
state.slot() <= data.slot.safe_add(T::slots_per_epoch())?,
|
||||
state.slot() <= data.slot.safe_add(E::slots_per_epoch())?,
|
||||
Invalid::IncludedTooLate {
|
||||
state: state.slot(),
|
||||
attestation: data.slot,
|
||||
@@ -59,13 +59,13 @@ pub fn verify_attestation_for_block_inclusion<'ctxt, T: EthSpec>(
|
||||
/// prior blocks in `state`.
|
||||
///
|
||||
/// Spec v0.12.1
|
||||
pub fn verify_attestation_for_state<'ctxt, T: EthSpec>(
|
||||
state: &BeaconState<T>,
|
||||
attestation: &Attestation<T>,
|
||||
ctxt: &'ctxt mut ConsensusContext<T>,
|
||||
pub fn verify_attestation_for_state<'ctxt, E: EthSpec>(
|
||||
state: &BeaconState<E>,
|
||||
attestation: &Attestation<E>,
|
||||
ctxt: &'ctxt mut ConsensusContext<E>,
|
||||
verify_signatures: VerifySignatures,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<&'ctxt IndexedAttestation<T>> {
|
||||
) -> Result<&'ctxt IndexedAttestation<E>> {
|
||||
let data = &attestation.data;
|
||||
|
||||
verify!(
|
||||
@@ -86,16 +86,16 @@ pub fn verify_attestation_for_state<'ctxt, T: EthSpec>(
|
||||
/// Check target epoch and source checkpoint.
|
||||
///
|
||||
/// Spec v0.12.1
|
||||
fn verify_casper_ffg_vote<T: EthSpec>(
|
||||
attestation: &Attestation<T>,
|
||||
state: &BeaconState<T>,
|
||||
fn verify_casper_ffg_vote<E: EthSpec>(
|
||||
attestation: &Attestation<E>,
|
||||
state: &BeaconState<E>,
|
||||
) -> Result<()> {
|
||||
let data = &attestation.data;
|
||||
verify!(
|
||||
data.target.epoch == data.slot.epoch(T::slots_per_epoch()),
|
||||
data.target.epoch == data.slot.epoch(E::slots_per_epoch()),
|
||||
Invalid::TargetEpochSlotMismatch {
|
||||
target_epoch: data.target.epoch,
|
||||
slot_epoch: data.slot.epoch(T::slots_per_epoch()),
|
||||
slot_epoch: data.slot.epoch(E::slots_per_epoch()),
|
||||
}
|
||||
);
|
||||
if data.target.epoch == state.current_epoch() {
|
||||
|
||||
Reference in New Issue
Block a user