Skip to content

Commit

Permalink
plumb through Electra attestation callbacks (#6586)
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec authored Sep 27, 2024
1 parent fa8b7e3 commit a441695
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions beacon_chain/consensus_object_pools/attestation_pool.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)),
Expand All @@ -182,7 +181,7 @@ proc init*(T: type AttestationPool, dag: ChainDAGRef,
dag: dag,
quarantine: quarantine,
forkChoice: forkChoice,
onPhase0AttestationAdded: onAttestation,
onPhase0AttestationAdded: onPhase0Attestation,
onElectraAttestationAdded: onElectraAttestation
)

Expand Down
8 changes: 5 additions & 3 deletions beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand All @@ -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) =
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit a441695

Please sign in to comment.