Skip to content

Commit

Permalink
Merge pull request #596 from IntersectMBO/smelc/support-cc-extended-s…
Browse files Browse the repository at this point in the history
…igning

Make committee keys able to sign transactions
  • Loading branch information
smelc authored Feb 7, 2024
2 parents e23c8f5 + f472515 commit a71f8ac
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cardano-cli/src/Cardano/CLI/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,9 @@ data SomeSigningWitness
| ADRepSigningWitness (SigningKey DRepKey)
| ADRepExtendedSigningWitness (SigningKey DRepExtendedKey)
| ACommitteeColdSigningWitness (SigningKey CommitteeColdKey)
| ACommitteeColdExtendedSigningWitness (SigningKey CommitteeColdExtendedKey)
| ACommitteeHotSigningWitness (SigningKey CommitteeHotKey)
| ACommitteeHotExtendedSigningWitness (SigningKey CommitteeHotExtendedKey)
deriving Show


Expand Down Expand Up @@ -677,7 +679,9 @@ categoriseSomeSigningWitness swsk =
ADRepSigningWitness sk -> AShelleyKeyWitness (WitnessDRepKey sk)
ADRepExtendedSigningWitness sk -> AShelleyKeyWitness (WitnessDRepExtendedKey sk)
ACommitteeColdSigningWitness sk -> AShelleyKeyWitness (WitnessCommitteeColdKey sk)
ACommitteeColdExtendedSigningWitness sk -> AShelleyKeyWitness (WitnessCommitteeColdExtendedKey sk)
ACommitteeHotSigningWitness sk -> AShelleyKeyWitness (WitnessCommitteeHotKey sk)
ACommitteeHotExtendedSigningWitness sk -> AShelleyKeyWitness (WitnessCommitteeHotExtendedKey sk)

data ReadWitnessSigningDataError
= ReadWitnessSigningDataSigningKeyDecodeError !(FileError InputDecodeError)
Expand Down Expand Up @@ -727,7 +731,9 @@ readWitnessSigningData (KeyWitnessSigningData skFile mbByronAddr) = do
, FromSomeType (AsSigningKey AsDRepKey ) ADRepSigningWitness
, FromSomeType (AsSigningKey AsDRepExtendedKey ) ADRepExtendedSigningWitness
, FromSomeType (AsSigningKey AsCommitteeColdKey ) ACommitteeColdSigningWitness
, FromSomeType (AsSigningKey AsCommitteeColdExtendedKey ) ACommitteeColdExtendedSigningWitness
, FromSomeType (AsSigningKey AsCommitteeHotKey ) ACommitteeHotSigningWitness
, FromSomeType (AsSigningKey AsCommitteeHotExtendedKey ) ACommitteeHotExtendedSigningWitness
]

bech32FileTypes =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,43 @@ hprop_golden_governanceUpdateCommittee =
]

H.diffFileVsGoldenFile outFile goldenAnswerFile

-- | Execute me with:
-- @cabal test cardano-cli-golden --test-options '-p "/golden governance committee cold extended key signing/"'@
hprop_golden_governance_committee_cold_extended_key_signing :: Property
hprop_golden_governance_committee_cold_extended_key_signing =
propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
skeyFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/committee/cc.extended.cold.skey"
txBody <- noteInputFile "test/cardano-cli-golden/files/input/governance/drep/extended-key-signing/tx.body"

outGold <- H.note "test/cardano-cli-golden/files/golden/governance/committee/tx.cold.extended.signed"
outFile <- H.noteTempFile tempDir "outFile"

H.noteM_ $ execCardanoCLI
[ "conway", "transaction", "sign"
, "--tx-body-file", txBody
, "--signing-key-file", skeyFile
, "--out-file", outFile
]

H.diffFileVsGoldenFile outFile outGold

-- | Execute me with:
-- @cabal test cardano-cli-golden --test-options '-p "/golden governance committee hot extended key signing/"'@
hprop_golden_governance_committee_hot_extended_key_signing :: Property
hprop_golden_governance_committee_hot_extended_key_signing =
propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
skeyFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/committee/cc.extended.hot.skey"
txBody <- noteInputFile "test/cardano-cli-golden/files/input/governance/drep/extended-key-signing/tx.body"

outGold <- H.note "test/cardano-cli-golden/files/golden/governance/committee/tx.hot.extended.signed"
outFile <- H.noteTempFile tempDir "outFile"

H.noteM_ $ execCardanoCLI
[ "conway", "transaction", "sign"
, "--tx-body-file", txBody
, "--signing-key-file", skeyFile
, "--out-file", outFile
]

H.diffFileVsGoldenFile outFile outGold
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Witnessed Tx ConwayEra",
"description": "Ledger Cddl Format",
"cborHex": "84a50081825820829e3fd4847f53f0291370fc900b24cc7c7cc4f69676bbed9ca6e281dae9d60a00018182581d6063a11787740d8c90b6d335eefb8bb2f9e23066a3340e8c89d31ed74e1a002b2d03021a000299bd031a010f14d904d901028184108200581c8f4fefcf28017a57b41517a67d56ef4c0dc04181a11d35178dd53f4c1a001e8480f6a100d90102818258200a9d35aa5299580a67b1e43a3a4b6d43ef29c94e56c51ce4c17e9a53c1d0f39a58400598eecd84e9467182b4b027d1d30f0ba54b84367042e805bd817644d5f7905bc5c27c99c4f403226c069d972c8e1ad9adfd1b4945345b65b339cdfa6ae46100f5f6"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Witnessed Tx ConwayEra",
"description": "Ledger Cddl Format",
"cborHex": "84a50081825820829e3fd4847f53f0291370fc900b24cc7c7cc4f69676bbed9ca6e281dae9d60a00018182581d6063a11787740d8c90b6d335eefb8bb2f9e23066a3340e8c89d31ed74e1a002b2d03021a000299bd031a010f14d904d901028184108200581c8f4fefcf28017a57b41517a67d56ef4c0dc04181a11d35178dd53f4c1a001e8480f6a100d9010281825820f010c4332699c6ea1e43b427919860277169382d43d2969b28a110cfa08d955c584053eb4711d6cf2c9985c36e32d4bdfada2de85fc7c7ad1ac3a8ecb69843f5bc1897acca423934ac9596bf7eeb3e5ab33a43de895e17e786ae3e6df840e8097802f5f6"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeColdExtendedSigningKey_ed25519_bip32",
"description": "Constitutional Committee Cold Extended Signing Key",
"cborHex": "5880c8b1f328da856c2b3a2534a2338de9a460a1034f02404e019b8925582c55b94724765b6ee5964393ba66f048f6d8b94e2395686af82a87f13ed4af4f7ee9beff0a9d35aa5299580a67b1e43a3a4b6d43ef29c94e56c51ce4c17e9a53c1d0f39aa7f68837c38ef680b2dc8f047581707a32f6fcade23d4e02177d389002484798"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeHotExtendedSigningKey_ed25519_bip32",
"description": "Constitutional Committee Hot Extended Signing Key",
"cborHex": "5880e87138d157d31374987c97c2d2b681f0f995734b70367a31ea87f8c3d382345415787fe9fc22d8363bc6826ba6ac9739225bbb6fc73f0005679a6313ef7e6b6af010c4332699c6ea1e43b427919860277169382d43d2969b28a110cfa08d955c4f178f20955541ce918a6a1352c32536f22677008f9f918d109663e4d2bdc084"
}

0 comments on commit a71f8ac

Please sign in to comment.