@@ -2286,18 +2286,6 @@ func upgrade_to_fulu*(
2286
2286
blob_gas_used: pre.latest_execution_payload_header.blob_gas_used,
2287
2287
excess_blob_gas: pre.latest_execution_payload_header.excess_blob_gas)
2288
2288
2289
- var max_exit_epoch = FAR_FUTURE_EPOCH
2290
- for v in pre.validators:
2291
- if v.exit_epoch != FAR_FUTURE_EPOCH :
2292
- max_exit_epoch =
2293
- if max_exit_epoch == FAR_FUTURE_EPOCH :
2294
- v.exit_epoch
2295
- else :
2296
- max (max_exit_epoch, v.exit_epoch)
2297
- if max_exit_epoch == FAR_FUTURE_EPOCH :
2298
- max_exit_epoch = get_current_epoch (pre)
2299
- let earliest_exit_epoch = max_exit_epoch + 1
2300
-
2301
2289
let post = (ref fulu.BeaconState )(
2302
2290
# Versioning
2303
2291
genesis_time: pre.genesis_time,
@@ -2358,54 +2346,19 @@ func upgrade_to_fulu*(
2358
2346
historical_summaries: pre.historical_summaries,
2359
2347
2360
2348
# [New in Electra:EIP6110]
2361
- deposit_requests_start_index: UNSET_DEPOSIT_REQUESTS_START_INDEX ,
2349
+ deposit_requests_start_index: pre.deposit_requests_start_index ,
2362
2350
2363
2351
# [New in Electra:EIP7251]
2364
- deposit_balance_to_consume: 0 .Gwei ,
2365
- exit_balance_to_consume: 0 .Gwei ,
2366
- earliest_exit_epoch: earliest_exit_epoch,
2367
- consolidation_balance_to_consume: 0 .Gwei ,
2368
- earliest_consolidation_epoch:
2369
- compute_activation_exit_epoch (get_current_epoch (pre))
2370
-
2371
- # pending_balance_deposits, pending_partial_withdrawals, and
2372
- # pending_consolidations are default empty lists
2352
+ deposit_balance_to_consume: pre.deposit_balance_to_consume,
2353
+ exit_balance_to_consume: pre.exit_balance_to_consume,
2354
+ earliest_exit_epoch: pre.earliest_exit_epoch,
2355
+ consolidation_balance_to_consume: pre.consolidation_balance_to_consume,
2356
+ earliest_consolidation_epoch: pre.earliest_consolidation_epoch,
2357
+ pending_deposits: pre.pending_deposits,
2358
+ pending_partial_withdrawals: pre.pending_partial_withdrawals,
2359
+ pending_consolidations: pre.pending_consolidations
2373
2360
)
2374
2361
2375
- post.exit_balance_to_consume =
2376
- get_activation_exit_churn_limit (cfg, post[], cache)
2377
- post.consolidation_balance_to_consume =
2378
- get_consolidation_churn_limit (cfg, post[], cache)
2379
-
2380
- # [New in Electra:EIP7251]
2381
- # add validators that are not yet active to pending balance deposits
2382
- var pre_activation: seq [(Epoch , uint64 )]
2383
- for index, validator in post.validators:
2384
- if validator.activation_epoch == FAR_FUTURE_EPOCH :
2385
- pre_activation.add ((validator.activation_eligibility_epoch, index.uint64 ))
2386
- sort (pre_activation)
2387
-
2388
- for (_, index) in pre_activation:
2389
- let balance = post.balances.item (index)
2390
- post.balances[index] = 0 .Gwei
2391
- let validator = addr post.validators.mitem (index)
2392
- validator[].effective_balance = 0 .Gwei
2393
- validator[].activation_eligibility_epoch = FAR_FUTURE_EPOCH
2394
- # Use bls.G2_POINT_AT_INFINITY as a signature field placeholder and
2395
- # GENESIS_SLOT to distinguish from a pending deposit request
2396
- discard post.pending_deposits.add PendingDeposit (
2397
- pubkey: validator[].pubkey,
2398
- withdrawal_credentials: validator[].withdrawal_credentials,
2399
- amount: balance,
2400
- signature: ValidatorSig .infinity,
2401
- slot: GENESIS_SLOT )
2402
-
2403
- # Ensure early adopters of compounding credentials go through the activation
2404
- # churn
2405
- for index, validator in post.validators:
2406
- if has_compounding_withdrawal_credential (validator):
2407
- queue_excess_active_balance (post[], index.uint64 )
2408
-
2409
2362
post
2410
2363
2411
2364
func latest_block_root * (state: ForkyBeaconState , state_root: Eth2Digest ):
0 commit comments