resolve several outstanding items for Electra support; add debug-foo to light client yamux (#6547)
This commit is contained in:
parent
f53b621818
commit
ed2422112c
|
@ -104,7 +104,7 @@ type LightClientConf* = object
|
|||
hidden
|
||||
desc: "Enable the Yamux multiplexer"
|
||||
defaultValue: false
|
||||
name: "enable-yamux" .}: bool
|
||||
name: "debug-enable-yamux" .}: bool
|
||||
|
||||
agentString* {.
|
||||
defaultValue: "nimbus",
|
||||
|
|
|
@ -1249,14 +1249,13 @@ func get_active_balance*(
|
|||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.1/specs/electra/beacon-chain.md#new-queue_excess_active_balance
|
||||
func queue_excess_active_balance(
|
||||
state: var electra.BeaconState, index: ValidatorIndex) =
|
||||
state: var electra.BeaconState, index: uint64) =
|
||||
let balance = state.balances.item(index)
|
||||
if balance > MIN_ACTIVATION_BALANCE.Gwei:
|
||||
let excess_balance = balance - MIN_ACTIVATION_BALANCE.Gwei
|
||||
state.balances.mitem(index) = MIN_ACTIVATION_BALANCE.Gwei
|
||||
debugComment "maybe check return value"
|
||||
discard state.pending_balance_deposits.add(
|
||||
PendingBalanceDeposit(index: index.uint64, amount: excess_balance)
|
||||
PendingBalanceDeposit(index: index, amount: excess_balance)
|
||||
)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.0/specs/electra/beacon-chain.md#new-switch_to_compounding_validator
|
||||
|
@ -1265,7 +1264,7 @@ func switch_to_compounding_validator*(
|
|||
let validator = addr state.validators.mitem(index)
|
||||
if has_eth1_withdrawal_credential(validator[]):
|
||||
validator.withdrawal_credentials.data[0] = COMPOUNDING_WITHDRAWAL_PREFIX
|
||||
queue_excess_active_balance(state, index)
|
||||
queue_excess_active_balance(state, index.uint64)
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.0/specs/electra/beacon-chain.md#new-get_pending_balance_to_withdraw
|
||||
func get_pending_balance_to_withdraw*(
|
||||
|
@ -1298,7 +1297,6 @@ template get_effective_balance_update*(
|
|||
balance - balance mod EFFECTIVE_BALANCE_INCREMENT.Gwei,
|
||||
MAX_EFFECTIVE_BALANCE.Gwei)
|
||||
else:
|
||||
debugComment "amortize validator read access"
|
||||
let effective_balance_limit =
|
||||
if has_compounding_withdrawal_credential(state.validators.item(vidx)):
|
||||
MAX_EFFECTIVE_BALANCE_ELECTRA.Gwei
|
||||
|
@ -1725,7 +1723,6 @@ func queue_entire_balance_and_reset_validator(
|
|||
let validator = addr state.validators.mitem(index)
|
||||
validator[].effective_balance = 0.Gwei
|
||||
validator[].activation_eligibility_epoch = FAR_FUTURE_EPOCH
|
||||
debugComment "check hashlist add return"
|
||||
discard state.pending_balance_deposits.add PendingBalanceDeposit(
|
||||
index: index, amount: balance)
|
||||
|
||||
|
@ -2153,8 +2150,7 @@ func upgrade_to_electra*(
|
|||
# churn
|
||||
for index, validator in post.validators:
|
||||
if has_compounding_withdrawal_credential(validator):
|
||||
debugComment "in theory truncating"
|
||||
queue_excess_active_balance(post[], ValidatorIndex(index))
|
||||
queue_excess_active_balance(post[], index.uint64)
|
||||
|
||||
post
|
||||
|
||||
|
|
|
@ -295,7 +295,6 @@ proc apply_deposit(
|
|||
when typeof(state).kind < ConsensusFork.Electra:
|
||||
increase_balance(state, index.get(), amount)
|
||||
else:
|
||||
debugComment "check hashlist add return"
|
||||
discard state.pending_balance_deposits.add PendingBalanceDeposit(
|
||||
index: index.get.uint64, amount: amount) # [Modified in Electra:EIP-7251]
|
||||
|
||||
|
@ -332,8 +331,6 @@ proc apply_deposit(
|
|||
return err("apply_deposit: too many validators (inactivity_scores)")
|
||||
let new_vidx = state.validators.lenu64 - 1
|
||||
when typeof(state).kind >= ConsensusFork.Electra:
|
||||
debugComment "check hashlist add return"
|
||||
|
||||
# [New in Electra:EIP7251]
|
||||
discard state.pending_balance_deposits.add PendingBalanceDeposit(
|
||||
index: new_vidx, amount: amount)
|
||||
|
@ -636,7 +633,6 @@ proc process_consolidation_request*(
|
|||
cfg, state, source_validator[].effective_balance, cache)
|
||||
source_validator[].withdrawable_epoch =
|
||||
source_validator[].exit_epoch + cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY
|
||||
debugComment "check HashList add return value"
|
||||
discard state.pending_consolidations.add(PendingConsolidation(
|
||||
source_index: source_index.uint64, target_index: target_index.uint64))
|
||||
|
||||
|
|
|
@ -1282,7 +1282,6 @@ func process_pending_balance_deposits*(
|
|||
state.deposit_balance_to_consume =
|
||||
available_for_processing - processed_amount
|
||||
|
||||
debugComment "yet another in-theory-might-overflow-maybe things, look at these more carefully"
|
||||
if len(deposits_to_postpone) > 0:
|
||||
discard state.pending_balance_deposits.add deposits_to_postpone
|
||||
|
||||
|
|
|
@ -696,8 +696,6 @@ proc constructSignableBlindedBlock[T: electra_mev.SignedBlindedBeaconBlock](
|
|||
blindedBlock.message.body.blob_kzg_commitments,
|
||||
blindedBundle.blob_kzg_commitments)
|
||||
|
||||
debugComment "check for any additional electra mev requirements"
|
||||
|
||||
blindedBlock
|
||||
|
||||
func constructPlainBlindedBlock[T: deneb_mev.BlindedBeaconBlock](
|
||||
|
@ -746,8 +744,6 @@ func constructPlainBlindedBlock[T: electra_mev.BlindedBeaconBlock](
|
|||
blindedBlock.body.blob_kzg_commitments,
|
||||
blindedBundle.blob_kzg_commitments)
|
||||
|
||||
debugComment "check for any additional electra mev requirements"
|
||||
|
||||
blindedBlock
|
||||
|
||||
proc blindedBlockCheckSlashingAndSign[
|
||||
|
|
|
@ -286,8 +286,6 @@ cli do(validatorsDir: string, secretsDir: string,
|
|||
forkyState.data.eth1_data,
|
||||
graffitiValue,
|
||||
when typeof(payload).kind == ConsensusFork.Electra:
|
||||
block:
|
||||
debugComment "wss_sim electra aggregates"
|
||||
default(seq[electra.Attestation])
|
||||
else:
|
||||
blockAggregates,
|
||||
|
|
Loading…
Reference in New Issue