Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #311 - Add Cold Committee Key text envelope #323

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- you need to run if you change them
index-state:
, hackage.haskell.org 2023-08-08T19:56:09Z
, cardano-haskell-packages 2023-10-01T12:37:02Z
, cardano-haskell-packages 2023-10-03T08:51:40Z

packages:
cardano-cli
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.23.1
, cardano-api ^>= 8.23.2
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
Expand Down
3 changes: 3 additions & 0 deletions cardano-cli/src/Cardano/CLI/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ data SomeSigningWitness
| AGenesisDelegateExtendedSigningWitness (SigningKey GenesisDelegateExtendedKey)
| AGenesisUTxOSigningWitness (SigningKey GenesisUTxOKey)
| ADRepSigningWitness (SigningKey DRepKey)
| ACommitteeSigningWitness (SigningKey CommitteeColdKey)


-- | Data required for constructing a Shelley bootstrap witness.
Expand Down Expand Up @@ -652,6 +653,7 @@ categoriseSomeSigningWitness swsk =
AGenesisDelegateExtendedSigningWitness sk -> AShelleyKeyWitness (WitnessGenesisDelegateExtendedKey sk)
AGenesisUTxOSigningWitness sk -> AShelleyKeyWitness (WitnessGenesisUTxOKey sk)
ADRepSigningWitness sk -> AShelleyKeyWitness (WitnessPaymentKey $ castDrep sk)
ACommitteeSigningWitness sk -> AShelleyKeyWitness (WitnessCommitteeColdKey sk)

-- TODO: Conway era - Add constrctor for SigningKey DrepKey to ShelleyWitnessSigningKey
castDrep :: SigningKey DRepKey -> SigningKey PaymentKey
Expand Down Expand Up @@ -704,6 +706,7 @@ readWitnessSigningData (KeyWitnessSigningData skFile mbByronAddr) = do
, FromSomeType (AsSigningKey AsGenesisDelegateExtendedKey ) AGenesisDelegateExtendedSigningWitness
, FromSomeType (AsSigningKey AsGenesisUTxOKey ) AGenesisUTxOSigningWitness
, FromSomeType (AsSigningKey AsDRepKey ) ADRepSigningWitness
, FromSomeType (AsSigningKey AsCommitteeColdKey ) ACommitteeSigningWitness
]

bech32FileTypes =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,40 @@ hprop_golden_shelleyTx = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
-- Check the newly created files have not deviated from the
-- golden files
checkTxCddlFormat referenceTx transactionFile


hprop_golden_checkIfConstitutionalCommitteeKeyCanSign :: Property
hprop_golden_checkIfConstitutionalCommitteeKeyCanSign = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
-- Reference keys
let referenceTx = "test/cardano-cli-golden/files/input/conway/tx"

-- Key filepaths
paymentSignKey <- noteInputFile "test/cardano-cli-golden/files/golden/shelley/transaction-sign/utxo.skey"
-- constitutional committee signing key
paymentSignKey2 <- noteInputFile "test/cardano-cli-golden/files/golden/conway/cold1-cc.skey"
transactionFile <- noteTempFile tempDir "tx-file"
transactionBodyFile <- noteTempFile tempDir "tx-body-file"

-- Create transaction body
void $ execCardanoCLI
[ "conway", "transaction", "build-raw"
, "--tx-in", "f62cd7bc15d8c6d2c8519fb8d13c57c0157ab6bab50af62bc63706feb966393d#0"
, "--tx-out", "addr_test1qpmxr8d8jcl25kyz2tz9a9sxv7jxglhddyf475045y8j3zxjcg9vquzkljyfn3rasfwwlkwu7hhm59gzxmsyxf3w9dps8832xh+1199989833223"
, "--tx-out", "addr_test1vpqgspvmh6m2m5pwangvdg499srfzre2dd96qq57nlnw6yctpasy4+10000000"
, "--fee", "166777"
, "--out-file", transactionBodyFile
]

-- Sign transaction
void $ execCardanoCLI
[ "transaction", "sign"
, "--tx-body-file", transactionBodyFile
, "--signing-key-file", paymentSignKey
, "--signing-key-file", paymentSignKey2
, "--testnet-magic", "42"
, "--out-file", transactionFile
]

-- Check the newly created files have not deviated from the
-- golden files
checkTxCddlFormat referenceTx transactionFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeColdSigningKey_ed25519",
"description": "Constitutional Committee Cold Signing Key",
"cborHex": "5820f213c36a77aea6174875b778d8cc60b4c5a3f47eb3a75c11effe64d2b7ce34db"
}
5 changes: 5 additions & 0 deletions cardano-cli/test/cardano-cli-golden/files/input/conway/tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Witnessed Tx ConwayEra",
"description": "Ledger Cddl Format",
"cborHex": "84a30081825820f62cd7bc15d8c6d2c8519fb8d13c57c0157ab6bab50af62bc63706feb966393d000182a20058390076619da7963eaa588252c45e960667a4647eed69135f51f5a10f2888d2c20ac07056fc8899c47d825cefd9dcf5efba150236e043262e2b43011b0000011764f7be07a200581d604088059bbeb6add02eecd0c6a2a52c06910f2a6b4ba0029e9fe6ed13011a00989680021a00028b79a100828258208dc60533b5dfa60a530955a696323a2ef4f14e8bc95a8f84cf6c441fea4234275840963b5af8b899f154f35cb9effe40474035dad7f403fe5b1a7e70690f69971683b7c99da2fab04e02a28a765815eab76b9c4c8f0cd5b407a8e1cd7e214478560f825820ccb96e5d87424375c30b5d1539be8beca496bd87f48d8a4111145c92575dc22458403531dba28f0eafdd77363efc135ec56ec2e118506b61a26c6f8089aa17402532afc2bd16d92009263b749d49cfe0b97289ba73293e1c18af0c1605cadbe5270cf5f6"
}
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.