Skip to content

test: harden scripts/:hash/redeemers and governance-purpose coverage - #107

Merged
slowbackspace merged 4 commits into
mainfrom
test/scripts-redeemers-robustness
Aug 21, 2026
Merged

test: harden scripts/:hash/redeemers and governance-purpose coverage#107
slowbackspace merged 4 commits into
mainfrom
test/scripts-redeemers-robustness

Conversation

@slowbackspace

@slowbackspace slowbackspace commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Eight new preview fixtures for the redeemer endpoints, all pinned against live Blockfrost (verified 20/20 with the internal runner). They close the coverage gaps that recent backend work surfaced: spend attribution, cross-script attribution, failed-tx exclusion, desc invariants, and the Conway governance purposes.

Fixtures

Fixture What it guards
scripts/:hash/redeemers spend purpose Spend attribution resolves through the consumed output's payment credential. Active script, so the fixture pins the asc prefix — append-only history keeps it immutable.
…second script of the same txs The same five txs execute a second script at a different redeemer index. Each endpoint must return only its own script's rows; a per-tx attribution bug makes the two fixtures disagree.
…deep asc window Rows 781–800 of a 36k-row contended dex history. db-sync stores no redeemers for phase-2-failed txs; a backend that wrongly counts them shifts this window on every row.
…desc equals reversed asc + …desc last page The retired golden script (112 rows) makes desc a closed set. Both fixtures derive from one shared row list by construction, so the reversal invariant is pinned, not re-typed.
txs/:hash/redeemers with a vote redeemer A tx mixing spend and vote redeemers. Pins two current-API facts: the vote row is served ahead of the published schema (the serializer does not enforce the purpose enum), and script_hash is empty — db-sync does not attribute voter scripts.
txs/:hash/redeemers with a propose redeemer Same two facts for a parameter-change proposal's guardrails execution.
scripts/:hash/redeemers guardrails script has no attributed rows Because propose redeemers carry no script_hash, the constitution guardrails script (fa24fb30…) has no findable rows — pinned as [].

Note on the three governance fixtures

They accept exactly the two values the two backend generations produce: db-sync-backed deployments return script_hash: "" (governance redeemers are unattributed), ledger-attributing backends return the real script (a11f594d… voter credential, fa24fb30… guardrails). The guardrails scripts/:hash/redeemers fixture accepts an empty page or propose-only rows. Any other value fails, and the classic four purposes stay strictly pinned. Verified green against live BF (preview and mainnet) and against a ledger-attributing backend (dolos, txpipe/dolos#1199) — the tolerance can be tightened to the attributed values once the db-sync behavior is retired.

Refactor note

The existing golden fixture's inline rows were the first 100 of the script's 112 (the endpoint's default count cap). The full history now lives in one GOLDEN_SCRIPT_ROWS const; the original fixture pins slice(0, 100) of it, byte-identical behavior.

🤖 Generated with Claude Code

New preview fixtures, all pinned against live Blockfrost:

- spend purpose: asc prefix of an active dex validator (attribution
  through input resolution), plus the second script the same five txs
  execute at a different redeemer index — a cross-attribution guard.
- deep asc window (rows 781-800 of a 36k-row contended history):
  shifts if a backend wrongly counts phase-2-failed executions.
- desc invariants on the retired golden script: desc equals reversed
  asc, derived from one shared row list, both pages.
- governance purposes: a tx mixing spend and vote redeemers and a
  parameter-change proposal tx. Both pin the current API facts: vote
  and propose rows are served ahead of the published schema and carry
  an empty script_hash (db-sync does not attribute governance
  redeemers). The guardrails script itself therefore has no
  attributed rows on scripts/:hash/redeemers — pinned as [].

The golden script's full 112-row history now lives in one const; the
original fixture pins the first 100 rows of it unchanged.
The propose-redeemer tx (51f495aa…, a parameter-change proposal) and
the guardrails script's empty scripts/:hash/redeemers answer, same
facts as the preview fixtures: rows served ahead of the published
schema, script_hash left empty by db-sync.
db-sync leaves vote and propose redeemers unattributed, so the current
API returns script_hash ""; a ledger-attributing backend returns the
real script (the voter credential, the guardrails script). The
governance fixtures now accept exactly these two values per field, and
the guardrails scripts/:hash/redeemers fixture accepts an empty page
or propose-only rows. Any other value still fails. The four classic
purposes stay strictly pinned — both backends agree there.
@slowbackspace
slowbackspace merged commit c87e0b1 into main Aug 21, 2026
2 checks passed
@michalrus
michalrus deleted the test/scripts-redeemers-robustness branch August 27, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant