aztec-packages
aztec-packages copied to clipboard
[FEATURE] Improve P2P Status Message
Problem Statement
P2P Status message should be upgraded to Status handshake.
Proposed Solution
The Status handshake should work similarly to the Ethereum Beacon client Status handshake, i.e.
- The Status message MUST be the first message exchanged between peers (in both directions).
- The Status message MUST pass validation*.
- If the Status handshake validation fails, the peer MUST be disconnected. Depending on the reason, the peer SHOULD be banned**.
- Any other messages SHOULD NOT be exchanged until the Status handshake is validated.
Status message content
- compressedComponentsVersion
- latestBlockNumber
- latestBlockHash
- finalizedBlockNumber
- finalizedBlockHash
*Status message validation
Again, the validation should mimic the one implemented on Ethereum Beacon Chain (link):
-
CompressedComponentsVersionMUST be valid and equal -
latestBlockHashandfinalizedBlockHashMUST be valid (check against the current node's values) 2.1. Our node might be out of sync and not have these values. If the sent numbers are equal to or smaller than our node's, we should ensure they exist and correspond to the correct block numbers. Otherwise, we might be out of sync and should skip this check.
NOTE: In the future, we can upgrade the P2P service as follows:
- If
latestBlockNumberandfinalizedBlockNumberhave a difference larger than D (e.g., 100) from the current node's values, disconnect this peer. The reason is that either our peer or our node is synced, so they should not participate in P2P exchange while the sync is in progress.
**Reasons for banning
- Status message not received
-
CompressedComponentsVersioninvalid
Example Use Case
No response
Alternative Solutions
No response
Additional Context
No response