You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix notification forwarding to avoid duplicate messages and handle lag (#4848)
## Motivation
The notification forwarding system has two bugs:
1. **Duplicate messages to exporters**: When validators have multiple
proxies, each proxy forwards notifications to all exporters. This means
exporters receive duplicate notifications (N copies for N proxies),
causing redundant processing and potential data inconsistencies.
2. **Receiver lag crashes forwarding**: The broadcast receiver for
notifications can lag if the consumer is slower than the producer. When
lag occurs, the code treats `RecvError::Lagged` as a fatal error and
exits the forwarding loop, stopping all notification forwarding
permanently even though the channel is still functional.
Both issues reduce system reliability and create operational problems
that are difficult to diagnose.
## Proposal
**Fix duplicate forwarding:**
- Add `exporter_forwarded` flag to track whether exporters have been
included
- Only the first proxy forwards to exporters, subsequent proxies forward
to an empty exporter list
- Each proxy still forwards to its own validator endpoint
**Fix lag handling:**
- Replace `while let Ok()` pattern with explicit `match` on receiver
result
- Handle `RecvError::Lagged(skipped_count)` by logging a warning and
continuing
- Handle `RecvError::Closed` by logging and breaking (legitimate
shutdown)
- Only actually lagged/skipped messages trigger the warning, not every
message
This ensures exporters receive exactly one copy of each notification and
forwarding continues even when temporary lag occurs.
## Test Plan
1. Deploy network with multiple proxies (2+) and exporters
2. Verify exporters receive exactly one copy of each notification (not N
copies)
3. Generate high notification load to induce receiver lag
4. Verify warning logs appear for lagged messages
5. Confirm notification forwarding continues after lag events
6. Verify no duplicate processing in exporter/indexer
## Release Plan
- These changes should be backported to the latest `testnet` branch,
then
- be released in a validator hotfix.
0 commit comments