From a3c10e25e8f24cede36d01064f4a07afb0572583 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 20 Nov 2024 16:21:02 -0700 Subject: [PATCH 01/13] Bump Hackage and CHaP indexes --- cabal.project | 4 ++-- flake.lock | 44 ++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cabal.project b/cabal.project index 30bffd7256..2dadea3e3f 100644 --- a/cabal.project +++ b/cabal.project @@ -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-10-10T08:11:33Z - , cardano-haskell-packages 2024-10-14T23:19:53Z + , hackage.haskell.org 2024-12-10T16:20:07Z + , cardano-haskell-packages 2024-12-18T14:29:04Z packages: cardano-api diff --git a/flake.lock b/flake.lock index 785b5bc9f9..99d17f2e77 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1728953092, - "narHash": "sha256-DBqT9uexf/yoZjtEP3263ltnhP/o7iBl8IZdJRfPjJs=", + "lastModified": 1734535858, + "narHash": "sha256-9DzduMA63FdftXjZi5j2JKqxVnU8tC246w8N77MM1fs=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "fd5e5cf056090977ecbd661ad07f602eb7e2614d", + "rev": "9cc1161fab9bafb3d6b7ee28395a732519caf540", "type": "github" }, "original": { @@ -205,11 +205,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1728952051, - "narHash": "sha256-nCNldd8iA8/T3qUKbSFzBmiHu4oFjmgwz0DFrZaUJhU=", + "lastModified": 1733877006, + "narHash": "sha256-rNpSFS/ziUQBPgo6iAbKgU00yRpeCngv215TW0D+kCo=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "1762ac2d3054cb53246ff77e8a6786f6d7357b4f", + "rev": "583f569545854160b6bc5606374bf5006a9f6929", "type": "github" }, "original": { @@ -258,11 +258,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1723683036, - "narHash": "sha256-pT74TrE+bCaeXhYLYJrZVocwopwwua4qOwN7waUdUpU=", + "lastModified": 1732063900, + "narHash": "sha256-uuaN+jFurAw5h1vntx4Jcqy1vGJaReXJSbTuR1q5rf0=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "88aeace47b5e43cb4df5f96e754179293c06f47c", + "rev": "3cca9b78a23dcb2146b4fe0aef12b9d2e8e6213c", "type": "github" }, "original": { @@ -427,16 +427,16 @@ "hls-2.9": { "flake": false, "locked": { - "lastModified": 1718469202, - "narHash": "sha256-THXSz+iwB1yQQsr/PY151+2GvtoJnTIB2pIQ4OzfjD4=", + "lastModified": 1720003792, + "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", "owner": "haskell", "repo": "haskell-language-server", - "rev": "40891bccb235ebacce020b598b083eab9dda80f1", + "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", "type": "github" }, "original": { "owner": "haskell", - "ref": "2.9.0.0", + "ref": "2.9.0.1", "repo": "haskell-language-server", "type": "github" } @@ -685,11 +685,11 @@ }, "nixpkgs-2405": { "locked": { - "lastModified": 1720122915, - "narHash": "sha256-Nby8WWxj0elBu1xuRaUcRjPi/rU3xVbkAt2kj4QwX2U=", + "lastModified": 1729242558, + "narHash": "sha256-VgcLDu4igNT0eYua6OAl9pWCI0cYXhDbR+pWP44tte0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "835cf2d3f37989c5db6585a28de967a667a75fb1", + "rev": "4a3f2d3195b60d07530574988df92e049372c10e", "type": "github" }, "original": { @@ -717,11 +717,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1720181791, - "narHash": "sha256-i4vJL12/AdyuQuviMMd1Hk2tsGt02hDNhA0Zj1m16N8=", + "lastModified": 1729980323, + "narHash": "sha256-eWPRZAlhf446bKSmzw6x7RWEE4IuZgAp8NW3eXZwRAY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4284c2b73c8bce4b46a6adf23e16d9e2ec8da4bb", + "rev": "86e78d3d2084ff87688da662cf78c2af085d8e73", "type": "github" }, "original": { @@ -815,11 +815,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1723594352, - "narHash": "sha256-cQVhF1M1et3/XNE1sclwH39prxIDMUojTdnW61t3YrM=", + "lastModified": 1732061500, + "narHash": "sha256-exwtyDeUn6BwKd5gWseAT8SVn+na/YGw/VIwuBkeUd0=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "c077da02c56031a78adc4bf0cf2b182effc895ed", + "rev": "000b2806cef5408df133a22bc5460ec91b25606b", "type": "github" }, "original": { From 50dba2ca2de36bd8d10b20307697138e3feffe0b Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Thu, 25 Jul 2024 21:33:57 +0200 Subject: [PATCH 02/13] Updated to use typed-protocols-0.3.0.0 --- cardano-api/cardano-api.cabal | 6 +-- cardano-api/internal/Cardano/Api/IPC.hs | 26 ++++++++----- .../internal/Cardano/Api/LedgerState.hs | 38 +++++++++---------- .../Cardano/Api/ChainSync/ClientPipelined.hs | 2 +- 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index d1cb46b7f7..c4d8587842 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -207,7 +207,7 @@ library internal ouroboros-consensus-diffusion ^>=0.18, ouroboros-consensus-protocol ^>=0.9.0.2, ouroboros-network, - ouroboros-network-api ^>=0.10, + ouroboros-network-api ^>=0.11, ouroboros-network-framework, ouroboros-network-protocols, parsec, @@ -226,7 +226,7 @@ library internal time, transformers, transformers-except ^>=0.1.3, - typed-protocols ^>=0.1.1, + typed-protocols ^>=0.3, vector, yaml, @@ -262,7 +262,7 @@ library memory, nothunks, ouroboros-network-protocols, - typed-protocols ^>=0.1.1, + typed-protocols, library gen import: project-config diff --git a/cardano-api/internal/Cardano/Api/IPC.hs b/cardano-api/internal/Cardano/Api/IPC.hs index c277fc35a5..4171cf9032 100644 --- a/cardano-api/internal/Cardano/Api/IPC.hs +++ b/cardano-api/internal/Cardano/Api/IPC.hs @@ -122,6 +122,7 @@ import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx import Control.Concurrent.STM (TMVar, atomically, newEmptyTMVarIO, putTMVar, takeTMVar, tryPutTMVar) +import Control.Exception (throwIO) import Control.Monad (void) import Control.Monad.IO.Class import Control.Tracer (nullTracer) @@ -202,15 +203,19 @@ connectToLocalNodeWithVersion , localConsensusModeParams } clients = - liftIO $ Net.withIOManager $ \iomgr -> - Net.connectTo - (Net.localSnocket iomgr) - Net.NetworkConnectTracers - { Net.nctMuxTracer = nullTracer - , Net.nctHandshakeTracer = nullTracer - } - versionedProtocls - (unFile localNodeSocketPath) + liftIO $ Net.withIOManager $ \iomgr -> do + r <- + Net.connectTo + (Net.localSnocket iomgr) + Net.NetworkConnectTracers + { Net.nctMuxTracer = nullTracer + , Net.nctHandshakeTracer = nullTracer + } + versionedProtocls + (unFile localNodeSocketPath) + case r of + Left e -> throwIO e + Right _ -> pure () where versionedProtocls = -- First convert from the mode-parametrised view of things to the @@ -302,10 +307,11 @@ mkVersionedProtocols networkid ptcl unversionedClients = ) , localStateQueryProtocol = Net.InitiatorProtocolOnly $ - Net.mkMiniProtocolCbFromPeer $ + Net.mkMiniProtocolCbFromPeerSt $ const ( nullTracer , cStateQueryCodec + , Net.Query.StateIdle , maybe Net.localStateQueryPeerNull Net.Query.localStateQueryClientPeer diff --git a/cardano-api/internal/Cardano/Api/LedgerState.hs b/cardano-api/internal/Cardano/Api/LedgerState.hs index a960aaaf72..468242a2c7 100644 --- a/cardano-api/internal/Cardano/Api/LedgerState.hs +++ b/cardano-api/internal/Cardano/Api/LedgerState.hs @@ -220,7 +220,7 @@ import qualified Data.Yaml as Yaml import Formatting.Buildable (build) import GHC.Exts (IsList (..)) import Lens.Micro -import Network.TypedProtocol.Pipelined (Nat (..)) +import Network.TypedProtocol.Core (Nat (..)) import System.FilePath data InitialLedgerStateError @@ -1097,45 +1097,45 @@ instance FromJSON NodeConfig where <*> parseBabbageHardForkEpoch o <*> parseConwayHardForkEpoch o - parseShelleyHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseShelleyHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseShelleyHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestShelleyHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 2 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestShelleyHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseAllegraHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseAllegraHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseAllegraHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestAllegraHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 3 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestAllegraHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseMaryHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseMaryHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseMaryHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestMaryHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 4 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestMaryHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseAlonzoHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseAlonzoHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseAlonzoHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestAlonzoHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 5 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestAlonzoHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseBabbageHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseBabbageHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseBabbageHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestBabbageHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 7 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestBabbageHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] - parseConwayHardForkEpoch :: Object -> Parser Consensus.TriggerHardFork + parseConwayHardForkEpoch :: Object -> Parser (Consensus.CardanoHardForkTrigger blk) parseConwayHardForkEpoch o = asum - [ Consensus.TriggerHardForkAtEpoch <$> o .: "TestConwayHardForkAtEpoch" - , pure $ Consensus.TriggerHardForkAtVersion 9 -- Mainnet default + [ Consensus.CardanoTriggerHardForkAtEpoch <$> o .: "TestConwayHardForkAtEpoch" + , pure Consensus.CardanoTriggerHardForkAtDefaultVersion ] ---------------------------------------------------------------------- diff --git a/cardano-api/src/Cardano/Api/ChainSync/ClientPipelined.hs b/cardano-api/src/Cardano/Api/ChainSync/ClientPipelined.hs index 0ff1ba8e89..e794708a29 100644 --- a/cardano-api/src/Cardano/Api/ChainSync/ClientPipelined.hs +++ b/cardano-api/src/Cardano/Api/ChainSync/ClientPipelined.hs @@ -34,4 +34,4 @@ where import Ouroboros.Network.Protocol.ChainSync.ClientPipelined import Ouroboros.Network.Protocol.ChainSync.PipelineDecision -import Network.TypedProtocol.Pipelined (N (..), Nat (..), natToInt) +import Network.TypedProtocol.Core (N (..), Nat (..), natToInt) From e828889659fe80f814a345252c9c8dd8f63f0fd9 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 18 Dec 2024 17:48:08 -0700 Subject: [PATCH 03/13] Add an srp for ouroboros-consensus --- cabal.project | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cabal.project b/cabal.project index 2dadea3e3f..c0bcbdc1d9 100644 --- a/cabal.project +++ b/cabal.project @@ -52,3 +52,13 @@ write-ghc-environment-files: always constraints: Cabal < 3.14, cardano-ledger-shelley ^>= 1.14.1 + +source-repository-package + type: git + location: https://github.com/IntersectMBO/ouroboros-consensus + tag: 592e11c8ce941d10aaf185ca58796f25e6f403f0 + --sha256: sha256-0NU/Z9Xmewk0kbVSZdTBoieFwYdaO5qgxJmlOZ7dVmM= + subdir: ouroboros-consensus + ouroboros-consensus-cardano + ouroboros-consensus-diffusion + ouroboros-consensus-protocol From 7a58920465440eb071d9b7228490764fac5885ce Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Thu, 21 Nov 2024 14:29:49 -0700 Subject: [PATCH 04/13] Fix typo --- cardano-api/internal/Cardano/Api/Certificate.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cardano-api/internal/Cardano/Api/Certificate.hs b/cardano-api/internal/Cardano/Api/Certificate.hs index b31ab11135..de080e6345 100644 --- a/cardano-api/internal/Cardano/Api/Certificate.hs +++ b/cardano-api/internal/Cardano/Api/Certificate.hs @@ -362,7 +362,7 @@ makeStakePoolRetirementCertificate req = ConwayCertificate atMostBab $ Ledger.mkRetirePoolTxCert (unStakePoolKeyHash poolId) retirementEpoch -data GenesisKeyDelegationRequirements ere where +data GenesisKeyDelegationRequirements era where GenesisKeyDelegationRequirements :: ShelleyToBabbageEra era -> Hash GenesisKey From 2d1a7a7db794150893d79c8263f0195a000d5f30 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 20 Nov 2024 18:54:52 -0700 Subject: [PATCH 05/13] Fix `cabal check` warnings --- cardano-api-gen/cardano-api-gen.cabal | 2 +- scripts/ci/check-cabal-files.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cardano-api-gen/cardano-api-gen.cabal b/cardano-api-gen/cardano-api-gen.cabal index 8621228972..9720e11f4e 100644 --- a/cardano-api-gen/cardano-api-gen.cabal +++ b/cardano-api-gen/cardano-api-gen.cabal @@ -17,7 +17,7 @@ license-files: NOTICE build-type: Simple -extra-source-files: +extra-doc-files: CHANGELOG.md README.md diff --git a/scripts/ci/check-cabal-files.sh b/scripts/ci/check-cabal-files.sh index 5771c266d5..7efa2def26 100755 --- a/scripts/ci/check-cabal-files.sh +++ b/scripts/ci/check-cabal-files.sh @@ -6,6 +6,6 @@ for cabal_file in $(git ls-files "*.cabal") do cd "$(dirname "$cabal_file")" || { echo "Cannot cd"; exit 1; } echo "$(pwd)> cabal-check" - cabal check + cabal check --ignore=missing-upper-bounds cd - || { echo "Cannot cd back"; exit 1; } done From 4fc7d0786f7646ab8752de979bae08f8d0fea53e Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Thu, 28 Nov 2024 18:31:27 -0700 Subject: [PATCH 06/13] plutus upgrade: increase dependency version bounds --- cardano-api/cardano-api.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index c4d8587842..b0ff085bcc 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -211,7 +211,7 @@ library internal ouroboros-network-framework, ouroboros-network-protocols, parsec, - plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>=1.36, + plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} ^>=1.37, prettyprinter, prettyprinter-ansi-terminal, prettyprinter-configurable ^>=1.36, @@ -409,7 +409,7 @@ test-suite cardano-api-golden hedgehog-extras ^>=0.6.1.0, microlens, parsec, - plutus-core ^>=1.36, + plutus-core ^>=1.37, plutus-ledger-api, tasty, tasty-hedgehog, From 5d7a50593569e5cb7c72893e471a8d8041e37ca2 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 4 Dec 2024 13:38:00 -0700 Subject: [PATCH 07/13] plutus-upgrade: adjust golden file for new MintValue type --- .../ScriptErrorEvaluationFailed.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cardano-api/test/cardano-api-golden/files/golden/errors/Cardano.Api.Fees.ScriptExecutionError/ScriptErrorEvaluationFailed.txt b/cardano-api/test/cardano-api-golden/files/golden/errors/Cardano.Api.Fees.ScriptExecutionError/ScriptErrorEvaluationFailed.txt index 1ab8477c1c..30e7153241 100644 --- a/cardano-api/test/cardano-api-golden/files/golden/errors/Cardano.Api.Fees.ScriptExecutionError/ScriptErrorEvaluationFailed.txt +++ b/cardano-api/test/cardano-api-golden/files/golden/errors/Cardano.Api.Fees.ScriptExecutionError/ScriptErrorEvaluationFailed.txt @@ -31,7 +31,7 @@ Script arguments: with referenceScript ] Fee: 0 - Value minted: Value {getValue = Map {unMap = [(c61bfa1c138524b69f378bc69504322f39289ce554d549db4d1e2b50,Map {unMap = [("MillarCoin",5)]})]}} + Value minted: UnsafeMintValue (Map {unMap = [(c61bfa1c138524b69f378bc69504322f39289ce554d549db4d1e2b50,Map {unMap = [("MillarCoin",5)]})]}) TxCerts: [ TxCertRegStaking (ScriptCredential c61bfa1c138524b69f378bc69504322f39289ce554d549db4d1e2b50) (Just 400000) ] Wdrl: [] Valid range: (-∞ , +∞) From 2682371b68d5d6581b27b6b7fa5cefb3cfc73e2e Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 20 Nov 2024 16:36:32 -0700 Subject: [PATCH 08/13] cardano-ledger upgrade: loosen dependency version bounds --- cabal.project | 1 - cardano-api/cardano-api.cabal | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cabal.project b/cabal.project index c0bcbdc1d9..3faadffe71 100644 --- a/cabal.project +++ b/cabal.project @@ -51,7 +51,6 @@ write-ghc-environment-files: always constraints: Cabal < 3.14, - cardano-ledger-shelley ^>= 1.14.1 source-repository-package type: git diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index b0ff085bcc..0c702086a6 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -173,7 +173,7 @@ library internal cardano-data >=1.0, cardano-ledger-allegra >=1.6, cardano-ledger-alonzo >=1.10.2, - cardano-ledger-api ^>=1.9.3, + cardano-ledger-api >=1.9.3, cardano-ledger-babbage >=1.9, cardano-ledger-binary >=1.3, cardano-ledger-byron >=1.0.1, @@ -324,7 +324,7 @@ test-suite cardano-api-test cardano-crypto-test ^>=1.5, cardano-crypto-tests ^>=2.1, cardano-ledger-alonzo, - cardano-ledger-api ^>=1.9, + cardano-ledger-api >=1.9, cardano-ledger-binary, cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14, cardano-ledger-mary, @@ -395,7 +395,7 @@ test-suite cardano-api-golden cardano-crypto-class ^>=2.1.2, cardano-data >=1.0, cardano-ledger-alonzo, - cardano-ledger-api ^>=1.9, + cardano-ledger-api >=1.9, cardano-ledger-babbage >=1.9, cardano-ledger-binary, cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14, From c2d2df94209c908da8b43eed52b700a08f10d75f Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 20 Nov 2024 17:15:24 -0700 Subject: [PATCH 09/13] cardano-ledger upgrade: accommodate the new VRFVerKeyHash type --- cardano-api/internal/Cardano/Api/Certificate.hs | 6 +++--- cardano-api/internal/Cardano/Api/Keys/Praos.hs | 2 +- cardano-api/internal/Cardano/Api/LedgerState.hs | 2 +- cardano-api/internal/Cardano/Api/ReexposeLedger.hs | 4 +++- .../cardano-api-golden/Test/Golden/Cardano/Api/Genesis.hs | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Certificate.hs b/cardano-api/internal/Cardano/Api/Certificate.hs index de080e6345..0f2a837ca3 100644 --- a/cardano-api/internal/Cardano/Api/Certificate.hs +++ b/cardano-api/internal/Cardano/Api/Certificate.hs @@ -381,7 +381,7 @@ makeGenesisKeyDelegationCertificate ShelleyRelatedCertificate atMostEra $ shelleyToBabbageEraConstraints atMostEra $ Ledger.ShelleyTxCertGenesisDeleg $ - Ledger.GenesisDelegCert hGenKey hGenDelegKey hVrfKey + Ledger.GenesisDelegCert hGenKey hGenDelegKey (Ledger.toVRFVerKeyHash hVrfKey) data MirCertificateRequirements era where MirCertificateRequirements @@ -613,7 +613,7 @@ toShelleyPoolParams -- do simple client-side sanity checks, e.g. on the pool metadata url Ledger.PoolParams { Ledger.ppId = poolkh - , Ledger.ppVrf = vrfkh + , Ledger.ppVrf = Ledger.toVRFVerKeyHash vrfkh , Ledger.ppPledge = stakePoolPledge , Ledger.ppCost = stakePoolCost , Ledger.ppMargin = @@ -685,7 +685,7 @@ fromShelleyPoolParams } = StakePoolParameters { stakePoolId = StakePoolKeyHash ppId - , stakePoolVRF = VrfKeyHash ppVrf + , stakePoolVRF = VrfKeyHash (Ledger.fromVRFVerKeyHash ppVrf) , stakePoolCost = ppCost , stakePoolMargin = Ledger.unboundRational ppMargin , stakePoolRewardAccount = fromShelleyStakeAddr ppRewardAccount diff --git a/cardano-api/internal/Cardano/Api/Keys/Praos.hs b/cardano-api/internal/Cardano/Api/Keys/Praos.hs index ad83c77b94..cca7caa20e 100644 --- a/cardano-api/internal/Cardano/Api/Keys/Praos.hs +++ b/cardano-api/internal/Cardano/Api/Keys/Praos.hs @@ -200,7 +200,7 @@ instance Key VrfKey where verificationKeyHash :: VerificationKey VrfKey -> Hash VrfKey verificationKeyHash (VrfVerificationKey vkey) = - VrfKeyHash (Shelley.hashVerKeyVRF vkey) + VrfKeyHash (Crypto.hashVerKeyVRF vkey) instance SerialiseAsRawBytes (VerificationKey VrfKey) where serialiseToRawBytes (VrfVerificationKey vk) = diff --git a/cardano-api/internal/Cardano/Api/LedgerState.hs b/cardano-api/internal/Cardano/Api/LedgerState.hs index 468242a2c7..a3a0396add 100644 --- a/cardano-api/internal/Cardano/Api/LedgerState.hs +++ b/cardano-api/internal/Cardano/Api/LedgerState.hs @@ -2291,6 +2291,6 @@ toLedgerIndividualPoolStake :: Consensus.IndividualPoolStake c -> SL.IndividualP toLedgerIndividualPoolStake ips = SL.IndividualPoolStake { SL.individualPoolStake = Consensus.individualPoolStake ips - , SL.individualPoolStakeVrf = Consensus.individualPoolStakeVrf ips + , SL.individualPoolStakeVrf = SL.toVRFVerKeyHash $ Consensus.individualPoolStakeVrf ips , SL.individualTotalPoolStake = SL.CompactCoin 0 } diff --git a/cardano-api/internal/Cardano/Api/ReexposeLedger.hs b/cardano-api/internal/Cardano/Api/ReexposeLedger.hs index e56352c044..60e1df6e5d 100644 --- a/cardano-api/internal/Cardano/Api/ReexposeLedger.hs +++ b/cardano-api/internal/Cardano/Api/ReexposeLedger.hs @@ -17,6 +17,8 @@ module Cardano.Api.ReexposeLedger , hashKey , hashVerKeyVRF , hashWithSerialiser + , fromVRFVerKeyHash + , toVRFVerKeyHash , PoolParams (..) , HasKeyRole , MIRPot (..) @@ -225,7 +227,7 @@ import Cardano.Ledger.Credential (Credential (..), credToText) import Cardano.Ledger.Crypto (ADDRHASH, Crypto, StandardCrypto) import Cardano.Ledger.DRep (DRep (..), drepAnchorL, drepDepositL, drepExpiryL) import Cardano.Ledger.Keys (HasKeyRole, KeyHash (..), KeyRole (..), VKey (..), - hashWithSerialiser) + fromVRFVerKeyHash, hashWithSerialiser, toVRFVerKeyHash) import Cardano.Ledger.Plutus.Data (Data (..), unData) import Cardano.Ledger.Plutus.Language (Language, Plutus, languageToText, plutusBinary) import Cardano.Ledger.PoolParams (PoolMetadata (..), PoolParams (..), StakePoolRelay (..)) diff --git a/cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Genesis.hs b/cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Genesis.hs index a6d84e1243..10f3ed0783 100644 --- a/cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Genesis.hs +++ b/cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Genesis.hs @@ -17,7 +17,7 @@ import Cardano.Ledger.Credential (Credential (..), PaymentCredential, StakeReference (..)) import Cardano.Ledger.Crypto (StandardCrypto) import Cardano.Ledger.Keys (GenDelegPair (..), Hash, KeyHash (..), KeyRole (..), - VerKeyVRF) + VerKeyVRF, toVRFVerKeyHash) import Cardano.Ledger.Shelley.Genesis (emptyGenesisStaking) import Cardano.Slotting.Slot (EpochSize (..)) @@ -51,7 +51,7 @@ exampleShelleyGenesis = fromList [ ( genesisVerKeyHash - , GenDelegPair delegVerKeyHash delegVrfKeyHash + , GenDelegPair delegVerKeyHash (toVRFVerKeyHash delegVrfKeyHash) ) ] , sgInitialFunds = ListMap [(initialFundedAddress, initialFunds)] From 78ad79cc00b1b5fed58cb79d8f691cdbf33edd81 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 20 Nov 2024 17:44:30 -0700 Subject: [PATCH 10/13] cardano-ledger upgrade: use Cardano.Ledger.Core instead of Cardano.Ledger.Era --- cardano-api/internal/Cardano/Api/Block.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cardano-api/internal/Cardano/Api/Block.hs b/cardano-api/internal/Cardano/Api/Block.hs index 7e3a0ae83f..cdc0ec9824 100644 --- a/cardano-api/internal/Cardano/Api/Block.hs +++ b/cardano-api/internal/Cardano/Api/Block.hs @@ -62,7 +62,7 @@ import qualified Cardano.Crypto.Hash.Class as Crypto import qualified Cardano.Crypto.Hashing import qualified Cardano.Ledger.Api as L import qualified Cardano.Ledger.Block as Ledger -import qualified Cardano.Ledger.Era as Ledger +import qualified Cardano.Ledger.Core as Ledger import Cardano.Slotting.Block (BlockNo) import Cardano.Slotting.Slot (EpochNo, SlotNo, WithOrigin (..)) import qualified Ouroboros.Consensus.Block as Consensus From 0ad8d6891180174303a464b57fa18168be128c48 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 20 Nov 2024 17:45:45 -0700 Subject: [PATCH 11/13] cardano-ledger upgrade: add support for the GovRemovedVotes event --- .../Cardano/Api/LedgerEvents/ConvertLedgerEvent.hs | 2 ++ .../internal/Cardano/Api/LedgerEvents/LedgerEvent.hs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/cardano-api/internal/Cardano/Api/LedgerEvents/ConvertLedgerEvent.hs b/cardano-api/internal/Cardano/Api/LedgerEvents/ConvertLedgerEvent.hs index f8ab2b4ad9..0399ffc5df 100644 --- a/cardano-api/internal/Cardano/Api/LedgerEvents/ConvertLedgerEvent.hs +++ b/cardano-api/internal/Cardano/Api/LedgerEvents/ConvertLedgerEvent.hs @@ -170,6 +170,8 @@ toLedgerEventConway evt = case govEvent of Conway.GovNewProposals txid props -> Just $ NewGovernanceProposals txid (AnyProposals props) + Conway.GovRemovedVotes txid replacedVotes unregisteredDReps -> + Just $ RemovedGovernanceVotes txid replacedVotes unregisteredDReps instance ConvertLedgerEvent (HardForkBlock (Consensus.CardanoEras StandardCrypto)) where toLedgerEvent wrappedLedgerEvent = diff --git a/cardano-api/internal/Cardano/Api/LedgerEvents/LedgerEvent.hs b/cardano-api/internal/Cardano/Api/LedgerEvents/LedgerEvent.hs index 04569fe33a..4c593243aa 100644 --- a/cardano-api/internal/Cardano/Api/LedgerEvents/LedgerEvent.hs +++ b/cardano-api/internal/Cardano/Api/LedgerEvents/LedgerEvent.hs @@ -67,6 +67,13 @@ data LedgerEvent -- | Newly submittted governance proposals in a single transaction. NewGovernanceProposals (Ledger.TxId StandardCrypto) AnyProposals + | -- | Governance votes that were invalidated. + RemovedGovernanceVotes + (Ledger.TxId StandardCrypto) + (Set (Ledger.Voter StandardCrypto, Ledger.GovActionId StandardCrypto)) + -- ^ Votes that were replaced in this tx. + (Set (Ledger.Credential 'Ledger.DRepRole StandardCrypto)) + -- ^ Any votes from these DReps in this or in previous txs are removed | -- | The current state of governance matters at the epoch boundary. -- I.E the current constitution, committee, protocol parameters, etc. EpochBoundaryRatificationState AnyRatificationState From fdd2b4f590f09253b6eb1c76496bd4f2fc039083 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Mon, 9 Dec 2024 22:38:33 -0700 Subject: [PATCH 12/13] cardano-ledger upgrade: StakePoolTargetNum change to Word16 --- cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs | 4 ++-- cardano-api/internal/Cardano/Api/ProtocolParameters.hs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs b/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs index 26eafc9733..4081e38724 100644 --- a/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs +++ b/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs @@ -1005,7 +1005,7 @@ genProtocolParameters era = do protocolParamStakePoolDeposit <- genLovelace protocolParamMinPoolCost <- genLovelace protocolParamPoolRetireMaxEpoch <- genEpochInterval - protocolParamStakePoolTargetNum <- genNat + protocolParamStakePoolTargetNum <- genWord16 protocolParamPoolPledgeInfluence <- genRationalInt64 protocolParamMonetaryExpansion <- genRational protocolParamTreasuryCut <- genRational @@ -1042,7 +1042,7 @@ genProtocolParametersUpdate era = do protocolUpdateStakePoolDeposit <- Gen.maybe genLovelace protocolUpdateMinPoolCost <- Gen.maybe genLovelace protocolUpdatePoolRetireMaxEpoch <- Gen.maybe genEpochInterval - protocolUpdateStakePoolTargetNum <- Gen.maybe genNat + protocolUpdateStakePoolTargetNum <- Gen.maybe genWord16 protocolUpdatePoolPledgeInfluence <- Gen.maybe genRationalInt64 protocolUpdateMonetaryExpansion <- Gen.maybe genRational protocolUpdateTreasuryCut <- Gen.maybe genRational diff --git a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs index 9290ae35be..8f71cfb73b 100644 --- a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs +++ b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs @@ -326,7 +326,7 @@ data CommonProtocolParametersUpdate , cppKeyDeposit :: StrictMaybe Ledger.Coin , cppPoolDeposit :: StrictMaybe Ledger.Coin , cppPoolRetireMaxEpoch :: StrictMaybe Ledger.EpochInterval - , cppStakePoolTargetNum :: StrictMaybe Natural + , cppStakePoolTargetNum :: StrictMaybe Word16 , cppPoolPledgeInfluence :: StrictMaybe Ledger.NonNegativeInterval , cppTreasuryExpansion :: StrictMaybe Ledger.UnitInterval , cppMonetaryExpansion :: StrictMaybe Ledger.UnitInterval @@ -526,7 +526,7 @@ data ProtocolParameters , protocolParamPoolRetireMaxEpoch :: Ledger.EpochInterval -- ^ The maximum number of epochs into the future that stake pools -- are permitted to schedule a retirement. - , protocolParamStakePoolTargetNum :: Natural + , protocolParamStakePoolTargetNum :: Word16 -- ^ The equilibrium target number of stake pools. -- -- This is the \"k\" incentives parameter from the design document. @@ -710,7 +710,7 @@ data ProtocolParametersUpdate , protocolUpdatePoolRetireMaxEpoch :: Maybe Ledger.EpochInterval -- ^ The maximum number of epochs into the future that stake pools -- are permitted to schedule a retirement. - , protocolUpdateStakePoolTargetNum :: Maybe Natural + , protocolUpdateStakePoolTargetNum :: Maybe Word16 -- ^ The equilibrium target number of stake pools. -- -- This is the \"k\" incentives parameter from the design document. From 514417e95a790a4043078556758e44ad1d149ce6 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Wed, 20 Nov 2024 16:21:15 -0700 Subject: [PATCH 13/13] Update srp for ouroboros-consensus --- cabal.project | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cabal.project b/cabal.project index 3faadffe71..0463354a3d 100644 --- a/cabal.project +++ b/cabal.project @@ -55,8 +55,8 @@ constraints: source-repository-package type: git location: https://github.com/IntersectMBO/ouroboros-consensus - tag: 592e11c8ce941d10aaf185ca58796f25e6f403f0 - --sha256: sha256-0NU/Z9Xmewk0kbVSZdTBoieFwYdaO5qgxJmlOZ7dVmM= + tag: e47f737f1447a33f6c2bbbd35cc47272cdf03526 + --sha256: sha256-8FHWs//Thm14o+COMoyY7eq4fe53JNywDdE+N3UKQmA= subdir: ouroboros-consensus ouroboros-consensus-cardano ouroboros-consensus-diffusion