plumb through Electra attestation callbacks (#6586)

This commit is contained in:
tersec 2024-09-27 11:30:26 +00:00 committed by GitHub
parent fa8b7e380f
commit a441695c51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -105,7 +105,7 @@ declareGauge attestation_pool_block_attestation_packing_time,
proc init*(T: type AttestationPool, dag: ChainDAGRef,
quarantine: ref Quarantine,
onAttestation: OnPhase0AttestationCallback = nil,
onPhase0Attestation: OnPhase0AttestationCallback = nil,
onElectraAttestation: OnElectraAttestationCallback = nil): T =
## Initialize an AttestationPool from the dag `headState`
## The `finalized_root` works around the finalized_checkpoint of the genesis block
@ -173,7 +173,6 @@ proc init*(T: type AttestationPool, dag: ChainDAGRef,
doAssert status.isOk(), "Error in preloading the fork choice: " & $status.error
debugComment "nothing initializes electra callback externally"
info "Fork choice initialized",
justified = shortLog(getStateField(
dag.headState, current_justified_checkpoint)),
@ -182,7 +181,7 @@ proc init*(T: type AttestationPool, dag: ChainDAGRef,
dag: dag,
quarantine: quarantine,
forkChoice: forkChoice,
onPhase0AttestationAdded: onAttestation,
onPhase0AttestationAdded: onPhase0Attestation,
onElectraAttestationAdded: onElectraAttestation
)

View File

@ -281,8 +281,10 @@ proc initFullNode(
getBeaconTime: GetBeaconTimeFn) {.async.} =
template config(): auto = node.config
proc onAttestationReceived(data: phase0.Attestation) =
proc onPhase0AttestationReceived(data: phase0.Attestation) =
node.eventBus.attestQueue.emit(data)
proc onElectraAttestationReceived(data: electra.Attestation) =
debugComment "electra attestation queue"
proc onSyncContribution(data: SignedContributionAndProof) =
node.eventBus.contribQueue.emit(data)
proc onVoluntaryExitAdded(data: SignedVoluntaryExit) =
@ -295,7 +297,6 @@ proc initFullNode(
node.eventBus.attSlashQueue.emit(data)
proc onElectraAttesterSlashingAdded(data: electra.AttesterSlashing) =
debugComment "electra att slasher queue"
discard
proc onBlobSidecarAdded(data: BlobSidecarInfoObject) =
node.eventBus.blobSidecarQueue.emit(data)
proc onBlockAdded(data: ForkedTrustedSignedBeaconBlock) =
@ -388,7 +389,8 @@ proc initFullNode(
quarantine = newClone(
Quarantine.init())
attestationPool = newClone(AttestationPool.init(
dag, quarantine, onAttestationReceived))
dag, quarantine, onPhase0AttestationReceived,
onElectraAttestationReceived))
syncCommitteeMsgPool = newClone(
SyncCommitteeMsgPool.init(rng, dag.cfg, onSyncContribution))
lightClientPool = newClone(