Skip to content

Commit a23c93b

Browse files
authored
fix upgrade to fulu for future beta2 tests (#6898)
1 parent ba934af commit a23c93b

File tree

1 file changed

+9
-56
lines changed

1 file changed

+9
-56
lines changed

Diff for: beacon_chain/spec/beaconstate.nim

+9-56
Original file line numberDiff line numberDiff line change
@@ -2286,18 +2286,6 @@ func upgrade_to_fulu*(
22862286
blob_gas_used: pre.latest_execution_payload_header.blob_gas_used,
22872287
excess_blob_gas: pre.latest_execution_payload_header.excess_blob_gas)
22882288

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-
23012289
let post = (ref fulu.BeaconState)(
23022290
# Versioning
23032291
genesis_time: pre.genesis_time,
@@ -2358,54 +2346,19 @@ func upgrade_to_fulu*(
23582346
historical_summaries: pre.historical_summaries,
23592347

23602348
# [New in Electra:EIP6110]
2361-
deposit_requests_start_index: UNSET_DEPOSIT_REQUESTS_START_INDEX,
2349+
deposit_requests_start_index: pre.deposit_requests_start_index,
23622350

23632351
# [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
23732360
)
23742361

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-
24092362
post
24102363

24112364
func latest_block_root*(state: ForkyBeaconState, state_root: Eth2Digest):

0 commit comments

Comments
 (0)