mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-23 23:04:53 +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:
@@ -28,18 +28,18 @@ fn eth1_withdrawal_credentials(pubkey: &PublicKey, spec: &ChainSpec) -> Hash256
|
||||
///
|
||||
/// Reference:
|
||||
/// https://github.com/ethereum/eth2.0-pm/tree/6e41fcf383ebeb5125938850d8e9b4e9888389b4/interop/mocked_start
|
||||
pub fn interop_genesis_state<T: EthSpec>(
|
||||
pub fn interop_genesis_state<E: EthSpec>(
|
||||
keypairs: &[Keypair],
|
||||
genesis_time: u64,
|
||||
eth1_block_hash: Hash256,
|
||||
execution_payload_header: Option<ExecutionPayloadHeader<T>>,
|
||||
execution_payload_header: Option<ExecutionPayloadHeader<E>>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<BeaconState<T>, String> {
|
||||
) -> Result<BeaconState<E>, String> {
|
||||
let withdrawal_credentials = keypairs
|
||||
.iter()
|
||||
.map(|keypair| bls_withdrawal_credentials(&keypair.pk, spec))
|
||||
.collect::<Vec<_>>();
|
||||
interop_genesis_state_with_withdrawal_credentials::<T>(
|
||||
interop_genesis_state_with_withdrawal_credentials::<E>(
|
||||
keypairs,
|
||||
&withdrawal_credentials,
|
||||
genesis_time,
|
||||
@@ -51,13 +51,13 @@ pub fn interop_genesis_state<T: EthSpec>(
|
||||
|
||||
// returns an interop genesis state except every other
|
||||
// validator has eth1 withdrawal credentials
|
||||
pub fn interop_genesis_state_with_eth1<T: EthSpec>(
|
||||
pub fn interop_genesis_state_with_eth1<E: EthSpec>(
|
||||
keypairs: &[Keypair],
|
||||
genesis_time: u64,
|
||||
eth1_block_hash: Hash256,
|
||||
execution_payload_header: Option<ExecutionPayloadHeader<T>>,
|
||||
execution_payload_header: Option<ExecutionPayloadHeader<E>>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<BeaconState<T>, String> {
|
||||
) -> Result<BeaconState<E>, String> {
|
||||
let withdrawal_credentials = keypairs
|
||||
.iter()
|
||||
.enumerate()
|
||||
@@ -69,7 +69,7 @@ pub fn interop_genesis_state_with_eth1<T: EthSpec>(
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
interop_genesis_state_with_withdrawal_credentials::<T>(
|
||||
interop_genesis_state_with_withdrawal_credentials::<E>(
|
||||
keypairs,
|
||||
&withdrawal_credentials,
|
||||
genesis_time,
|
||||
@@ -79,14 +79,14 @@ pub fn interop_genesis_state_with_eth1<T: EthSpec>(
|
||||
)
|
||||
}
|
||||
|
||||
pub fn interop_genesis_state_with_withdrawal_credentials<T: EthSpec>(
|
||||
pub fn interop_genesis_state_with_withdrawal_credentials<E: EthSpec>(
|
||||
keypairs: &[Keypair],
|
||||
withdrawal_credentials: &[Hash256],
|
||||
genesis_time: u64,
|
||||
eth1_block_hash: Hash256,
|
||||
execution_payload_header: Option<ExecutionPayloadHeader<T>>,
|
||||
execution_payload_header: Option<ExecutionPayloadHeader<E>>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<BeaconState<T>, String> {
|
||||
) -> Result<BeaconState<E>, String> {
|
||||
if keypairs.len() != withdrawal_credentials.len() {
|
||||
return Err(format!(
|
||||
"wrong number of withdrawal credentials, expected: {}, got: {}",
|
||||
|
||||
Reference in New Issue
Block a user