Misc changes for merge testnets (#2667)

* Thread eth1_block_hash into interop genesis state

* Add merge-fork-epoch flag

* Build LH with minimal spec by default

* Add verbose logs to execution_layer

* Add --http-allow-sync-stalled flag

* Update lcli new-testnet to create genesis state

* Fix http test

* Fix compile errors in tests
This commit is contained in:
Paul Hauner
2021-10-03 06:57:23 +11:00
parent a1033a9247
commit b162b067de
16 changed files with 236 additions and 60 deletions

View File

@@ -5,6 +5,8 @@ use ssz::Encode;
use state_processing::initialize_beacon_state_from_eth1;
use types::{BeaconState, ChainSpec, DepositData, EthSpec, Hash256, Keypair, PublicKey, Signature};
pub const DEFAULT_ETH1_BLOCK_HASH: &[u8] = &[0x42; 32];
/// Builds a genesis state as defined by the Eth2 interop procedure (see below).
///
/// Reference:
@@ -12,9 +14,10 @@ use types::{BeaconState, ChainSpec, DepositData, EthSpec, Hash256, Keypair, Publ
pub fn interop_genesis_state<T: EthSpec>(
keypairs: &[Keypair],
genesis_time: u64,
eth1_block_hash: Hash256,
spec: &ChainSpec,
) -> Result<BeaconState<T>, String> {
let eth1_block_hash = Hash256::from_slice(&[0x42; 32]);
let eth1_block_hash = eth1_block_hash;
let eth1_timestamp = 2_u64.pow(40);
let amount = spec.max_effective_balance;
@@ -73,8 +76,13 @@ mod test {
let keypairs = generate_deterministic_keypairs(validator_count);
let state = interop_genesis_state::<TestEthSpec>(&keypairs, genesis_time, spec)
.expect("should build state");
let state = interop_genesis_state::<TestEthSpec>(
&keypairs,
genesis_time,
Hash256::from_slice(DEFAULT_ETH1_BLOCK_HASH),
spec,
)
.expect("should build state");
assert_eq!(
state.eth1_data().block_hash,

View File

@@ -4,5 +4,5 @@ mod interop;
pub use eth1::Config as Eth1Config;
pub use eth1_genesis_service::{Eth1GenesisService, Statistics};
pub use interop::interop_genesis_state;
pub use interop::{interop_genesis_state, DEFAULT_ETH1_BLOCK_HASH};
pub use types::test_utils::generate_deterministic_keypairs;