dump EL-INVALID blocks if requested the same way as CL-INVALID blocks; optimize epoch transition validator exit (#6144)
This commit is contained in:
parent
605bf99344
commit
f9e5294802
|
@ -370,7 +370,7 @@ proc checkBloblessSignature(
|
|||
let proposer = getProposer(
|
||||
dag, parent, signed_beacon_block.message.slot).valueOr:
|
||||
return err("checkBloblessSignature: Cannot compute proposer")
|
||||
if uint64(proposer) != signed_beacon_block.message.proposer_index:
|
||||
if distinctBase(proposer) != signed_beacon_block.message.proposer_index:
|
||||
return err("checkBloblessSignature: Incorrect proposer")
|
||||
if not verify_block_signature(
|
||||
dag.forkAtEpoch(signed_beacon_block.message.slot.epoch),
|
||||
|
@ -537,6 +537,7 @@ proc storeBlock(
|
|||
|
||||
if NewPayloadStatus.invalid == payloadStatus:
|
||||
self.consensusManager.quarantine[].addUnviable(signedBlock.root)
|
||||
self[].dumpInvalidBlock(signedBlock)
|
||||
return err((VerifierError.UnviableFork, ProcessingStatus.completed))
|
||||
|
||||
if NewPayloadStatus.noResponse == payloadStatus:
|
||||
|
|
|
@ -104,15 +104,6 @@ func initiate_validator_exit*(
|
|||
# Return if validator already initiated exit
|
||||
let validator = addr state.validators.mitem(index)
|
||||
|
||||
trace "Validator exiting",
|
||||
index = index,
|
||||
num_validators = state.validators.len,
|
||||
current_epoch = get_current_epoch(state),
|
||||
validator_slashed = validator.slashed,
|
||||
validator_withdrawable_epoch = validator.withdrawable_epoch,
|
||||
validator_exit_epoch = validator.exit_epoch,
|
||||
validator_effective_balance = validator.effective_balance
|
||||
|
||||
var exit_queue_epoch = compute_activation_exit_epoch(get_current_epoch(state))
|
||||
# Compute max exit epoch
|
||||
for idx in 0..<state.validators.len:
|
||||
|
@ -120,14 +111,18 @@ func initiate_validator_exit*(
|
|||
if exit_epoch != FAR_FUTURE_EPOCH and exit_epoch > exit_queue_epoch:
|
||||
exit_queue_epoch = exit_epoch
|
||||
|
||||
var
|
||||
exit_queue_churn: int
|
||||
var exit_queue_churn: uint64
|
||||
let validator_churn_limit = get_validator_churn_limit(cfg, state, cache)
|
||||
for idx in 0..<state.validators.len:
|
||||
if state.validators.item(idx).exit_epoch == exit_queue_epoch:
|
||||
exit_queue_churn += 1
|
||||
inc exit_queue_churn
|
||||
|
||||
if exit_queue_churn.uint64 >= get_validator_churn_limit(cfg, state, cache):
|
||||
exit_queue_epoch += 1
|
||||
# In spec version, this check occurs only after looping through all
|
||||
# validators, but it is ultimately a binary decision. Once matching
|
||||
# get_validator_churn_limit(state), it can't validly become less.
|
||||
if exit_queue_churn >= validator_churn_limit:
|
||||
inc exit_queue_epoch
|
||||
break
|
||||
|
||||
# Set validator exit epoch and withdrawable epoch
|
||||
validator.exit_epoch = exit_queue_epoch
|
||||
|
|
Loading…
Reference in New Issue