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

Update cardano-api to 8.45.0.0 #720

Merged
merged 6 commits into from
Apr 16, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ jobs:
- name: Build all
run: cabal build all --enable-tests

# This step is temporary. We'll soon remove it and check instead
# that golden files have not been modified when creating them below.
- name: Test all
run: cabal test all --enable-tests --test-show-details=direct -j1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by the role this step has. Can you elaborate what problem you are solving with this temporary workaround?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is more context here on Slack. Gist is that we were not checking that golden files are correct.


- # Delete golden files and regenerate them in the next step to ensure
# files that tests designate as golden files are actually golden files
# and can be generated.
Expand Down
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repository cardano-haskell-packages
-- See CONTRIBUTING for information about these, including some Nix commands
-- you need to run if you change them
index-state:
, hackage.haskell.org 2024-03-24T23:16:24Z
, cardano-haskell-packages 2024-04-04T15:00:00Z
, hackage.haskell.org 2024-04-15T08:36:34Z
, cardano-haskell-packages 2024-04-15T08:36:34Z

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 @@ -196,7 +196,7 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.44.0.0
, cardano-api ^>= 8.45.0.0
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
Expand Down
10 changes: 10 additions & 0 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ runNonExtendedKeyCmd
writeToDisk vkf (Just paymentVkeyDesc) (castVerificationKey vk :: VerificationKey PaymentKey)
ADRepExtendedVerificationKey vk ->
writeToDisk vkf (Just drepVkeyDesc) (castVerificationKey vk :: VerificationKey DRepKey)
ACommitteeColdExtendedVerificationKey vk ->
writeToDisk vkf (Just ccColdVkeyDesc) (castVerificationKey vk :: VerificationKey CommitteeColdKey)
ACommitteeHotExtendedVerificationKey vk ->
writeToDisk vkf (Just ccHotVkeyDesc) (castVerificationKey vk :: VerificationKey CommitteeHotKey)
AStakeExtendedVerificationKey vk ->
writeToDisk vkf (Just stakeVkeyDesc) (castVerificationKey vk :: VerificationKey StakeKey)
AGenesisExtendedVerificationKey vk ->
Expand All @@ -177,6 +181,8 @@ runNonExtendedKeyCmd
vk@AVrfVerificationKey {} -> goFail vk
vk@AStakeVerificationKey {} -> goFail vk
vk@ADRepVerificationKey {} -> goFail vk
vk@ACommitteeColdVerificationKey{} -> goFail vk
vk@ACommitteeHotVerificationKey{} -> goFail vk
where
goFail nonExtendedKey = left $ KeyCmdExpectedExtendedVerificationKey nonExtendedKey

Expand All @@ -202,6 +208,8 @@ readExtendedVerificationKeyFile evkfile = do
case vKey of
k@APaymentExtendedVerificationKey{} -> return k
k@ADRepExtendedVerificationKey{} -> return k
k@ACommitteeColdExtendedVerificationKey{} -> return k
k@ACommitteeHotExtendedVerificationKey{} -> return k
k@AStakeExtendedVerificationKey{} -> return k
k@AGenesisExtendedVerificationKey{} -> return k
k@AGenesisDelegateExtendedVerificationKey{} -> return k
Expand All @@ -213,6 +221,8 @@ readExtendedVerificationKeyFile evkfile = do
k@AVrfVerificationKey{} -> goFail k
k@AStakeVerificationKey{} -> goFail k
k@ADRepVerificationKey{} -> goFail k
k@ACommitteeColdVerificationKey{} -> goFail k
k@ACommitteeHotVerificationKey{} -> goFail k
where
goFail k = left $ KeyCmdExpectedExtendedVerificationKey k

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
module Test.Golden.Key.NonExtendedKey where

import Control.Monad (void)
import Control.Monad.Extra (forM_)
import System.FilePath ((</>))

import qualified Test.Cardano.CLI.Util as H
import Test.Cardano.CLI.Util (execCardanoCLI, propertyOnce)

import Hedgehog (Property)
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H
import qualified Hedgehog.Extras.Test.Golden as H

{- HLINT ignore "Use camelCase" -}
Expand All @@ -24,8 +24,6 @@ hprop_golden_KeyNonExtendedKey_GenesisExtendedVerificationKey =
nonExtendedFp <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/non-extended-shelley.000.vkey"
outFp <- H.note $ tempDir </> "non-extended-shelley.000.vkey"

H.assertFilesExist [genesisVKeyFp]

