From 547c043757a6ed512ee1a5b59b41bdeb1652e3aa Mon Sep 17 00:00:00 2001 From: tersec Date: Fri, 27 Sep 2024 09:06:40 +0000 Subject: [PATCH] plumb through Electra attestation callbacks --- beacon_chain/consensus_object_pools/attestation_pool.nim | 5 ++--- beacon_chain/nimbus_beacon_node.nim | 8 +++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/beacon_chain/consensus_object_pools/attestation_pool.nim b/beacon_chain/consensus_object_pools/attestation_pool.nim index be4b3eac95..96c384d6ae 100644 --- a/beacon_chain/consensus_object_pools/attestation_pool.nim +++ b/beacon_chain/consensus_object_pools/attestation_pool.nim @@ -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 ) diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 9a28af46ae..cc223a0280 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -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(