Skip to content

Commit

Permalink
Integrate cardano API 8.44
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadales committed Apr 4, 2024
1 parent c15e0ef commit 87c9b16
Show file tree
Hide file tree
Showing 23 changed files with 490 additions and 460 deletions.
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 2024-03-24T23:16:24Z
, cardano-haskell-packages 2024-03-24T23:54:54Z
, cardano-haskell-packages 2024-04-04T15:00:00Z

packages:
cardano-cli
Expand Down
17 changes: 9 additions & 8 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,17 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.42.0.0
, cardano-api ^>= 8.44.0.0
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
, cardano-crypto-wrapper ^>= 1.5.1
, cardano-data >= 1.1
, cardano-git-rev ^>= 0.2.2
, cardano-ledger-byron >= 1.0.0.2
, cardano-ledger-byron >= 1.0.1.0
, cardano-ping ^>= 0.2.0.13
, cardano-prelude
, cardano-slotting ^>= 0.1
, cardano-slotting ^>= 0.2.0.0
, cardano-strict-containers ^>= 0.1
, cborg >= 0.2.4 && < 0.3
, cborg-json
Expand All @@ -223,11 +223,12 @@ library
, microlens
, network
, optparse-applicative-fork
, ouroboros-consensus >= 0.16
, ouroboros-consensus-cardano >= 0.14.2
, ouroboros-consensus-protocol >= 0.7
, ouroboros-consensus >= 0.17
-- TODO: bump consensus back
, ouroboros-consensus-cardano >= 0.15
, ouroboros-consensus-protocol >= 0.8
, ouroboros-network-api
, ouroboros-network-protocols
, ouroboros-network-protocols ^>=0.8
, parsec
, prettyprinter
, prettyprinter-ansi-terminal
Expand Down Expand Up @@ -343,7 +344,7 @@ test-suite cardano-cli-golden
, cardano-crypto-wrapper
, cardano-data >= 1.1
, cardano-ledger-byron
, cardano-ledger-shelley >=1.7.0.0
, cardano-ledger-shelley >=1.10.0.0
, cardano-strict-containers ^>= 0.1
, cborg
, containers
Expand Down
18 changes: 9 additions & 9 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs
Original file line number Diff line number Diff line change
Expand Up @@ -556,16 +556,16 @@ buildPoolParams nw dir index specifiedRelays = do
. newExceptT $ readFileTextEnvelope (AsVerificationKey AsStakeKey) poolRewardVKF