-- Convert the `cardano-address` signing key
void $ execCardanoCLI
[ "key", "non-extended-key"
Expand All @@ -44,8 +42,6 @@ hprop_golden_KeyNonExtendedKey_StakeExtendedVerificationKeyShelley =
nonExtendedFp <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/non-extended-stake.000.vkey"
outFp <- H.note $ tempDir </> "non-extended-stake.000.vkey"

H.assertFilesExist [genesisVKeyFp]

-- Convert the `cardano-address` signing key
void $ execCardanoCLI
[ "key", "non-extended-key"
Expand All @@ -64,8 +60,6 @@ hprop_golden_KeyNonExtendedKey_DRepExtendedVerificationKey =
goldenFile <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/non-extended-drep.vkey"
outFp <- H.note $ tempDir </> "non-extended-drep.vkey"

H.assertFilesExist [extendedKeyFile]

void $ execCardanoCLI
[ "conway", "key", "non-extended-key"
, "--extended-verification-key-file", extendedKeyFile
Expand All @@ -83,12 +77,30 @@ hprop_golden_extended_payment_vkey_to_non_extended_vkey =
goldenFile <- H.note "test/cardano-cli-golden/files/golden/key/non-extended-keys/non-extended-payment.vkey"
outFp <- H.note $ tempDir </> "non-extended-payment.vkey"

H.assertFilesExist [extendedKeyFile]

void $ execCardanoCLI
[ "conway", "key", "non-extended-key"
, "--extended-verification-key-file", extendedKeyFile
, "--verification-key-file", outFp
]

H.diffFileVsGoldenFile outFp goldenFile

-- | Test that converting a CC extended verification key yields the expected result.
-- | Execute me with:
-- @cabal test cardano-cli-golden --test-options '-p "/golden extended cc vkey to non extended vkey/"'@
Copy link
Contributor

@newhoggy newhoggy Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not ideal to have these comments here as they can get out of sync with the function name.

Maybe it's worth modifying tast-discover to include the option of reproducing the function name in the test name if that's what we want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like those comments, because they allow me to run one test without having to think about the complex shell command to enter. So far people received those new comments favorably, you're the first one to remark them 🙂 So I'm tempted to leave it here 😇

hprop_golden_extended_cc_vkey_to_non_extended_vkey :: Property
hprop_golden_extended_cc_vkey_to_non_extended_vkey =
let supplyValues = [ "cc-cold.vkey", "cc-hot.vkey" ] in
propertyOnce $ forM_ supplyValues $ \suffix->
H.moduleWorkspace "tmp" $ \tempDir -> do
extendedKeyFile <- H.noteInputFile $ "test/cardano-cli-golden/files/input/key/non-extended-keys/extended-" <> suffix
goldenFile <- H.note $ "test/cardano-cli-golden/files/golden/key/non-extended-keys/non-extended-" <> suffix
outFp <- H.note $ tempDir </> "non-extended-" <> suffix

void $ execCardanoCLI
[ "conway", "key", "non-extended-key"
, "--extended-verification-key-file", extendedKeyFile
, "--verification-key-file", outFp
]

H.diffFileVsGoldenFile outFp goldenFile
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,47 @@ inputs:
- ed7c8f68c194cc763ee65ad22ef0973e26481be058c65005fd39fb93f9c43a20#213
metadata:
'0':
- - '"\DLE@A"'
- '"C"'
- - '"\NAK@A"'
- '"D"'
- - '"0A"'
- '"E"'
- - '"A"'
- '"B"'
- - 1
- 2
- - 11
- 3
- - '"A"'
- '"B"'
- - a
- b
- - '"0A"'
- '"E"'
- - aa
- bb
- - aab
- ba
- - ab
- ba
- - '"\DLE@A"'
- '"C"'
- - '"\NAK@A"'
- '"D"'
- - aab
- ba
- - aba
- - - '"\DLE@A"'
- '"C"'
- - '"\NAK@A"'
- '"D"'
- - '"0A"'
- '"E"'
- - '"A"'
- '"B"'
- - 1
- - - 1
- 2
- - 11
- 3
- - '"A"'
- '"B"'
- - a
- b
- - '"0A"'
- '"E"'
- - aa
- bb
- - aab
- ba
- - ab
- ba
- - '"\DLE@A"'
- '"C"'
- - '"\NAK@A"'
- '"D"'
- - aab
- ba
- - abb
- ba
- - abb
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeColdVerificationKey_ed25519",
"description": "Constitutional Committee Cold Verification Key",
"cborHex": "58200a9d35aa5299580a67b1e43a3a4b6d43ef29c94e56c51ce4c17e9a53c1d0f39a"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeHotVerificationKey_ed25519",
"description": "Constitutional Committee Hot Verification Key",
"cborHex": "5820f010c4332699c6ea1e43b427919860277169382d43d2969b28a110cfa08d955c"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeColdExtendedVerificationKey_ed25519_bip32",
"description": "",
"cborHex": "58400a9d35aa5299580a67b1e43a3a4b6d43ef29c94e56c51ce4c17e9a53c1d0f39aa7f68837c38ef680b2dc8f047581707a32f6fcade23d4e02177d389002484798"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "ConstitutionalCommitteeHotExtendedVerificationKey_ed25519_bip32",
"description": "",
"cborHex": "5840f010c4332699c6ea1e43b427919860277169382d43d2969b28a110cfa08d955c4f178f20955541ce918a6a1352c32536f22677008f9f918d109663e4d2bdc084"
}
12 changes: 6 additions & 6 deletions flake.lock

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

Loading