Add off-chain voting anchor tests#3498
Open
ArturWieczorek wants to merge 1 commit into
Open
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. The test vector files use short names so their public raw-content URLs stay under the 128-byte on-chain anchor limit; the URLs are kept as PUBLIC_ACTION_ANCHOR_* constants in common. 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.
56ebbcb to
7f2eee1
Compare
Collaborator
Author
|
Local cluster tests: 💚 Full log: |
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.
Helper changes
get_action_data/check_action_data: optionalvoting_anchor_idto select the correct row when several anchors share the same content hash;check_action_datanow assertsis_validisTRUE.GovActionProposalDBRow.param_proposalmade nullable - it isNULLfor info actions and only set for parameter-change actions.test_pparam_updatestill passes.Anchor data files and URLs
Each vector lives in a committed file under
cardano_node_tests/tests/data/, fetched by db-sync over HTTP from its publicraw.githubusercontent.comURL. The URLs are kept asPUBLIC_ACTION_ANCHOR_*constants incommon.py, following #3531 (no tinyurl). File names are short so the raw URL stays under the 128-byte on-chain anchor limit:ga_anchor.json- conformant (already on master)ga_anchor_nonconf.json- valid JSON, not CIP-decodablega_anchor_invalid.json- not valid JSONThe last two were added with long names in #3497 and are renamed here.
Verification
Verified end-to-end on a local dev cluster - 5 passed on db-sync
13.7.2.1(revdb8cdf6, which includes PR #2005):Note on CI / merge order
The
ga_anchor_nonconf.json/ga_anchor_invalid.jsonURLs point atmaster, so the four non-conformant / invalid tests only go green once those renamed files are onmaster(the same bootstrap this PR originally had with #3497). The conformant test passes already. Local verification used a byte-identical shortlink for the two pending files - hashes are computed from the committed files, so db-sync behaves identically once the URLs resolve.