Commit d0d0422
refactor(sync): drop _SyncStoreView adapter, make SyncService implement StoreView (leanEthereum#730)
_SyncStoreView was a dataclass wrapping a lambda wrapping a getter on
SyncService.store. Three layers of indirection to read two fields.
SyncService can satisfy the StoreView protocol structurally with two
short methods, removing the wrapper without growing the call surface.
Also drops the finalized_slot method from the StoreView protocol.
It was defined on the protocol, implemented on _SyncStoreView and on
FakeStoreView, and never called from backfill_sync. Pure protocol
bloat. Two dead set-but-not-read writes in tests removed too.
The StoreView protocol itself stays. It breaks a real circular
dependency (BackfillSync is imported by SyncService, so the field
type cannot reference SyncService directly), keeps the test seam
(FakeStoreView is 5 lines, no real Store construction needed), and
documents BackfillSync's exact dependency on forkchoice state in
8 lines.
Net: -28 lines, zero behavior change.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 75dfe92 commit d0d0422
3 files changed
Lines changed: 15 additions & 50 deletions
File tree
- src/lean_spec/subspecs/sync
- tests/lean_spec/subspecs/sync
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 58 | + | |
67 | 59 | | |
68 | 60 | | |
69 | 61 | | |
70 | 62 | | |
71 | 63 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | 64 | | |
77 | 65 | | |
78 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 69 | | |
94 | 70 | | |
95 | 71 | | |
| |||
303 | 279 | | |
304 | 280 | | |
305 | 281 | | |
306 | | - | |
307 | | - | |
308 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
309 | 285 | | |
310 | 286 | | |
311 | 287 | | |
312 | 288 | | |
313 | | - | |
| 289 | + | |
314 | 290 | | |
315 | 291 | | |
316 | 292 | | |
| |||
406 | 382 | | |
407 | 383 | | |
408 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
409 | 393 | | |
410 | 394 | | |
411 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 45 | | |
51 | 46 | | |
52 | 47 | | |
| |||
376 | 371 | | |
377 | 372 | | |
378 | 373 | | |
379 | | - | |
380 | 374 | | |
381 | 375 | | |
382 | 376 | | |
| |||
406 | 400 | | |
407 | 401 | | |
408 | 402 | | |
409 | | - | |
| 403 | + | |
410 | 404 | | |
411 | | - | |
412 | 405 | | |
413 | 406 | | |
414 | 407 | | |
| |||
0 commit comments