From 4bdfdc3b9cb70c2304cf3741f7f87168f7f2ff41 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 18 Jul 2024 16:47:40 +0800 Subject: [PATCH] Make lcli testnet interop genesis use eth1 withdrawal creds --- lcli/src/new_testnet.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lcli/src/new_testnet.rs b/lcli/src/new_testnet.rs index 47db1036d..06449958e 100644 --- a/lcli/src/new_testnet.rs +++ b/lcli/src/new_testnet.rs @@ -258,16 +258,19 @@ fn initialize_state_with_validators( state.fill_randao_mixes_with(eth1_block_hash); for keypair in keypairs.iter() { - let withdrawal_credentials = |pubkey: &PublicKey| { - let mut credentials = hash(&pubkey.as_ssz_bytes()); - credentials[0] = spec.bls_withdrawal_prefix_byte; + let eth1_withdrawal_credentials = |pubkey: &PublicKey| -> Hash256 { + let fake_execution_address = &hash(&pubkey.as_ssz_bytes())[0..20]; + let mut credentials = [0u8; 32]; + credentials[0] = spec.eth1_address_withdrawal_prefix_byte; + credentials[12..].copy_from_slice(fake_execution_address); Hash256::from_slice(&credentials) }; + let amount = spec.max_effective_balance; // Create a new validator. let validator = Validator { pubkey: keypair.0.pk.clone().into(), - withdrawal_credentials: withdrawal_credentials(&keypair.1.pk), + withdrawal_credentials: eth1_withdrawal_credentials(&keypair.1.pk), activation_eligibility_epoch: spec.far_future_epoch, activation_epoch: spec.far_future_epoch, exit_epoch: spec.far_future_epoch, -- 2.45.2