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(
|
let proposer = getProposer(
|
||||||
dag, parent, signed_beacon_block.message.slot).valueOr:
|
dag, parent, signed_beacon_block.message.slot).valueOr:
|
||||||
return err("checkBloblessSignature: Cannot compute proposer")
|
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")
|
return err("checkBloblessSignature: Incorrect proposer")
|
||||||
if not verify_block_signature(
|
if not verify_block_signature(
|
||||||
dag.forkAtEpoch(signed_beacon_block.message.slot.epoch),
|
dag.forkAtEpoch(signed_beacon_block.message.slot.epoch),
|
||||||
|
@ -537,6 +537,7 @@ proc storeBlock(
|
||||||
|
|
||||||
if NewPayloadStatus.invalid == payloadStatus:
|
if NewPayloadStatus.invalid == payloadStatus:
|
||||||
self.consensusManager.quarantine[].addUnviable(signedBlock.root)
|
self.consensusManager.quarantine[].addUnviable(signedBlock.root)
|
||||||
|
self[].dumpInvalidBlock(signedBlock)
|
||||||
return err((VerifierError.UnviableFork, ProcessingStatus.completed))
|
return err((VerifierError.UnviableFork, ProcessingStatus.completed))
|
||||||
|
|
||||||
if NewPayloadStatus.noResponse == payloadStatus:
|
if NewPayloadStatus.noResponse == payloadStatus:
|
||||||
|
|
|
@ -104,15 +104,6 @@ func initiate_validator_exit*(
|
||||||
# Return if validator already initiated exit
|
# Return if validator already initiated exit
|
||||||
let validator = addr state.validators.mitem(index)
|
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))
|
var exit_queue_epoch = compute_activation_exit_epoch(get_current_epoch(state))
|
||||||
# Compute max exit epoch
|
# Compute max exit epoch
|
||||||
for idx in 0..<state.validators.len:
|
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:
|
if exit_epoch != FAR_FUTURE_EPOCH and exit_epoch > exit_queue_epoch:
|
||||||
exit_queue_epoch = exit_epoch
|
exit_queue_epoch = exit_epoch
|
||||||
|
|
||||||
var
|
var exit_queue_churn: uint64
|
||||||
exit_queue_churn: int
|
let validator_churn_limit = get_validator_churn_limit(cfg, state, cache)
|
||||||
for idx in 0..<state.validators.len:
|
for idx in 0..<state.validators.len:
|
||||||
if state.validators.item(idx).exit_epoch == exit_queue_epoch:
|
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):
|
# In spec version, this check occurs only after looping through all
|
||||||
exit_queue_epoch += 1
|
# 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
|
# Set validator exit epoch and withdrawable epoch
|
||||||
validator.exit_epoch = exit_queue_epoch
|
validator.exit_epoch = exit_queue_epoch
|
||||||
|
|
Loading…
Reference in New Issue