Remove uses of beacon_block_and_blobs_sidecar topic (#4682)
* Remove use of beacon_block_and_blobs_sidecar topic This topic goes away with decoupled blocks and blobs. * remove use of getBeaconBlockAndBlobsSidecarTopic from test * update nimbus_light_client.nim
This commit is contained in:
parent
2f36f15b20
commit
5a9e63a029
|
@ -808,7 +808,7 @@ template gossipMaxSize(T: untyped): uint32 =
|
|||
when isFixedSize(T):
|
||||
fixedPortionSize(T)
|
||||
elif T is bellatrix.SignedBeaconBlock or T is capella.SignedBeaconBlock or
|
||||
T is eip4844.SignedBeaconBlockAndBlobsSidecar:
|
||||
T is eip4844.SignedBeaconBlock:
|
||||
GOSSIP_MAX_SIZE_BELLATRIX
|
||||
# TODO https://github.com/status-im/nim-ssz-serialization/issues/20 for
|
||||
# Attestation, AttesterSlashing, and SignedAggregateAndProof, which all
|
||||
|
|
|
@ -822,27 +822,18 @@ proc updateBlocksGossipStatus*(
|
|||
# Individual forks added / removed
|
||||
discard
|
||||
|
||||
template blocksTopic(fork: ConsensusFork, forkDigest: ForkDigest): auto =
|
||||
case fork
|
||||
of ConsensusFork.Phase0 .. ConsensusFork.Capella:
|
||||
getBeaconBlocksTopic(forkDigest)
|
||||
of ConsensusFork.EIP4844:
|
||||
getBeaconBlockAndBlobsSidecarTopic(forkDigest)
|
||||
|
||||
let
|
||||
newGossipForks = targetGossipState - currentGossipState
|
||||
oldGossipForks = currentGossipState - targetGossipState
|
||||
|
||||
for gossipFork in oldGossipForks:
|
||||
let forkDigest = node.dag.forkDigests[].atStateFork(gossipFork)
|
||||
let topic = blocksTopic(gossipFork, forkDigest)
|
||||
node.network.unsubscribe(topic)
|
||||
node.network.unsubscribe(getBeaconBlocksTopic(forkDigest))
|
||||
|
||||
for gossipFork in newGossipForks:
|
||||
let forkDigest = node.dag.forkDigests[].atStateFork(gossipFork)
|
||||
let topic = blocksTopic(gossipFork, forkDigest)
|
||||
node.network.subscribe(
|
||||
topic, blocksTopicParams,
|
||||
getBeaconBlocksTopic(forkDigest), blocksTopicParams,
|
||||
enableTopicMetrics = true)
|
||||
|
||||
node.blocksGossipState = targetGossipState
|
||||
|
@ -1496,43 +1487,15 @@ proc installMessageValidators(node: BeaconNode) =
|
|||
toValidationResult(node.processor[].processSignedBeaconBlock(
|
||||
MsgSource.gossip, signedBlock)))
|
||||
|
||||
if node.dag.cfg.DENEB_FORK_EPOCH != FAR_FUTURE_EPOCH:
|
||||
node.network.addValidator(
|
||||
getBeaconBlockAndBlobsSidecarTopic(forkDigests.eip4844),
|
||||
proc (
|
||||
signedBlock: eip4844.SignedBeaconBlockAndBlobsSidecar
|
||||
): ValidationResult =
|
||||
if node.shouldSyncOptimistically(node.currentSlot):
|
||||
# `shouldSyncOptimistically` is true if all conditions are met:
|
||||
# - `--sync-light-client` is turned on (`conf.nim`)
|
||||
# - Beacon node is out of sync
|
||||
# - Light client sync is close to wall slot
|
||||
#
|
||||
# In that case, the goal is to let the EL know about the latest
|
||||
# light client block header based on sync committees to allow it
|
||||
# to trigger a correct fast sync more quickly.
|
||||
# Due to EL implementation constraints, `engine_forkchoiceUpdated`
|
||||
# is not sufficient for that (as of Capella); it is also required to
|
||||
# provide the full `ExecutionPayload` via `engine_newPayload`.
|
||||
#
|
||||
# Because sync committees sign the parent beacon block, observed
|
||||
# blocks need to be cached in `node.optimisticProcessor` until a
|
||||
# matching `sync_aggregate` is obtained from a followup block.
|
||||
# A valid `sync_aggregate` is considered good enough to optimistically
|
||||
# trigger EL sync. Note that only new heads are provided to the EL
|
||||
# optimistically; finality is always sourced from the DAG.
|
||||
#
|
||||
# With EIP4844, blobs are paired with beacon blocks.
|
||||
# The blob is not relevant for triggering sync on the EL; therefore,
|
||||
# it is discarded here. The blob is re-obtained once the main DAG
|
||||
# sufficiently catches up, and then passed into `node.processor[]`
|
||||
# when `shouldSyncOptimistically` flips to `false`.
|
||||
toValidationResult(
|
||||
node.optimisticProcessor.processSignedBeaconBlock(
|
||||
signedBlock.beacon_block))
|
||||
else:
|
||||
toValidationResult(node.processor[].processSignedBeaconBlock(
|
||||
MsgSource.gossip, signedBlock.beacon_block)))
|
||||
node.network.addValidator(
|
||||
getBeaconBlocksTopic(forkDigests.eip4844),
|
||||
proc (signedBlock: eip4844.SignedBeaconBlock): ValidationResult =
|
||||
if node.shouldSyncOptimistically(node.currentSlot):
|
||||
toValidationResult(
|
||||
node.optimisticProcessor.processSignedBeaconBlock(signedBlock))
|
||||
else:
|
||||
toValidationResult(node.processor[].processSignedBeaconBlock(
|
||||
MsgSource.gossip, signedBlock)))
|
||||
|
||||
template installSyncCommitteeeValidators(digest: auto) =
|
||||
for subcommitteeIdx in SyncSubcommitteeIndex:
|
||||
|
|
|
@ -157,13 +157,10 @@ programMain:
|
|||
toValidationResult(
|
||||
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
|
||||
network.addValidator(
|
||||
getBeaconBlockAndBlobsSidecarTopic(forkDigests.eip4844),
|
||||
proc (
|
||||
signedBlock: eip4844.SignedBeaconBlockAndBlobsSidecar
|
||||
): ValidationResult =
|
||||
getBeaconBlocksTopic(forkDigests.eip4844),
|
||||
proc (signedBlock: eip4844.SignedBeaconBlock): ValidationResult =
|
||||
toValidationResult(
|
||||
optimisticProcessor.processSignedBeaconBlock(
|
||||
signedBlock.beacon_block)))
|
||||
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
|
||||
lightClient.installMessageValidators()
|
||||
waitFor network.startListening()
|
||||
waitFor network.start()
|
||||
|
|
|
@ -23,7 +23,6 @@ const
|
|||
topicAttesterSlashingsSuffix* = "attester_slashing/ssz_snappy"
|
||||
topicAggregateAndProofsSuffix* = "beacon_aggregate_and_proof/ssz_snappy"
|
||||
topicBlsToExecutionChangeSuffix* = "bls_to_execution_change/ssz_snappy"
|
||||
topicBeaconBlockAndBlobsSidecarTopicSuffix* = "beacon_block_and_blobs_sidecar/ssz_snappy"
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/p2p-interface.md#configuration
|
||||
RESP_TIMEOUT* = 10.seconds
|
||||
|
@ -65,10 +64,6 @@ func getAggregateAndProofsTopic*(forkDigest: ForkDigest): string =
|
|||
func getBlsToExecutionChangeTopic*(forkDigest: ForkDigest): string =
|
||||
eth2Prefix(forkDigest) & topicBlsToExecutionChangeSuffix
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/p2p-interface.md#topics-and-messages
|
||||
func getBeaconBlockAndBlobsSidecarTopic*(forkDigest: ForkDigest): string =
|
||||
eth2Prefix(forkDigest) & topicBeaconBlockAndBlobsSidecarTopicSuffix
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/phase0/validator.md#broadcast-attestation
|
||||
func compute_subnet_for_attestation*(
|
||||
committees_per_slot: uint64, slot: Slot, committee_index: CommitteeIndex):
|
||||
|
|
|
@ -24,7 +24,6 @@ suite "Honest validator":
|
|||
getAttesterSlashingsTopic(forkDigest) == "/eth2/00000000/attester_slashing/ssz_snappy"
|
||||
getAggregateAndProofsTopic(forkDigest) == "/eth2/00000000/beacon_aggregate_and_proof/ssz_snappy"
|
||||
getBlsToExecutionChangeTopic(forkDigest) == "/eth2/00000000/bls_to_execution_change/ssz_snappy"
|
||||
getBeaconBlockAndBlobsSidecarTopic(forkDigest) == "/eth2/00000000/beacon_block_and_blobs_sidecar/ssz_snappy"
|
||||
getSyncCommitteeContributionAndProofTopic(forkDigest) == "/eth2/00000000/sync_committee_contribution_and_proof/ssz_snappy"
|
||||
getLightClientFinalityUpdateTopic(forkDigest) == "/eth2/00000000/light_client_finality_update/ssz_snappy"
|
||||
getLightClientOptimisticUpdateTopic(forkDigest) == "/eth2/00000000/light_client_optimistic_update/ssz_snappy"
|
||||
|
|
Loading…
Reference in New Issue