feat: add 34-slot TTL for ValidatorRegistration and VoluntaryExit messages#711
Conversation
…sages This change adds time-to-live validation for ValidatorRegistration and VoluntaryExit messages, which previously had no lateness checks. Background: - ValidatorRegistration and VoluntaryExit messages are non-consensus messages that skip QBFT and don't require strict timing - However, accepting arbitrarily old messages can lead to: - Replay attacks from malicious nodes - Resource exhaustion from processing stale duties - Inefficient network traffic This change: - Adds a 34-slot (slots_per_epoch + LATE_SLOT_ALLOWANCE) TTL - Aligns with existing Committee/Aggregator role TTL - Works seamlessly with doppelgänger protection (PR sigp#692): - During grace period: All messages ignored (including replays) - After grace period: Old messages naturally rejected by TTL Benefits: - Prevents replay attacks: Messages older than 34 slots rejected - Supports doppelgänger protection: Grace period prevents false positives - Maintains consistency: Same TTL pattern as other non-time-critical roles - No breaking changes: Only affects message validation timing
|
Claude encountered an error —— View job Code Review in Progress
|
|
Claude will probably and rightfully complain about the lack of tests. I'll make sure to add it later. |
…yExit Add comprehensive test coverage for the 34-slot TTL validation window: - ValidatorRegistration within TTL (accepted) - ValidatorRegistration beyond TTL (rejected) - VoluntaryExit within TTL (accepted) - VoluntaryExit beyond TTL (rejected) Test implementation includes: - Helper functions to eliminate code duplication - Named constants for all timing values - Clear setup/execute/assert structure in each test All 41 message_validator tests pass.
|
cc @nkryuchkov |
|
Claude finished @diegomrsantos's task —— View job Code Review CompleteSummaryThis PR adds 34-slot TTL (Time-To-Live) validation for Changes Overviewlib.rs (
partial_signature.rs (
Review FindingsCode Quality: ✅ ExcellentStrengths:
Minor Observations:
Security: ✅ GoodPositive Security Impact:
No Security Concerns Identified:
Testing: ✅ ComprehensiveTest Coverage Added:
Test Quality:
Note: The author acknowledged in comments that tests were missing initially and added them in commit Performance: ✅ No Impact
Documentation:
|

Issue Addressed
Related to #692
Proposed Changes
Adds time-to-live validation for ValidatorRegistration and VoluntaryExit messages, which previously had no lateness checks. These messages now use the same 34-slot TTL as Committee and Aggregator roles.
This enables more resilient operator doppelgänger protection by:
Additional Info
The 34-slot window sets the stage for a longer doppelgänger protection grace period, ensuring no vulnerability gaps between restart and validation.