mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-02 09:46:26 +00:00
add merge gossip validation, except for beaconblocks (#3095)
This commit is contained in:
parent
222674b203
commit
00d066f7dd
@ -35,7 +35,7 @@ import
|
|||||||
slashing_protection, keystore_management],
|
slashing_protection, keystore_management],
|
||||||
./sync/[sync_manager, sync_protocol, request_manager],
|
./sync/[sync_manager, sync_protocol, request_manager],
|
||||||
./rpc/[rest_api, rpc_api],
|
./rpc/[rest_api, rpc_api],
|
||||||
./spec/datatypes/[altair, phase0],
|
./spec/datatypes/[altair, merge, phase0],
|
||||||
./spec/eth2_apis/rpc_beacon_client,
|
./spec/eth2_apis/rpc_beacon_client,
|
||||||
./spec/[
|
./spec/[
|
||||||
beaconstate, forks, helpers, network, weak_subjectivity, signatures,
|
beaconstate, forks, helpers, network, weak_subjectivity, signatures,
|
||||||
@ -1026,31 +1026,36 @@ proc installMessageValidators(node: BeaconNode) =
|
|||||||
|
|
||||||
installPhase0Validators(node.dag.forkDigests.phase0)
|
installPhase0Validators(node.dag.forkDigests.phase0)
|
||||||
|
|
||||||
# Validators introduced in phase0 are also used in altair, but with different
|
# Validators introduced in phase0 are also used in altair and merge, but with
|
||||||
# fork digest
|
# different fork digest
|
||||||
installPhase0Validators(node.dag.forkDigests.altair)
|
installPhase0Validators(node.dag.forkDigests.altair)
|
||||||
|
installPhase0Validators(node.dag.forkDigests.merge)
|
||||||
|
|
||||||
node.network.addValidator(
|
node.network.addValidator(
|
||||||
getBeaconBlocksTopic(node.dag.forkDigests.altair),
|
getBeaconBlocksTopic(node.dag.forkDigests.altair),
|
||||||
proc (signedBlock: altair.SignedBeaconBlock): ValidationResult =
|
proc (signedBlock: altair.SignedBeaconBlock): ValidationResult =
|
||||||
toValidationResult(node.processor[].blockValidator(signedBlock)))
|
toValidationResult(node.processor[].blockValidator(signedBlock)))
|
||||||
|
|
||||||
|
template installSyncCommitteeeValidators(digest: auto) =
|
||||||
for committeeIdx in allSyncSubcommittees():
|
for committeeIdx in allSyncSubcommittees():
|
||||||
closureScope:
|
closureScope:
|
||||||
let idx = committeeIdx
|
let idx = committeeIdx
|
||||||
node.network.addValidator(
|
node.network.addValidator(
|
||||||
getSyncCommitteeTopic(node.dag.forkDigests.altair, idx),
|
getSyncCommitteeTopic(digest, idx),
|
||||||
# This proc needs to be within closureScope; don't lift out of loop.
|
# This proc needs to be within closureScope; don't lift out of loop.
|
||||||
proc(msg: SyncCommitteeMessage): ValidationResult =
|
proc(msg: SyncCommitteeMessage): ValidationResult =
|
||||||
toValidationResult(
|
toValidationResult(
|
||||||
node.processor.syncCommitteeMsgValidator(msg, idx)))
|
node.processor.syncCommitteeMsgValidator(msg, idx)))
|
||||||
|
|
||||||
node.network.addValidator(
|
node.network.addValidator(
|
||||||
getSyncCommitteeContributionAndProofTopic(node.dag.forkDigests.altair),
|
getSyncCommitteeContributionAndProofTopic(digest),
|
||||||
proc(msg: SignedContributionAndProof): ValidationResult =
|
proc(msg: SignedContributionAndProof): ValidationResult =
|
||||||
toValidationResult(
|
toValidationResult(
|
||||||
node.processor.syncCommitteeContributionValidator(msg)))
|
node.processor.syncCommitteeContributionValidator(msg)))
|
||||||
|
|
||||||
|
installSyncCommitteeeValidators(node.dag.forkDigests.altair)
|
||||||
|
installSyncCommitteeeValidators(node.dag.forkDigests.merge)
|
||||||
|
|
||||||
proc stop*(node: BeaconNode) =
|
proc stop*(node: BeaconNode) =
|
||||||
bnStatus = BeaconNodeStatus.Stopping
|
bnStatus = BeaconNodeStatus.Stopping
|
||||||
notice "Graceful shutdown"
|
notice "Graceful shutdown"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user