2021-03-05 13:12:00 +00:00
|
|
|
# Gossip Processing
|
|
|
|
|
2021-09-27 13:11:10 +00:00
|
|
|
This folder holds a collection of modules to:
|
2021-03-05 13:12:00 +00:00
|
|
|
- validate raw gossip data before
|
2021-09-27 13:11:10 +00:00
|
|
|
- rebroadcasting it (potentially aggregated)
|
|
|
|
- sending it to one of the consensus object pools
|
2021-03-05 13:12:00 +00:00
|
|
|
|
|
|
|
## Validation
|
|
|
|
|
2021-09-27 13:11:10 +00:00
|
|
|
Gossip validation is different from consensus verification in particular for blocks.
|
2021-03-05 13:12:00 +00:00
|
|
|
|
2023-04-21 18:52:43 +00:00
|
|
|
- Blocks: https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#beacon_block
|
2023-07-05 16:02:55 +00:00
|
|
|
- Attestations (aggregated): https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.0/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof
|
2023-04-21 18:52:43 +00:00
|
|
|
- Attestations (unaggregated): https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/p2p-interface.md#attestation-subnets
|
2023-06-13 21:07:39 +00:00
|
|
|
- Voluntary exits: https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#voluntary_exit
|
|
|
|
- Proposer slashings: https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#proposer_slashing
|
2023-06-16 16:45:09 +00:00
|
|
|
- Attester slashing: https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#attester_slashing
|
2021-03-05 13:12:00 +00:00
|
|
|
|
2021-09-27 13:11:10 +00:00
|
|
|
There are multiple consumers of validated consensus objects:
|
2021-03-05 13:12:00 +00:00
|
|
|
- a `ValidationResult.Accept` output triggers rebroadcasting in libp2p
|
2021-09-27 13:11:10 +00:00
|
|
|
- We jump into method `validate(PubSub, Message)` in libp2p/protocols/pubsub/pubsub.nim
|
2021-03-05 13:12:00 +00:00
|
|
|
- which was called by `rpcHandler(GossipSub, PubSubPeer, RPCMsg)`
|
2021-12-06 09:49:01 +00:00
|
|
|
- a `blockValidator` message enqueues the validated object to the processing queue in `block_processor`
|
|
|
|
- `blockQueue: AsyncQueue[BlockEntry]` (shared with request_manager and sync_manager)
|
2021-09-27 13:11:10 +00:00
|
|
|
- This queue is then regularly processed to be made available to the consensus object pools.
|
|
|
|
- a `xyzValidator` message adds the validated object to a pool in eth2_processor
|
|
|
|
- Attestations (unaggregated and aggregated) get collected into batches.
|
|
|
|
- Once a threshold is exceeded or after a timeout, they get validated together using BatchCrypto.
|
2021-03-05 13:12:00 +00:00
|
|
|
|
|
|
|
## Security concerns
|
|
|
|
|
2021-09-27 13:11:10 +00:00
|
|
|
As the first line of defense in Nimbus, modules must be able to handle bursts of data that may come:
|
2021-03-05 13:12:00 +00:00
|
|
|
- from malicious nodes trying to DOS us
|
2021-09-27 13:11:10 +00:00
|
|
|
- from long periods of non-finality, creating lots of forks, attestations
|