Skip to content

test(db-sync): add off-chain voting anchor tests#3498

Draft
ArturWieczorek wants to merge 1 commit into
masterfrom
artur/offchain-voting-anchor-tests
Draft

test(db-sync): add off-chain voting anchor tests#3498
ArturWieczorek wants to merge 1 commit into
masterfrom
artur/offchain-voting-anchor-tests

Conversation

@ArturWieczorek

Copy link
Copy Markdown
Collaborator

Summary

Conway tests verifying cardano-db-sync's off-chain voting anchor handling
(db-sync PR #2005, issue #1995). When an anchor's hash matches, db-sync stores it
regardless of whether it parses, recording the outcome in off_chain_vote_data.is_valid:

  • TRUE - valid JSON db-sync can decode (CIP-100 / CIP-108 / CIP-119)
  • FALSE - valid JSON it cannot decode against any CIP schema (warning records why)
  • NULL - not valid JSON (error object in json, raw bytes preserved)

Covered for both gov-action (info action) and DRep anchors. Verified end-to-end on a
local dev cluster (db-sync 13.7.1.0).

Helper changes

  • get_action_data / check_action_data: optional voting_anchor_id to select the
    correct row when several anchors share the same content hash; assert is_valid.
  • GovActionProposalDBRow.param_proposal made nullable - it is NULL for info actions
    and only set for parameter-change actions. test_pparam_update still passes.

⚠️ Blocked by #3497 (prerequisite - must merge first)

This branch is code-only and reads the anchor data files from
cardano_node_tests/tests/data/. Those files are added in #3497. Therefore this PR:

⚠️ tinyurl URLs need fixing after #3497 merges

NON_CONFORMANT_ANCHOR_URL (tinyurl.com/7nz8964r) and INVALID_ANCHOR_URL
(tinyurl.com/muy62k9v) currently resolve to personal gists. After #3497 merges,
re-point them to the official committed files under
raw.githubusercontent.com/IntersectMBO/cardano-node-tests (.../tests/data/<file>).
A shortlink is required because an on-chain anchor URL is capped at 128 bytes; the
shortlink strings can stay the same (content is byte-identical, so the locally computed
hashes still match). See the TODO(tinyurl) marker in the test module.

Verify db-sync off-chain voting anchor handling (PR #2005, issue
#1995): an anchor whose hash matches is stored regardless of whether
it parses, with off_chain_vote_data.is_valid set to TRUE (CIP
decodable), FALSE (valid JSON, not decodable) or NULL (not valid
JSON), for both gov-action and DRep anchors.

Supporting helper changes:

- get_action_data / check_action_data: optional voting_anchor_id to
  pick the right row when several anchors share a content hash, and
  assert is_valid.
- GovActionProposalDBRow.param_proposal made nullable; it is NULL for
  info actions and only set for parameter-change actions.

Depends on the anchor data files added in a separate change.
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