test(db-sync): add off-chain voting anchor tests#3498
Draft
ArturWieczorek wants to merge 1 commit into
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 (warningrecords why)NULL- not valid JSON (error object injson, rawbytespreserved)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: optionalvoting_anchor_idto select thecorrect row when several anchors share the same content hash; assert
is_valid.GovActionProposalDBRow.param_proposalmade nullable - it isNULLfor info actionsand only set for parameter-change actions.
test_pparam_updatestill passes.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:masterand this branch is rebased on it;NON_CONFORMANT_ANCHOR_URL(tinyurl.com/7nz8964r) andINVALID_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.