[BUG] dapi: the last PoC StoreCommit often misses the deadline block, so the stage keeps a count one block short #2310
On mainnet the last StoreCommit of a PoC stage often doesn't count, and the stage keeps the count committed a block earlier, about 3% below what the host had generated by then. In regular PoC that count becomes epoch weight. In confirmation PoC it is a reading, and ConfirmationWeight keeps the lowest reading of the epoch.
Below, D is the exchange deadline, the last block that accepts a StoreCommit. The final count is lost in two ways, and both start with a commit that leaves late in its block:
- The commit sent after block D−1 doesn't make it into D and expires (
timeout_heightis D). - The commit sent after D−2 arrives a block late and lands in D. The fresher commit sent after D−1 lands later in the same block and fails with code 1137 (
only one commit per block allowed). This is the collision from #2201. At the deadline it costs a block, because no later commit can follow.
All MsgPoCV2StoreCommit transactions of epochs 464–467 (4 regular PoC stages, 12 confirmation PoC events), failed ones included:
| readings (host × model) | (1) last commit before D | (2) fresher commit rejected in D | one block short | |
|---|---|---|---|---|
| regular PoC | 139 | 15 | 9 | 24 (17%) |
| confirmation PoC, 9 events | 308 | 24 | 37 | 61 (20%) |
| confirmation PoC, epoch 466 events 1–3 | 105 | 84 | 0 | 84 (80%) |
| total | 552 | 123 | 46 | 169 (31%) |
Send heights come from timeout_timestamp, which dapi sets to the latest block time plus 60 s. In all 46 cases of (2) the commit that counted was sent after D−2 and the rejected one after D−1. An expired transaction leaves nothing on chain, so for (1) I can't tell a commit that expired from one that was never sent.
The deadline blocks of epoch 466 events 1–3 all came from one proposer (DC5C5FF1D8…) and carried 12, 4 and 6 transactions, against 38–39 in the block before. Only 4–8 commits sent after D−1 got into each of them.
Mid-stage the same delay costs nothing: in six stages, 9–11% of commits landed two blocks after the height they were sent at, and the next commit carried a higher count.
Cause. CommitWorker.run acts only on its interval ticker (poc_commit_interval_seconds, 5 s by default), and mainnet blocks take ~5.7 s. The tick that first sees a block can fire at any point in it. When it fires late, the transaction reaches the next proposer after the proposal is built. Some proposers leave less time: in eight stages, 49% of the commits aimed at a block DC5C… proposed came a block late, against 3–12% for each of the other proposers. In the last 3 blocks before D the worker sends a new commit while the previous one can still be in the mempool, which is how a late commit from D−2 gets ahead of the fresher one in D.
A second, smaller gap: the commit reads GetFlushedRoot(), the root of the last periodic flush. That flush runs on its own 5 s ticker (StartPeriodicFlush), so the final commit can leave out up to one interval of artifacts the ML nodes already delivered.
Proposed fix (dapi only, I have a PR ready):
- run() also polls the phase tracker every 250 ms and ticks as soon as a new block height appears. The interval ticker stays for retries. tick still sends at most one StoreCommit per observed height (one per model in the final window). A commit sent right after the block has the whole block to reach the proposer, so both (1) and (2) get rarer: (2) needs a commit from D−2 that came a block late.
- maybeSubmitCommit flushes each stage store before reading its flushed root, as submitWeightDistribution already does.
A commit that is late anyway, for example in a block from a proposer like DC5C…, is still lost; the collision in (2) itself belongs to #2201.
The commit worker code involved is the same in release/v0.2.16-post3, upgrade-v0.2.17 and upgrade-v0.2.18.
Related: #2201 (two commits in one block in the final window; it reports no effect on weight, which holds mid-stage but not at D), #2186 (noise in confirmation readings). Epoch 466 ended with 3.2% of its weight trimmed from confirmation_weight (18 of 23 hosts), epoch 465 with 1.5%. I haven't reconstructed per-event readings, so I don't claim how much of that the misses caused.
🔄 Auto-synced from Issue #2310 every hour.