-
Notifications
You must be signed in to change notification settings - Fork 16
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
verification-key: support DRep keys as well as committee keys, extended or not #652
Conversation
255a3c9
to
a0d287e
Compare
cardano-cli/src/Cardano/CLI/Read.hs
Outdated
@@ -721,6 +721,8 @@ readWitnessSigningData (KeyWitnessSigningData skFile mbByronAddr) = do | |||
-- A Byron address should only be specified along with a Byron signing key. | |||
Left ReadWitnessSigningDataSigningKeyAndAddressMismatch | |||
where | |||
-- If you update these variables, consider updating the ones with the same | |||
-- names in Cardano.CLI.Read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is confusing - it's Cardano.CLI.Read
module. Copy & paste error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, copy/paste error. good catch! Corrected 👍
H.noteM_ $ bracketSem semaphore $ \skeyFile -> execCardanoCLI | ||
[ "conway", "key", "verification-key" | ||
, "--signing-key-file", skeyFile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need a semaphore for the signing key. It's used as an input here (only read), so protecting it seems redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed 👍
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 | ||
H.noteM_ $ bracketSem extendedColdCCSkeySem $ \skeyFile -> execCardanoCLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semaphore for input file (which is only read) seems redundant here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work.
txBody <- noteInputFile "test/cardano-cli-golden/files/input/governance/drep/extended-key-signing/tx.body" | ||
|
||
outFile <- H.noteTempFile tempDir "outFile" | ||
outGold <- H.note "test/cardano-cli-golden/files/golden/governance/drep/extended-key-signing/tx.signed" | ||
|
||
void $ execCardanoCLI | ||
H.noteShowM_ $ bracketSem extendedDRepSkeySem $ \skeyFile -> execCardanoCLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semaphore for an input key (which is only read here) seems redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, semaphore is only needed for concurrent writes, so not for input files, only golden ones!
vkeyFileOut <- noteTempFile tempDir "drep.extended.vkey" | ||
goldenFile <- H.note "cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep-extended.vkey.out" | ||
|
||
H.noteShowM_ $ bracketSem extendedDRepSkeySem $ \skeyFile -> execCardanoCLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same case - semaphore for input file is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed 👍
case v of | ||
Object inner -> | ||
return $ Object $ Aeson.KeyMap.delete (Aeson.fromText "description") inner | ||
Array _ -> failWrongType "array" | ||
Number _ -> failWrongType "number" | ||
Bool _ -> failWrongType "bool" | ||
String _ -> failWrongType "string" | ||
Null -> failWrongType "null" | ||
where | ||
failWrongType got = do | ||
H.note_ $ "Expected object but got: " <> got | ||
H.failure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about using lens-aeson
here?
case v of | |
Object inner -> | |
return $ Object $ Aeson.KeyMap.delete (Aeson.fromText "description") inner | |
Array _ -> failWrongType "array" | |
Number _ -> failWrongType "number" | |
Bool _ -> failWrongType "bool" | |
String _ -> failWrongType "string" | |
Null -> failWrongType "null" | |
where | |
failWrongType got = do | |
H.note_ $ "Expected object but got: " <> got | |
H.failure | |
v & L.atKey "description" .~ Nothing |
Matching on Value
constructors seems a bit excessive here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I assume right that the lens will not fail if the Value
is not an Object
? (it will simply do nothing)
That's just for me to know, behavior is fine for me in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. That's how I understand the signature. Something similar to alter
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carbolymer> this would be the first time we use lens
and lens-aeson
in this repo, which I'm not comfortable to add myself. It's quite something we are pulling here, so I rather keep my lowtech initial version.
5b890c5
to
21df4d3
Compare
21df4d3
to
111f71e
Compare
111f71e
to
2b374d0
Compare
Changelog
Context
Fixes #651
How to trust this PR
Checklist