Commit 03e23f0
committed
tapgarden: reorder Confirmed branch so MarkBatchConfirmed writes last
BatchStateConfirmed on main names two different essences with the
same word: an *input state* for the Confirmed branch of the state
machine, and a *mid-branch durable checkpoint* written by
MarkBatchConfirmed. The Confirmed branch published universe proofs,
emitted the supply-commit event, called MarkBatchConfirmed (which
advanced disk state to Confirmed), and then registered the anchor
tx with the re-org watcher via WatchProofs. A crash between
MarkBatchConfirmed and WatchProofs left disk at Confirmed with no
re-org callback registered by us; on restart the fast-forward
skipped the branch entirely, and the re-org watcher's own Start-
time recovery re-registered the anchor tx with its
DefaultUpdateCallback -- silently dropping the universe re-publish
that updateMintingProofs performs on any subsequent re-org.
Dissolve the identity conflation by making MarkBatchConfirmed the
LAST persistence write in the branch. WatchProofs now runs first;
disk-Confirmed genuinely means "every step the Confirmed branch
owes is done." A crash before MarkBatchConfirmed keeps the batch
at Broadcast so the whole branch re-runs on restart -- universe
publish is idempotent, augmenter side is deduped by event_key
(migration 62), storeMintingProof rides upserts, and WatchProofs
against a fresh watcher instance is a first-time registration.
Also rewrite the surrounding comments to describe the new
ordering, note the semantic justification for the restart fast-
forward, and drop the stale TODO on the Finalized case ("confirmed
should just be the final state?") -- that concern is fully
resolved by the new ordering.
Add a ShouldFail atomic.Bool hook to MockProofWatcher and a
testWatchProofsFailureAbortsConfirmation test that forces
WatchProofs to fail, asserts the batch stays at Broadcast (under
the old ordering this assertion would fail because
MarkBatchConfirmed would have run before the WatchProofs failure),
restarts with the mock succeeding, and asserts the batch advances
to Finalized. Pins the ordering invariant against regression.1 parent 50ef886 commit 03e23f0
3 files changed
Lines changed: 143 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
392 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
393 | 397 | | |
394 | 398 | | |
395 | 399 | | |
| |||
1231 | 1235 | | |
1232 | 1236 | | |
1233 | 1237 | | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
| 1238 | + | |
| 1239 | + | |
1237 | 1240 | | |
1238 | 1241 | | |
1239 | 1242 | | |
| |||
1243 | 1246 | | |
1244 | 1247 | | |
1245 | 1248 | | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
1246 | 1278 | | |
1247 | 1279 | | |
1248 | 1280 | | |
| |||
1252 | 1284 | | |
1253 | 1285 | | |
1254 | 1286 | | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
1263 | 1287 | | |
1264 | 1288 | | |
1265 | 1289 | | |
| |||
1271 | 1295 | | |
1272 | 1296 | | |
1273 | 1297 | | |
1274 | | - | |
1275 | 1298 | | |
1276 | 1299 | | |
1277 | 1300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
574 | 580 | | |
575 | 581 | | |
576 | 582 | | |
577 | 583 | | |
578 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
579 | 589 | | |
580 | 590 | | |
581 | 591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2302 | 2302 | | |
2303 | 2303 | | |
2304 | 2304 | | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
2305 | 2397 | | |
2306 | 2398 | | |
2307 | 2399 | | |
| |||
2351 | 2443 | | |
2352 | 2444 | | |
2353 | 2445 | | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
2354 | 2450 | | |
2355 | 2451 | | |
2356 | 2452 | | |
| |||
0 commit comments