Skip to content

Commit

Permalink
Make anchor-data checks opt-in
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Oct 3, 2024
1 parent 9cbaa02 commit e1ec7c8
Show file tree
Hide file tree
Showing 24 changed files with 55 additions and 203 deletions.
38 changes: 15 additions & 23 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3571,29 +3571,21 @@ pAnchorDataHash =

pMustCheckHash :: String -> String -> String -> String -> Parser (MustCheckHash anchorData)
pMustCheckHash flagSuffix' dataName' hashParamName' urlParamName' =
asum
[ Opt.flag' CheckHash $
mconcat
[ Opt.long ("check-" ++ flagSuffix')
, Opt.help
( "Check the "
++ dataName'
++ " hash (from "
++ hashParamName'
++ ") by downloading "
++ dataName'
++ " data (from "
++ urlParamName'
++ ")."
)
]
, Opt.flag' TrustHash $
mconcat
[ Opt.long ("trust-" ++ flagSuffix')
, Opt.help
("Do not check the " ++ dataName' ++ " hash (from " ++ hashParamName' ++ ") and trust it is correct.")
]
]
Opt.flag TrustHash CheckHash $
mconcat
[ Opt.long ("check-" ++ flagSuffix')
, Opt.help
( "Check the "
++ dataName'
++ " hash (from "
++ hashParamName'
++ ") by downloading "
++ dataName'
++ " data (from "
++ urlParamName'
++ ")."
)
]

pPotentiallyCheckedAnchorData
:: Parser (MustCheckHash anchorDataType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ hprop_golden_conway_governance_action_view_constitution_json =
, proposalHash
, "--anchor-url"
, "proposal-dummy-url"
, "--trust-anchor-data"
, "--governance-action-deposit"
, "10"
, "--deposit-return-stake-verification-key-file"
Expand All @@ -172,7 +171,6 @@ hprop_golden_conway_governance_action_view_constitution_json =
, "http://my-great-constitution.rocks"
, "--constitution-hash"
, constitutionHash
, "--trust-constitution-hash"
]

goldenActionViewFile <-
Expand Down Expand Up @@ -469,7 +467,6 @@ hprop_golden_conway_governance_action_create_protocol_parameters_update_partial_
, "--anchor-data-hash"
, "c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745"
, "--mainnet"
, "--trust-anchor-data"
, "--deposit-return-stake-verification-key-file"
, stakeAddressVKeyFile
, "--governance-action-deposit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ hprop_golden_governance_UpdateCommittee =
, "http://dummy"
, "--anchor-data-hash"
, proposalHash
, "--trust-anchor-data"
, "--add-cc-cold-verification-key-file"
, coldCCVkey1
, "--epoch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ hprop_golden_governance_drep_registration_certificate_vkey_file = propertyOnce .
, "--key-reg-deposit-amt", "0"
, "--drep-metadata-url", "dummy-url"
, "--drep-metadata-hash", "52e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2"
, "--trust-drep-metadata-hash"
, "--out-file", outFile
]

Expand All @@ -237,7 +236,6 @@ hprop_golden_governance_drep_registration_certificate_id_hex = propertyOnce . H.
, "--key-reg-deposit-amt", "0"
, "--drep-metadata-url", "dummy-url"
, "--drep-metadata-hash", "52e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2"
, "--trust-drep-metadata-hash"
, "--out-file", outFile
]

Expand All @@ -257,7 +255,6 @@ hprop_golden_governance_drep_registration_certificate_id_bech32 = propertyOnce .
, "--key-reg-deposit-amt", "0"
, "--drep-metadata-url", "dummy-url"
, "--drep-metadata-hash", "52e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2"
, "--trust-drep-metadata-hash"
, "--out-file", outFile
]

Expand All @@ -276,7 +273,6 @@ hprop_golden_governance_drep_registration_certificate_script_hash = propertyOnce
, "--key-reg-deposit-amt", "0"
, "--drep-metadata-url", "dummy-url"
, "--drep-metadata-hash", "52e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2"
, "--trust-drep-metadata-hash"
, "--out-file", outFile
]

Expand All @@ -296,7 +292,6 @@ hprop_golden_governance_drep_update_certificate_vkey_file = propertyOnce . H.mod
, "--drep-verification-key-file", drepVKeyFile
, "--drep-metadata-url", "dummy-url"
, "--drep-metadata-hash", "52e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2"
, "--trust-drep-metadata-hash"
, "--out-file", outFile
]

Expand All @@ -314,9 +309,6 @@ hprop_golden_governance_drep_update_certificate_script_hash = propertyOnce . H.m
, "--drep-script-hash", "8f33600845940d65bdbc7ea7a247a7997aa8558649128fa82c4c0468"
, "--drep-metadata-url", "https://raw.githubusercontent.com/cardano-foundation/CIPs/master/CIP-0119/examples/drep.jsonld"
, "--drep-metadata-hash", "fecc1773db89b45557d82e07719c275f6877a6cadfd2469f4dc5a7df5b38b4a4"
, "--trust-drep-metadata-hash" -- This is to avoid connecting to GitHub during tests, but it is actually a
-- really good test to run it with "--check-drep-metadata-hash" here,
-- because the URL and hash are correct.
, "--out-file", outFile
]

Expand Down
Loading

0 comments on commit e1ec7c8

Please sign in to comment.