Compare commits

...

6 Commits

Author SHA1 Message Date
5801d5dea5 Make lcli testnet genesis use EL withdrawal creds (#1)
In order for validators to withdraw staked funds, they need withdrawal credentials containing an execution layer address (and `0x01` prefix).
https://lighthouse-book.sigmaprime.io/voluntary-exit.html#1-how-to-know-if-i-have-the-withdrawal-credentials-type-0x01

The current tooling creates validators with credentials derived from a BLS signature using the initial keypair (with `0x00` prefix). To allow withdrawals, these then have to be updated on the running chain in a separate signed message. By creating validators with EL address credentials at genesis, we avoid this extra step.

Reviewed-on: #1
2024-08-05 13:36:00 +00:00
f6a60be80e Release v5.1.3
-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEyqmiaFUWoDD2agrYd7EwnS5U6RQFAmYFBh4ACgkQd7EwnS5U
 6RSEJgf/agMvtx7ZnhfQXA8D0XE9/R08WrDdymLAhdu8Mrv2Vl2eFc20mpsWwMXm
 85Yoq65u/a01063sjohttUlwIbJbr8OC7USrGupROYOZrdS4e96lIB3nTKHckoSR
 5xuBpXcwtaY83VZsetj1RCy7F3NunWgplXMAg43QTtilMI4m2uNxwitsn1mDNul6
 xE4AeZlumf4LsYJrI1BAc0BsGB0Z19pIVPtSzNz3L66rYtytt9KeW2xCfdA9GOoY
 9iOrxkCk2/e/qHfmld6X2W62KsGz0idX1DT7arbHLTRrzIA8L4rC/3cE/1bDyAFV
 cjIoXcxmE3eMpuc+GGfX2d9Os/TQOw==
 =cipa
 -----END PGP SIGNATURE-----

Merge tag 'v5.1.3' into stable
2024-07-19 00:32:27 +08:00
61bb68f390 Merge upstream, remove local portable build mods 2024-03-17 15:15:58 -06:00
acffbed0a0
Merge branch 'sigp:stable' into stable 2024-02-03 15:38:26 -07:00
f70b3ef11d
Merge branch 'sigp:stable' into stable 2023-10-02 16:33:38 -05:00
1a6c93837c Honor PORTABLE environment variable in lcli build 2023-06-04 20:30:47 +00:00

View File

@ -258,16 +258,19 @@ fn initialize_state_with_validators<T: EthSpec>(
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,