Commit 0fda8d4
committed
fix: block outgoing messages during entire doppelgänger protection window
Fixes critical bug where outgoing messages were not blocked during grace
period, allowing competition with potential twin operators and defeating
the purpose of doppelgänger protection.
Problem:
- is_monitoring() returned false during grace period
- Message sender only checked is_monitoring()
- Node sent messages during grace period, competing with potential twins
- Validation masked duplicate messages (only one propose per round accepted)
- Twin detection could fail
Solution:
- Add is_active() method checking both GracePeriod and Monitoring states
- Update message sender to use is_active() instead of is_monitoring()
- Block ALL outgoing messages during entire protection window
- Keep is_monitoring() for detection logic (only active after grace period)
Behavior:
- GracePeriod: Block outgoing messages, skip twin detection
- Monitoring: Block outgoing messages, actively detect twins
- Completed: Allow messages, skip detection
This addresses feedback in PR #692 discussion r2459937843 about validation
masking and the need to focus on message blocking during startup.
Tests:
- Added test_state_is_active() to verify state machine behavior
- Added test_service_is_active_during_grace_period() for service API
- All 9 operator_doppelganger tests passing1 parent ff3c4a9 commit 0fda8d4
File tree
2 files changed
+67
-7
lines changed- anchor
- message_sender/src
- operator_doppelganger/src
2 files changed
+67
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
59 | 61 | | |
60 | | - | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
110 | 114 | | |
111 | | - | |
| 115 | + | |
112 | 116 | | |
113 | | - | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
| |||
247 | 255 | | |
248 | 256 | | |
249 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
250 | 269 | | |
251 | 270 | | |
252 | 271 | | |
| |||
392 | 411 | | |
393 | 412 | | |
394 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
395 | 451 | | |
396 | 452 | | |
397 | 453 | | |
| |||
0 commit comments