From 2521721120ef874875bb28b8c75e010b29546dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 6 Feb 2024 10:34:11 +0100 Subject: [PATCH 1/2] Support signing transactions with extended committee keys --- cardano-cli/src/Cardano/CLI/Read.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 51dcd8eda4..d0e43a42ef 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -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 @@ -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) @@ -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 = From f472515f672b1e69379b7e9f4294076af92d8069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 6 Feb 2024 10:40:56 +0100 Subject: [PATCH 2/2] Signing with commmitee extended key: add test --- .../Test/Golden/Governance/Committee.hs | 40 +++++++++++++++++++ .../committee/tx.cold.extended.signed | 5 +++ .../committee/tx.hot.extended.signed | 5 +++ .../committee/cc.extended.cold.skey | 5 +++ .../governance/committee/cc.extended.hot.skey | 5 +++ 5 files changed, 60 insertions(+) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/tx.cold.extended.signed create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/tx.hot.extended.signed create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/governance/committee/cc.extended.cold.skey create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/governance/committee/cc.extended.hot.skey diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Committee.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Committee.hs index 59517e919c..841abdb6b9 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Committee.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Committee.hs @@ -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 \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/tx.cold.extended.signed b/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/tx.cold.extended.signed new file mode 100644 index 0000000000..1cc8732c79 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/tx.cold.extended.signed @@ -0,0 +1,5 @@ +{ + "type": "Witnessed Tx ConwayEra", + "description": "Ledger Cddl Format", + "cborHex": "84a50081825820829e3fd4847f53f0291370fc900b24cc7c7cc4f69676bbed9ca6e281dae9d60a00018182581d6063a11787740d8c90b6d335eefb8bb2f9e23066a3340e8c89d31ed74e1a002b2d03021a000299bd031a010f14d904d901028184108200581c8f4fefcf28017a57b41517a67d56ef4c0dc04181a11d35178dd53f4c1a001e8480f6a100d90102818258200a9d35aa5299580a67b1e43a3a4b6d43ef29c94e56c51ce4c17e9a53c1d0f39a58400598eecd84e9467182b4b027d1d30f0ba54b84367042e805bd817644d5f7905bc5c27c99c4f403226c069d972c8e1ad9adfd1b4945345b65b339cdfa6ae46100f5f6" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/tx.hot.extended.signed b/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/tx.hot.extended.signed new file mode 100644 index 0000000000..2e14c4b94b --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/committee/tx.hot.extended.signed @@ -0,0 +1,5 @@ +{ + "type": "Witnessed Tx ConwayEra", + "description": "Ledger Cddl Format", + "cborHex": "84a50081825820829e3fd4847f53f0291370fc900b24cc7c7cc4f69676bbed9ca6e281dae9d60a00018182581d6063a11787740d8c90b6d335eefb8bb2f9e23066a3340e8c89d31ed74e1a002b2d03021a000299bd031a010f14d904d901028184108200581c8f4fefcf28017a57b41517a67d56ef4c0dc04181a11d35178dd53f4c1a001e8480f6a100d9010281825820f010c4332699c6ea1e43b427919860277169382d43d2969b28a110cfa08d955c584053eb4711d6cf2c9985c36e32d4bdfada2de85fc7c7ad1ac3a8ecb69843f5bc1897acca423934ac9596bf7eeb3e5ab33a43de895e17e786ae3e6df840e8097802f5f6" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/committee/cc.extended.cold.skey b/cardano-cli/test/cardano-cli-golden/files/input/governance/committee/cc.extended.cold.skey new file mode 100644 index 0000000000..37a2148b10 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/committee/cc.extended.cold.skey @@ -0,0 +1,5 @@ +{ + "type": "ConstitutionalCommitteeColdExtendedSigningKey_ed25519_bip32", + "description": "Constitutional Committee Cold Extended Signing Key", + "cborHex": "5880c8b1f328da856c2b3a2534a2338de9a460a1034f02404e019b8925582c55b94724765b6ee5964393ba66f048f6d8b94e2395686af82a87f13ed4af4f7ee9beff0a9d35aa5299580a67b1e43a3a4b6d43ef29c94e56c51ce4c17e9a53c1d0f39aa7f68837c38ef680b2dc8f047581707a32f6fcade23d4e02177d389002484798" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/committee/cc.extended.hot.skey b/cardano-cli/test/cardano-cli-golden/files/input/governance/committee/cc.extended.hot.skey new file mode 100644 index 0000000000..5afd8346c1 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/committee/cc.extended.hot.skey @@ -0,0 +1,5 @@ +{ + "type": "ConstitutionalCommitteeHotExtendedSigningKey_ed25519_bip32", + "description": "Constitutional Committee Hot Extended Signing Key", + "cborHex": "5880e87138d157d31374987c97c2d2b681f0f995734b70367a31ea87f8c3d382345415787fe9fc22d8363bc6826ba6ac9739225bbb6fc73f0005679a6313ef7e6b6af010c4332699c6ea1e43b427919860277169382d43d2969b28a110cfa08d955c4f178f20955541ce918a6a1352c32536f22677008f9f918d109663e4d2bdc084" +}