EIP-7732 Boiler Plate

This commit is contained in:
Mark Mackey
2024-08-27 12:38:00 -05:00
parent c042dc14d7
commit 13130dfa4f
52 changed files with 891 additions and 153 deletions

View File

@@ -53,7 +53,7 @@ pub fn get_attestation_participation_flag_indices<E: EthSpec>(
participation_flag_indices.push(TIMELY_TARGET_FLAG_INDEX);
}
}
&BeaconState::Deneb(_) | &BeaconState::Electra(_) => {
&BeaconState::Deneb(_) | &BeaconState::Electra(_) | &BeaconState::EIP7732(_) => {
if is_matching_target {
// [Modified in Deneb:EIP7045]
participation_flag_indices.push(TIMELY_TARGET_FLAG_INDEX);

View File

@@ -61,7 +61,8 @@ pub fn slash_validator<E: EthSpec>(
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => whistleblower_reward
| BeaconState::Electra(_)
| BeaconState::EIP7732(_) => whistleblower_reward
.safe_mul(PROPOSER_WEIGHT)?
.safe_div(WEIGHT_DENOMINATOR)?,
};

View File

@@ -462,6 +462,8 @@ pub fn is_merge_transition_complete<E: EthSpec>(state: &BeaconState<E>) -> bool
.unwrap_or(false),
BeaconState::Electra(_) | BeaconState::Deneb(_) | BeaconState::Capella(_) => true,
BeaconState::Base(_) | BeaconState::Altair(_) => false,
// TODO(EIP7732): check this cause potuz modified this function for god knows what reason
BeaconState::EIP7732(_) => true,
}
}
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/beacon-chain.md#is_merge_transition_block
@@ -662,5 +664,6 @@ pub fn process_withdrawals<E: EthSpec, Payload: AbstractExecPayload<E>>(
}
// these shouldn't even be encountered but they're here for completeness
BeaconState::Base(_) | BeaconState::Altair(_) | BeaconState::Bellatrix(_) => Ok(()),
BeaconState::EIP7732(_) => todo!("implement potuz' changes to process_withdrawals()"),
}
}

View File

@@ -308,6 +308,9 @@ pub fn process_attestations<E: EthSpec, Payload: AbstractExecPayload<E>>(
spec,
)?;
}
BeaconBlockBodyRef::EIP7732(_) => {
todo!("EIP-7732 implement process_operations()");
}
}
Ok(())
}

View File

@@ -398,11 +398,12 @@ where
state.genesis_validators_root(),
),
// EIP-7044
BeaconState::Deneb(_) | BeaconState::Electra(_) => spec.compute_domain(
Domain::VoluntaryExit,
spec.capella_fork_version,
state.genesis_validators_root(),
),
BeaconState::Deneb(_) | BeaconState::Electra(_) | BeaconState::EIP7732(_) => spec
.compute_domain(
Domain::VoluntaryExit,
spec.capella_fork_version,
state.genesis_validators_root(),
),
};
let message = exit.signing_root(domain);

View File

@@ -46,7 +46,7 @@ pub fn verify_attestation_for_block_inclusion<'ctxt, E: EthSpec>(
);
}
// [Modified in Deneb:EIP7045]
BeaconState::Deneb(_) | BeaconState::Electra(_) => {}
BeaconState::Deneb(_) | BeaconState::Electra(_) | BeaconState::EIP7732(_) => {}
}
verify_attestation_for_state(state, attestation, ctxt, verify_signatures, spec)

View File

@@ -47,7 +47,8 @@ pub fn process_epoch<E: EthSpec>(
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_)
| BeaconState::Electra(_) => altair::process_epoch(state, spec),
| BeaconState::Electra(_)
| BeaconState::EIP7732(_) => altair::process_epoch(state, spec),
}
}