Skip to content

Conversation

@ozgb
Copy link
Contributor

@ozgb ozgb commented Jan 30, 2026

Overview

Redemption UTxOs already have the correct stake credentials in their address, so the dedicated redemption queries (which decode datums) are unnecessary. The standard asset_create/asset_spend queries catch redemption UTxOs via their cNIGHT policy ID.

We have performed limited testing on redemption UTXO observation - removing this code improves our test coverage.

Includes a v0→v1 storage migration that clears UtxoOwners and resets NextCardanoPosition to trigger a full replay from genesis.

Redemption contract analysis

The Redemption validator enforces that the continuing UTxO preserves its staking credential across thaws. On-chain verification of all 7,601 unspent Redemption UTxOs (as of 25/12/25) confirms:

  • 0 mismatches between address staking credential and datum staking credential
  • Only 111 out of 7,601 redemption UTxOs (1.46%) use enterprise addresses with no staking credential — these are correctly handled by the existing asset queries
  • 3 UTxOs have no inline datum (edge cases)
Contract Payment Credential Address Type
RedemptionSupply 9015199b... Enterprise script (addr1w) — single address
Redemption 5986bfcc... Base script+keyhash (addr1z) — one per user

The Redemption script's thaw validator (Terms.hs:211) enforces:

(outAddress == Address (ScriptCredential ownHash) stakingCredential)                                       

This means the delegation part of the UTxO address is preserved across thaws, so address-based queries are reliable without datum decoding.

🗹 TODO before merging

  • Confirm the percentage of stake-less redemption UTxOs is still small with latest db-sync snapshot
  • Ensure we have a clean path to upgrade
  • Ready

📌 Submission Checklist

  • Changes are backward-compatible (or flagged if breaking)
  • Pull request description explains why the change is needed
  • Self-reviewed the diff
  • I have included a change file, or skipped for this reason:
  • If the changes introduce a new feature, I have bumped the node minor version
  • Update documentation (if relevant)
  • Updated AGENTS.md if build commands, architecture, or workflows changed
  • No new todos introduced

🧪 Testing Evidence

Please describe any additional testing aside from CI:

  • Additional tests are provided (if possible)

🔱 Fork Strategy

  • Node Runtime Update
  • Node Client Update
  • Other:
  • N/A

Links

Redemption UTxOs already have the correct stake credentials in their
address, so the dedicated redemption queries (which decode datums) are
unnecessary. The standard asset_create/asset_spend queries will catch
redemption UTxOs via their cNIGHT policy ID.

Includes a v0->v1 storage migration that clears UtxoOwners and resets
NextCardanoPosition to trigger a full replay from genesis.
@github-actions
Copy link
Contributor

kics-logo

KICS version: v2.1.16

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 94
LOW LOW 12
INFO INFO 83
TRACE TRACE 0
TOTAL TOTAL 189
Metric Values
Files scanned placeholder 28
Files parsed placeholder 28
Files failed to scan placeholder 0
Total executed queries placeholder 73
Queries failed to execute placeholder 0
Execution time placeholder 6

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.

2 participants