pure L.PoolParams
{ L.ppId = L.hashKey poolColdVK
, L.ppVrf = L.hashVerKeyVRF poolVrfVK
, L.ppPledge = L.Coin 0
, L.ppCost = L.Coin 0
, L.ppMargin = minBound
, L.ppRewardAcnt =
{ L.ppId = L.hashKey poolColdVK
, L.ppVrf = L.hashVerKeyVRF poolVrfVK
, L.ppPledge = L.Coin 0
, L.ppCost = L.Coin 0
, L.ppMargin = minBound
, L.ppRewardAccount =
toShelleyStakeAddr $ makeStakeAddress nw $ StakeCredentialByKey (verificationKeyHash rewardsSVK)
, L.ppOwners = mempty
, L.ppRelays = lookupPoolRelay specifiedRelays
, L.ppMetadata = L.SNothing
, L.ppOwners = mempty
, L.ppRelays = lookupPoolRelay specifiedRelays
, L.ppMetadata = L.SNothing
}
where
lookupPoolRelay :: Map Word [L.StakePoolRelay] -> Seq.StrictSeq L.StakePoolRelay
Expand Down
18 changes: 9 additions & 9 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -819,16 +819,16 @@ buildPoolParams nw dir index specifiedRelays = do
. newExceptT $ readFileTextEnvelope (AsVerificationKey AsStakeKey) poolRewardVKF

pure L.PoolParams
{ L.ppId = L.hashKey poolColdVK
, L.ppVrf = L.hashVerKeyVRF poolVrfVK
, L.ppPledge = L.Coin 0
, L.ppCost = L.Coin 0
, L.ppMargin = minBound
, L.ppRewardAcnt =
{ L.ppId = L.hashKey poolColdVK
, L.ppVrf = L.hashVerKeyVRF poolVrfVK
, L.ppPledge = L.Coin 0
, L.ppCost = L.Coin 0
, L.ppMargin = minBound
, L.ppRewardAccount =
toShelleyStakeAddr $ makeStakeAddress nw $ StakeCredentialByKey (verificationKeyHash rewardsSVK)
, L.ppOwners = mempty
, L.ppRelays = lookupPoolRelay specifiedRelays
, L.ppMetadata = L.SNothing
, L.ppOwners = mempty
, L.ppRelays = lookupPoolRelay specifiedRelays
, L.ppMetadata = L.SNothing
}
where
lookupPoolRelay
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ runQueryConstitutionHashCmd
where
writeConstitutionHash
:: Maybe (File () Out)
-> Maybe (L.SafeHash L.StandardCrypto L.AnchorData)
-> L.SafeHash L.StandardCrypto L.AnchorData
-> ExceptT QueryCmdError IO ()
writeConstitutionHash mOutFile' cHash =
firstExceptT QueryCmdWriteFileError . newExceptT
Expand Down
30 changes: 4 additions & 26 deletions cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Maybe
import qualified Data.OSet.Strict as OSet
import qualified Data.Set as Set
import Prettyprinter (viaShow)

data ScriptLanguageValidationError
Expand Down Expand Up @@ -326,10 +325,10 @@ votingScriptWitnessSingleton votingProcedures (Just scriptWitness) =
in Map.singleton voter scriptWitness

newtype TxGovDuplicateVotes era =
TxGovDuplicateVotes [L.GovActionId (L.EraCrypto (ShelleyLedgerEra era))]
TxGovDuplicateVotes (VotesMergingConflict era)

instance Error (TxGovDuplicateVotes era) where
prettyError (TxGovDuplicateVotes actionIds) =
prettyError (TxGovDuplicateVotes (VotesMergingConflict (_voter, actionIds))) =
"Trying to merge votes with similar action identifiers: " <> viaShow actionIds <>
". This would cause ignoring some of the votes, so not proceeding."

Expand All @@ -338,36 +337,15 @@ convertToTxVotingProcedures
:: [(VotingProcedures era, Maybe (ScriptWitness WitCtxStake era))]
-> Either (TxGovDuplicateVotes era) (TxVotingProcedures BuildTx era)
convertToTxVotingProcedures votingProcedures = do
VotingProcedures procedure <- foldM f emptyVotingProcedures votingProcedures
VotingProcedures procedure <- first TxGovDuplicateVotes $
foldM f emptyVotingProcedures votingProcedures
pure $ TxVotingProcedures procedure (BuildTxWith votingScriptWitnessMap)
where
votingScriptWitnessMap = foldl (\acc next -> acc `Map.union` uncurry votingScriptWitnessSingleton next)
Map.empty
votingProcedures
f acc (procedure, _witness) = mergeVotingProcedures acc procedure

mergeVotingProcedures :: ()
=> VotingProcedures era
-> VotingProcedures era
-> Either (TxGovDuplicateVotes era) (VotingProcedures era) -- ^ Either an error message, or the merged voting procedures
mergeVotingProcedures vpsa vpsb =
VotingProcedures . L.VotingProcedures <$> foldM mergeVotesOfOneVoter Map.empty allVoters
where
mapa = L.unVotingProcedures (unVotingProcedures vpsa)
mapb = L.unVotingProcedures (unVotingProcedures vpsb)
allVoters = Set.union (Map.keysSet mapa) (Map.keysSet mapb)
mergeVotesOfOneVoter acc voter =
Map.union acc <$> case (Map.lookup voter mapa, Map.lookup voter mapb) of
(Just v, Nothing) -> Right $ Map.singleton voter v -- Take only available value
(Nothing, Just v) -> Right $ Map.singleton voter v -- Take only available value
(Nothing, Nothing) -> Right Map.empty -- No value
(Just va, Just vb) -> -- Here's the case where we're unioning different votes for the same voter
if null intersection -- No conflict: sets of keys from left and right is disjoint
then Right $ Map.singleton voter (Map.union va vb)
else Left $ TxGovDuplicateVotes intersection -- Ooops conflict! Let's report it!
where
intersection = Map.keys $ Map.intersection va vb

proposingScriptWitnessSingleton
:: Proposal era
-> Maybe (ScriptWitness WitCtxStake era)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}

module Test.Golden.Babbage.Transaction.CalculateMinFee
module Test.Golden.Babbage.Transaction.CalculateMinFee
( hprop_golden_babbage_transaction_calculate_min_fee
) where

Expand All @@ -20,6 +20,7 @@ hprop_golden_babbage_transaction_calculate_min_fee = propertyOnce $ do
[ "transaction","calculate-min-fee"
, "--witness-count", "1"
, "--protocol-params-file", protocolParamsJsonFile
, "--reference-script-size", "0"
, "--tx-body-file", txBodyFile
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ hprop_golden_conway_governance_action_create_protocol_parameters_update :: Prope
hprop_golden_conway_governance_action_create_protocol_parameters_update =
propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
stakeAddressVKeyFile <- H.note "test/cardano-cli-golden/files/input/governance/stake-address.vkey"
-- different versions of https://github.com/IntersectMBO/plutus/blob/master/plutus-core/cost-model/data/builtinCostModel.json
-- transformed and compiled together
costModelsFile <- H.note "test/cardano-cli-golden/files/input/governance/costmodels.json"

actionFile <- noteTempFile tempDir "action"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ hprop_golden_shelley_transaction_calculate_min_fee = propertyOnce $ do
, "--byron-witness-count", "10"
, "--witness-count", "5"
, "--protocol-params-file", protocolParamsJsonFile
, "--reference-script-size", "0"
, "--tx-body-file", txBodyFile
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "Governance proposal",
"description": "",
"cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a3031904d212a3009f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f707001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30aff029f01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ff181e1a075bc371f6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745"
"cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a3031904d212a3009f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f707001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30aff029f0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101ff181e1a075bc371f6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745"
}
Loading

0 comments on commit 87c9b16

Please sign in to comment.