Skip to content

Commit

Permalink
cardano-testnet: test the "query proposals" CLI command
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Nov 29, 2024
1 parent 07e1a58 commit cd80e0d
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
-- treasury
H.noteM_ $ execCli' execConfig [ eraName, "query", "treasury" ]

TestQueryProposalsCmd -> do
-- query proposals
H.noteM_ $ execCli' execConfig [ eraName, "query", "proposals" ]

where
-- | Wait for the part of the epoch when futurePParams are known
waitForFuturePParamsToStabilise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,18 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new

waitForGovActionVotes epochStateView (EpochInterval 1)

txid <- execCli' execConfig [ eraName, "transaction", "txid", "--tx-file", unFile signedProposalTx ]

-- Uncomment this if you wanna compare the output with "query gov-state":
-- H.noteM_ $ execCli' execConfig [ eraName, "query", "gov-state" ]
let txNoNewline = Text.unpack (Text.strip (Text.pack txid))
H.noteShow_ txNoNewline
H.noteM_ $ execCli' execConfig [ eraName, "query", "proposals", "--governance-action-tx-id", txNoNewline
, "--governance-action-index", "0" ]
-- Command returned:
--
-- []

-- Count votes before checking for ratification. It may happen that the proposal gets removed after
-- ratification because of a long waiting time, so we won't be able to access votes.
govState <- getGovState epochStateView ceo
Expand All @@ -241,6 +253,62 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new
()
(\epochState _ _ -> foldBlocksCheckConstitutionWasRatified constitutionHash constitutionScriptHash epochState)

H.noteM_ $ execCli' execConfig [ eraName, "query", "proposals", "--governance-action-tx-id", txNoNewline
, "--governance-action-index", "0" ]
-- Command returned:
--
-- [
-- {
-- "actionId": {
-- "govActionIx": 0,
-- "txId": "d3877f2694dcd3853abf44506977cbd25f94a26cf887e426f601b29fffb256c3"
-- },
-- "committeeVotes": {},
-- "dRepVotes": {
-- "keyHash-11885af93181919dd2749bf828de656045c78f5d5f511055eec54306": "VoteNo",
-- "keyHash-42cdea9e46396ad3f145b7834c16675ec7962c11648b5c031210ceb1": "VoteYes",
-- "keyHash-8453f733cb6e3d873993c9e94a423b3e4385547381f10a1f4da0b995": "VoteYes",
-- "keyHash-85454551839aab47b09f25e75deff03403047d081ab5ecff6243cb0f": "Abstain",
-- "keyHash-adbcfc9e9bcede4ab2db8d7d85d6f556fa57fa6e2897b31592d9819c": "VoteNo",
-- "keyHash-bbe6163dd619fa83ae1ee3a061639cc50b8305e1d97f2837458fa995": "VoteYes",
-- "keyHash-c4f60d2624acb06de54db22fb25e59818ee62d3e7c2464974d9af728": "Abstain",
-- "keyHash-ec9ac276b3727015dfef084ad251ff6925353581b33e3453bda9fb2f": "VoteNo",
-- "keyHash-f6173095513bf9a575f91251649280890ca9d3849859f28179ec2a63": "VoteYes"
-- },
-- "expiresAfter": 2,
-- "proposalProcedure": {
-- "anchor": {
-- "dataHash": "0ddee8482655dcaf1471243432069483a029bce680457d01f547f6b5f097d73f",
-- "url": "https://tinyurl.com/3wrwb2as"
-- },
-- "deposit": 1000000,
-- "govAction": {
-- "contents": [
-- null,
-- {
-- "anchor": {
-- "dataHash": "c9247db6ab4e0d795bec6aed1b565f92f056d235f777329df546689ca834c46e",
-- "url": "https://tinyurl.com/2pahcy6z"
-- },
-- "script": "186e32faa80a26810392fda6d559c7ed4721a65ce1c9d4ef3e1c87b4"
-- }
-- ],
-- "tag": "NewConstitution"
-- },
-- "returnAddr": {
-- "credential": {
-- "keyHash": "74c5f83aa5ff896923939329a1e46aadc193a44894ef6a9e969a2e22"
-- },
-- "network": "Testnet"
-- }
-- },
-- "proposedIn": 1,
-- "stakePoolVotes": {}
-- }
-- ]

assert False

foldBlocksCheckConstitutionWasRatified
:: String -- submitted constitution hash
-> String -- submitted guard rail script hash
Expand Down

0 comments on commit cd80e0d

Please sign in to comment.