Repository navigation
Description
The Conway transaction encoder leaves out the treasury field exactly when it has something to show, because its omission rule is inverted:
ogmios/server/src/Ogmios/Data/Json/Conway.hs
Line 832 in e21e0a6
"treasury" .=? OmitWhen (\_ -> isSJust (Cn.ctbCurrentTreasuryValue x) || Cn.ctbTreasuryDonation x /= mempty)
OmitWhen drops a field when its predicate is true, and this predicate is true when the transaction states the current treasury value or makes a donation. So a Conway transaction with a treasury donation or a stated treasury value has no treasury key at all, and every other Conway transaction gets an empty "treasury": {}. A client that reads treasury donations from nextBlock never sees one, and the JSON schema accepts both shapes, so schema validation does not catch it. The test vectors regenerated in PR 22 show the pattern: none of the Conway transactions has a treasury key, while all 39 Dijkstra transactions from the same generators have one.
The bug came in with the commit that added the field, on 2024-08-15:
Upstream fixed it on 2026-06-15 and shipped the fix in v7.0.0, whose changelog says "The treasury field on transaction was sometimes ommitted when it should've been present; this is now fixed." The same commit also stops empty outputs and validityInterval fields from showing, in the Allegra to Conway encoders, and updates the JSON schema to match:
This fork branched from upstream on 2025-12-03, before the fix, and its master still has every line that the fix changes. The Dijkstra encoder added in PR 22 already uses the corrected rule:
I'd suggest porting the upstream commit and regenerating the test vectors. Some hunks need adapting, because the fork's Allegra and Dijkstra encoders differ from upstream's. Conway transactions would then carry their treasury value and donation as the schema describes, and the fork would match upstream for all three fields.
Activity