diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 46efafa548..23a77559d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -115,7 +115,7 @@ cabal run db-analyser To test all the packages in this repository run: ```sh -cabal build all +cabal test all ``` in the command line, either inside `nix-shell` if you use `nix`, or in a diff --git a/cabal.project b/cabal.project index 5bc613b1a8..cf8efbd007 100644 --- a/cabal.project +++ b/cabal.project @@ -14,9 +14,9 @@ repository cardano-haskell-packages -- update either of these. index-state: -- Bump this if you need newer packages from Hackage - , hackage.haskell.org 2024-10-22T14:26:27Z + , hackage.haskell.org 2024-11-20T00:00:00Z -- Bump this if you need newer packages from CHaP - , cardano-haskell-packages 2024-10-30T11:23:17Z + , cardano-haskell-packages 2024-11-05T09:09:23Z packages: ouroboros-consensus @@ -47,3 +47,56 @@ if(os(windows)) -- https://github.com/ulidtko/cabal-doctest/issues/85 constraints: Cabal < 3.13 + +source-repository-package + type: git + location: https://github.com/IntersectMBO/cardano-ledger.git + tag: caec1e9a952348fa79286e46b8c6e6222486aa79 + --sha256: sha256-wq1qVDL61f6LpvOWlzv+mfAgsxPXgOuVvCHdoRG1/s8= + subdir: + eras/allegra/impl + eras/alonzo/impl + eras/alonzo/test-suite + eras/babbage/impl + eras/babbage/test-suite + eras/byron/chain/executable-spec + eras/byron/crypto + eras/byron/crypto/test + eras/byron/ledger/executable-spec + eras/byron/ledger/impl + eras/byron/ledger/impl/test + eras/conway/impl + eras/conway/test-suite + eras/mary/impl + eras/shelley/impl + eras/shelley-ma/test-suite + eras/shelley/test-suite + libs/cardano-data + libs/cardano-ledger-api + libs/cardano-ledger-binary + libs/cardano-ledger-core + libs/cardano-protocol-tpraos + libs/non-integral + libs/plutus-preprocessor + libs/set-algebra + libs/small-steps + libs/vector-map + +source-repository-package + type: git + location: https://github.com/IntersectMBO/ouroboros-network.git + tag: 7e8909f97d6ecc9fff320b3ac2b785aec74751c6 + --sha256: sha256-Evv2EwaXbr2tXlxnHVr/AAV+QB7B8EWJbQR6t4IvOQ4= + subdir: + cardano-client + cardano-ping + monoidal-synchronisation + network-mux + ntp-client + ouroboros-network + ouroboros-network-api + ouroboros-network-framework + ouroboros-network-mock + ouroboros-network-protocols + ouroboros-network-testing + quickcheck-monoids diff --git a/flake.lock b/flake.lock index e058c7b99c..55509b2997 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1730295876, - "narHash": "sha256-ijnHTQ6eKIQ9FpEqDKt6c7vuFYN8aOBDhonp67utx2s=", + "lastModified": 1730824761, + "narHash": "sha256-Kv99PeYWdqmj5OStnp6kE6fjHbx6irTYyEPoFuukfHU=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "25591f43ab943d5a070db5e8a2b9ff3a499d4d92", + "rev": "d3d36220528058f9a24cff43fc723e60f6a786ad", "type": "github" }, "original": { @@ -237,11 +237,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1729643285, - "narHash": "sha256-2ukEfnphbVMpa6qJQ/h0O12e6wS9j+/w2mwE1YZQskI=", + "lastModified": 1732062550, + "narHash": "sha256-7WEgL74nWqnuue00ZgFCRdmB9ZFMCdN94pMS8OJUUZE=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "e07df92046b89b0359d426c02848d96196ad60ec", + "rev": "ad8f3fa0751f7e50ca7c1a6b49410ea92ccf003e", "type": "github" }, "original": { diff --git a/ouroboros-consensus-cardano/changelog.d/20241120_152418_neilmayhew_release_srp.md b/ouroboros-consensus-cardano/changelog.d/20241120_152418_neilmayhew_release_srp.md new file mode 100644 index 0000000000..5d3e81897a --- /dev/null +++ b/ouroboros-consensus-cardano/changelog.d/20241120_152418_neilmayhew_release_srp.md @@ -0,0 +1,8 @@ +### Breaking + +- Change the type of the `individualPoolStakeVrf` field in `IndividualPoolStake` + to use the new `VRFVerKeyHash` ledger type. +- Change the `VrfKeyHash` type in the `Hash VrfKey` instance + to use the new `VRFVerKeyHash` ledger type. +- Change the type of the `mkKeyHashVrf` function + to use the new `VRFVerKeyHash` ledger type. diff --git a/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal b/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal index df32ce0c7f..75d72a3dca 100644 --- a/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal +++ b/ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal @@ -135,17 +135,17 @@ library cardano-crypto-class, cardano-crypto-wrapper, cardano-ledger-allegra ^>=1.6, - cardano-ledger-alonzo ^>=1.11, - cardano-ledger-api ^>=1.9.3, + cardano-ledger-alonzo ^>=1.12, + cardano-ledger-api ^>=1.10, cardano-ledger-babbage ^>=1.10, - cardano-ledger-binary ^>=1.4, + cardano-ledger-binary ^>=1.5, cardano-ledger-byron ^>=1.0.1, - cardano-ledger-conway ^>=1.17.2, - cardano-ledger-core ^>=1.15, + cardano-ledger-conway ^>=1.18, + cardano-ledger-core ^>=1.16, cardano-ledger-mary ^>=1.7, - cardano-ledger-shelley ^>=1.14, + cardano-ledger-shelley ^>=1.15, cardano-prelude, - cardano-protocol-tpraos ^>=1.2, + cardano-protocol-tpraos ^>=1.3, cardano-slotting, cardano-strict-containers, cborg ^>=0.2.2, @@ -390,7 +390,7 @@ library unstable-cardano-testlib cardano-ledger-api, cardano-ledger-byron, cardano-ledger-conway:testlib, - cardano-ledger-conway-test >=1.2.1, + cardano-ledger-conway-test ^>=1.3, cardano-ledger-core:{cardano-ledger-core, testlib}, cardano-ledger-shelley, cardano-protocol-tpraos, @@ -535,7 +535,7 @@ library unstable-cardano-tools cardano-ledger-mary, cardano-ledger-shelley, cardano-prelude, - cardano-protocol-tpraos ^>=1.2, + cardano-protocol-tpraos ^>=1.3, cardano-slotting, cardano-strict-containers, cborg ^>=0.2.2, @@ -549,6 +549,7 @@ library unstable-cardano-tools microlens, mtl, network, + network-mux, nothunks, ouroboros-consensus ^>=0.21, ouroboros-consensus-cardano, diff --git a/ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Ledger/Serialisation.hs b/ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Ledger/Serialisation.hs index cbf986e979..43a9a42dfc 100644 --- a/ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Ledger/Serialisation.hs +++ b/ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Ledger/Serialisation.hs @@ -178,7 +178,7 @@ encodeByronBlock blk = mconcat [ -- | Inverse of 'encodeByronBlock' decodeByronBlock :: CC.EpochSlots -> Decoder s (Lazy.ByteString -> ByronBlock) decodeByronBlock epochSlots = - toPlainDecoder byronProtVer $ + toPlainDecoder Nothing byronProtVer $ flip (\bs -> mkByronBlock epochSlots . annotationBytes bs) <$> CC.decCBORABlockOrBoundary epochSlots @@ -195,7 +195,7 @@ decodeByronBlock epochSlots = decodeByronRegularBlock :: CC.EpochSlots -> Decoder s (Lazy.ByteString -> ByronBlock) decodeByronRegularBlock epochSlots = - toPlainDecoder byronProtVer $ + toPlainDecoder Nothing byronProtVer $ flip (\bs -> mkByronBlock epochSlots . annotationBytes bs . CC.ABOBBlock) @@ -213,7 +213,7 @@ decodeByronRegularBlock epochSlots = decodeByronBoundaryBlock :: CC.EpochSlots -> Decoder s (Lazy.ByteString -> ByronBlock) decodeByronBoundaryBlock epochSlots = - toPlainDecoder byronProtVer $ + toPlainDecoder Nothing byronProtVer $ flip (\bs -> mkByronBlock epochSlots . annotationBytes bs . CC.ABOBBoundary) @@ -231,7 +231,7 @@ decodeByronRegularHeader :: CC.EpochSlots -> Decoder s (Lazy.ByteString -> RawHeader) decodeByronRegularHeader epochSlots = - toPlainDecoder byronProtVer $ + toPlainDecoder Nothing byronProtVer $ flip annotationBytes <$> CC.decCBORAHeader epochSlots -- | Encodes a raw Byron EBB header /without/ a tag indicating whether it's a @@ -244,7 +244,7 @@ encodeByronBoundaryHeader = toByronCBOR . CBOR.encodePreEncoded . CC.boundaryHea -- | Inverse of 'encodeByronBoundaryHeader' decodeByronBoundaryHeader :: Decoder s (Lazy.ByteString -> RawBoundaryHeader) decodeByronBoundaryHeader = - toPlainDecoder byronProtVer $ + toPlainDecoder Nothing byronProtVer $ flip annotationBytes <$> CC.decCBORABoundaryHeader -- | The 'BinaryBlockInfo' of the given 'ByronBlock'. @@ -325,7 +325,7 @@ encodeUnsizedHeader (UnsizedHeader raw _ _) = toByronCBOR $ CC.encCBORABlockOrBo decodeUnsizedHeader :: CC.EpochSlots -> Decoder s (Lazy.ByteString -> UnsizedHeader) decodeUnsizedHeader epochSlots = - toPlainDecoder byronProtVer $ + toPlainDecoder Nothing byronProtVer $ fillInByteString <$> CC.decCBORABlockOrBoundaryHdr epochSlots where fillInByteString :: CC.ABlockOrBoundaryHdr ByteSpan diff --git a/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/CanHardFork.hs b/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/CanHardFork.hs index 8fb6bf08ec..d654335520 100644 --- a/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/CanHardFork.hs +++ b/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/CanHardFork.hs @@ -33,8 +33,8 @@ import qualified Cardano.Chain.Genesis as CC.Genesis import qualified Cardano.Chain.Update as CC.Update import Cardano.Crypto.DSIGN (Ed25519DSIGN) import Cardano.Crypto.Hash.Blake2b (Blake2b_224, Blake2b_256) +import qualified Cardano.Ledger.Core as SL import Cardano.Ledger.Crypto (ADDRHASH, Crypto, DSIGN, HASH) -import qualified Cardano.Ledger.Era as SL import qualified Cardano.Ledger.Genesis as SL import Cardano.Ledger.Hashes (EraIndependentTxBody) import Cardano.Ledger.Keys (DSignable, Hash) diff --git a/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Node.hs b/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Node.hs index f54245242f..440a2aeb73 100644 --- a/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Node.hs +++ b/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Node.hs @@ -519,14 +519,7 @@ instance CardanoHardForkConstraints c ] supportedNodeToClientVersions _ = Map.fromList $ - [ (NodeToClientV_9 , CardanoNodeToClientVersion7) - , (NodeToClientV_10, CardanoNodeToClientVersion7) - , (NodeToClientV_11, CardanoNodeToClientVersion8) - , (NodeToClientV_12, CardanoNodeToClientVersion8) - , (NodeToClientV_13, CardanoNodeToClientVersion9) - , (NodeToClientV_14, CardanoNodeToClientVersion10) - , (NodeToClientV_15, CardanoNodeToClientVersion11) - , (NodeToClientV_16, CardanoNodeToClientVersion12) + [ (NodeToClientV_16, CardanoNodeToClientVersion12) , (NodeToClientV_17, CardanoNodeToClientVersion13) , (NodeToClientV_18, CardanoNodeToClientVersion14) , (NodeToClientV_19, CardanoNodeToClientVersion15) diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Block.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Block.hs index 9e5d96e50d..ba02b3e2d5 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Block.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Block.hs @@ -40,12 +40,12 @@ module Ouroboros.Consensus.Shelley.Ledger.Block ( import qualified Cardano.Crypto.Hash as Crypto import Cardano.Ledger.Binary (Annotator (..), DecCBOR (..), - EncCBOR (..), FullByteString (..), serialize, - toPlainDecoder) + EncCBOR (..), FullByteString (..), serialize) import qualified Cardano.Ledger.Binary.Plain as Plain -import Cardano.Ledger.Core as SL (eraProtVerLow, toEraCBOR) +import Cardano.Ledger.Core as SL (eraDecoder, eraProtVerLow, + toEraCBOR) +import qualified Cardano.Ledger.Core as SL (hashTxSeq) import Cardano.Ledger.Crypto (HASH) -import qualified Cardano.Ledger.Era as SL (hashTxSeq) import qualified Cardano.Ledger.Shelley.API as SL import qualified Cardano.Protocol.TPraos.BHeader as SL import qualified Data.ByteString.Lazy as Lazy @@ -274,7 +274,7 @@ encodeShelleyBlock = toEraCBOR @era decodeShelleyBlock :: forall proto era. ShelleyCompatible proto era => forall s. Plain.Decoder s (Lazy.ByteString -> ShelleyBlock proto era) -decodeShelleyBlock = toPlainDecoder (eraProtVerLow @era) $ (. Full) . runAnnotator <$> decCBOR +decodeShelleyBlock = eraDecoder @era $ (. Full) . runAnnotator <$> decCBOR shelleyBinaryBlockInfo :: forall proto era. ShelleyCompatible proto era => ShelleyBlock proto era -> BinaryBlockInfo shelleyBinaryBlockInfo blk = BinaryBlockInfo { @@ -293,7 +293,7 @@ encodeShelleyHeader = toEraCBOR @era decodeShelleyHeader :: forall proto era. ShelleyCompatible proto era => forall s. Plain.Decoder s (Lazy.ByteString -> Header (ShelleyBlock proto era)) -decodeShelleyHeader = toPlainDecoder (eraProtVerLow @era) $ (. Full) . runAnnotator <$> decCBOR +decodeShelleyHeader = eraDecoder @era $ (. Full) . runAnnotator <$> decCBOR {------------------------------------------------------------------------------- Condense diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Forge.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Forge.hs index bfcf43ee94..465ce54514 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Forge.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Forge.hs @@ -7,7 +7,7 @@ module Ouroboros.Consensus.Shelley.Ledger.Forge (forgeShelleyBlock) where import qualified Cardano.Ledger.Core as Core (Tx) -import qualified Cardano.Ledger.Era as SL (hashTxSeq, toTxSeq) +import qualified Cardano.Ledger.Core as SL (hashTxSeq, toTxSeq) import qualified Cardano.Ledger.Shelley.API as SL (Block (..), extractTx) import qualified Cardano.Ledger.Shelley.BlockChain as SL (bBodySize) import qualified Cardano.Protocol.TPraos.BHeader as SL diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs index 9c4ff4cac8..ad6f439ad0 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs @@ -38,7 +38,7 @@ module Ouroboros.Consensus.Shelley.Ledger.Mempool ( import qualified Cardano.Crypto.Hash as Hash import qualified Cardano.Ledger.Allegra.Rules as AllegraEra -import Cardano.Ledger.Alonzo.Core (Tx, TxSeq, bodyTxL, eraProtVerLow, +import Cardano.Ledger.Alonzo.Core (Tx, TxSeq, bodyTxL, eraDecoder, fromTxSeq, ppMaxBBSizeL, ppMaxBlockExUnitsL, sizeTxF) import qualified Cardano.Ledger.Alonzo.Rules as AlonzoEra import Cardano.Ledger.Alonzo.Scripts (ExUnits, ExUnits', @@ -49,7 +49,7 @@ import qualified Cardano.Ledger.Babbage.Rules as BabbageEra import qualified Cardano.Ledger.BaseTypes as L import Cardano.Ledger.Binary (Annotator (..), DecCBOR (..), EncCBOR (..), FromCBOR (..), FullByteString (..), - ToCBOR (..), toPlainDecoder) + ToCBOR (..)) import qualified Cardano.Ledger.Conway.Rules as ConwayEra import qualified Cardano.Ledger.Conway.Rules as SL import qualified Cardano.Ledger.Conway.UTxO as SL @@ -199,7 +199,7 @@ instance ShelleyCompatible proto era => ToCBOR (GenTx (ShelleyBlock proto era)) instance ShelleyCompatible proto era => FromCBOR (GenTx (ShelleyBlock proto era)) where fromCBOR = fmap mkShelleyTx $ unwrapCBORinCBOR - $ toPlainDecoder (eraProtVerLow @era) $ (. Full) . runAnnotator <$> decCBOR + $ eraDecoder @era $ (. Full) . runAnnotator <$> decCBOR {------------------------------------------------------------------------------- Pretty-printing @@ -353,41 +353,51 @@ instance MaxTxSizeUTxO (ShelleyEra c) where , mismatchExpected = txSizeLimit } instance MaxTxSizeUTxO (AllegraEra c) where - maxTxSizeUTxO x y = + maxTxSizeUTxO txSize txSizeLimit = SL.ApplyTxError . pure $ ShelleyEra.UtxowFailure $ ShelleyEra.UtxoFailure - $ AllegraEra.MaxTxSizeUTxO x y + $ AllegraEra.MaxTxSizeUTxO + $ L.Mismatch { mismatchSupplied = txSize + , mismatchExpected = txSizeLimit } instance MaxTxSizeUTxO (MaryEra c) where - maxTxSizeUTxO x y = + maxTxSizeUTxO txSize txSizeLimit = SL.ApplyTxError . pure $ ShelleyEra.UtxowFailure $ ShelleyEra.UtxoFailure - $ AllegraEra.MaxTxSizeUTxO x y + $ AllegraEra.MaxTxSizeUTxO + $ L.Mismatch { mismatchSupplied = txSize + , mismatchExpected = txSizeLimit } instance MaxTxSizeUTxO (AlonzoEra c) where - maxTxSizeUTxO x y = + maxTxSizeUTxO txSize txSizeLimit = SL.ApplyTxError . pure $ ShelleyEra.UtxowFailure $ AlonzoEra.ShelleyInAlonzoUtxowPredFailure $ ShelleyEra.UtxoFailure - $ AlonzoEra.MaxTxSizeUTxO x y + $ AlonzoEra.MaxTxSizeUTxO + $ L.Mismatch { mismatchSupplied = txSize + , mismatchExpected = txSizeLimit } instance MaxTxSizeUTxO (BabbageEra c) where - maxTxSizeUTxO x y = + maxTxSizeUTxO txSize txSizeLimit = SL.ApplyTxError . pure $ ShelleyEra.UtxowFailure $ BabbageEra.UtxoFailure $ BabbageEra.AlonzoInBabbageUtxoPredFailure - $ AlonzoEra.MaxTxSizeUTxO x y + $ AlonzoEra.MaxTxSizeUTxO + $ L.Mismatch { mismatchSupplied = txSize + , mismatchExpected = txSizeLimit } instance MaxTxSizeUTxO (ConwayEra c) where - maxTxSizeUTxO x y = + maxTxSizeUTxO txSize txSizeLimit = SL.ApplyTxError . pure $ ConwayEra.ConwayUtxowFailure $ ConwayEra.UtxoFailure - $ ConwayEra.MaxTxSizeUTxO x y + $ ConwayEra.MaxTxSizeUTxO + $ L.Mismatch { mismatchSupplied = txSize + , mismatchExpected = txSizeLimit } ----- @@ -455,7 +465,7 @@ txMeasureAlonzo st tx@(ShelleyTx _txid tx') = limit = pparams ^. L.ppMaxTxExUnitsL exunits = - validateMaybe (exUnitsTooBigUTxO limit txsz) $ do + validateMaybe (exUnitsTooBigUTxO txsz limit) $ do guard $ pointWiseExUnits (<=) txsz limit Just $ fromExUnits txsz @@ -463,29 +473,35 @@ class ExUnitsTooBigUTxO era where exUnitsTooBigUTxO :: ExUnits -> ExUnits -> SL.ApplyTxError era instance Crypto c => ExUnitsTooBigUTxO (AlonzoEra c) where - exUnitsTooBigUTxO x y = + exUnitsTooBigUTxO txsz limit = SL.ApplyTxError . pure $ ShelleyEra.UtxowFailure $ AlonzoEra.ShelleyInAlonzoUtxowPredFailure $ ShelleyEra.UtxoFailure - $ AlonzoEra.ExUnitsTooBigUTxO x y + $ AlonzoEra.ExUnitsTooBigUTxO + $ L.Mismatch { mismatchSupplied = txsz + , mismatchExpected = limit } instance Crypto c => ExUnitsTooBigUTxO (BabbageEra c) where - exUnitsTooBigUTxO x y = + exUnitsTooBigUTxO txsz limit = SL.ApplyTxError . pure $ ShelleyEra.UtxowFailure $ BabbageEra.AlonzoInBabbageUtxowPredFailure $ AlonzoEra.ShelleyInAlonzoUtxowPredFailure $ ShelleyEra.UtxoFailure $ BabbageEra.AlonzoInBabbageUtxoPredFailure - $ AlonzoEra.ExUnitsTooBigUTxO x y + $ AlonzoEra.ExUnitsTooBigUTxO + $ L.Mismatch { mismatchSupplied = txsz + , mismatchExpected = limit } instance Crypto c => ExUnitsTooBigUTxO (ConwayEra c) where - exUnitsTooBigUTxO x y = + exUnitsTooBigUTxO txsz limit = SL.ApplyTxError . pure $ ConwayEra.ConwayUtxowFailure $ ConwayEra.UtxoFailure - $ ConwayEra.ExUnitsTooBigUTxO x y + $ ConwayEra.ExUnitsTooBigUTxO + $ L.Mismatch { mismatchSupplied = txsz + , mismatchExpected = limit } ----- @@ -546,7 +562,7 @@ txMeasureConway st tx@(ShelleyTx _txid tx') = limit = SL.maxRefScriptSizePerTx refScriptBytes = - validateMaybe (txRefScriptsSizeTooBig limit txsz) $ do + validateMaybe (txRefScriptsSizeTooBig txsz limit) $ do guard $ txsz <= limit Just $ IgnoringOverflow $ ByteSize32 $ fromIntegral txsz @@ -554,9 +570,11 @@ class TxRefScriptsSizeTooBig era where txRefScriptsSizeTooBig :: Int -> Int -> SL.ApplyTxError era instance Crypto c => TxRefScriptsSizeTooBig (ConwayEra c) where - txRefScriptsSizeTooBig x y = + txRefScriptsSizeTooBig txsz limit = SL.ApplyTxError . pure - $ ConwayEra.ConwayTxRefScriptsSizeTooBig x y + $ ConwayEra.ConwayTxRefScriptsSizeTooBig + $ L.Mismatch { mismatchSupplied = txsz + , mismatchExpected = limit } ----- diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/NetworkProtocolVersion.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/NetworkProtocolVersion.hs index 01b79c62ee..a0e3c0ab0f 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/NetworkProtocolVersion.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/NetworkProtocolVersion.hs @@ -59,14 +59,7 @@ instance SupportedNetworkProtocolVersion (ShelleyBlock proto era) where , (NodeToNodeV_14, ShelleyNodeToNodeVersion1) ] supportedNodeToClientVersions _ = Map.fromList [ - (NodeToClientV_9, ShelleyNodeToClientVersion5) - , (NodeToClientV_10, ShelleyNodeToClientVersion5) - , (NodeToClientV_11, ShelleyNodeToClientVersion5) - , (NodeToClientV_12, ShelleyNodeToClientVersion5) - , (NodeToClientV_13, ShelleyNodeToClientVersion5) - , (NodeToClientV_14, ShelleyNodeToClientVersion6) - , (NodeToClientV_15, ShelleyNodeToClientVersion7) - , (NodeToClientV_16, ShelleyNodeToClientVersion8) + (NodeToClientV_16, ShelleyNodeToClientVersion8) , (NodeToClientV_17, ShelleyNodeToClientVersion9) , (NodeToClientV_18, ShelleyNodeToClientVersion10) , (NodeToClientV_19, ShelleyNodeToClientVersion11) diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query/PParamsLegacyEncoder.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query/PParamsLegacyEncoder.hs index 6194cc8b32..8914b8f251 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query/PParamsLegacyEncoder.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query/PParamsLegacyEncoder.hs @@ -103,7 +103,7 @@ instance Crypto c => ToCBOR (LegacyPParams (AlonzoEra c)) where instance Crypto c => FromCBOR (LegacyPParams (AlonzoEra c)) where fromCBOR = - toPlainDecoder (eraProtVerLow @(AlonzoEra c)) $ + eraDecoder @(AlonzoEra c) $ decode $ RecD mkLegacyAlonzoPParams ToCBOR (LegacyPParams (BabbageEra c)) where instance Crypto c => FromCBOR (LegacyPParams (BabbageEra c)) where fromCBOR = - toPlainDecoder (eraProtVerLow @(BabbageEra c)) $ + eraDecoder @(BabbageEra c) $ decode $ RecD mkLegacyBabbagePParams . data IndividualPoolStake c = IndividualPoolStake { individualPoolStake :: !Rational - , individualPoolStakeVrf :: !(Hash c (SL.VerKeyVRF c)) + , individualPoolStakeVrf :: !(VRFVerKeyHash 'StakePoolVRF c) } deriving stock (Show, Eq, Generic) deriving anyclass (NoThunks) diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/TPraos.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/TPraos.hs index 44d13dee75..e730437fbd 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/TPraos.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/TPraos.hs @@ -35,6 +35,7 @@ module Ouroboros.Consensus.Shelley.Node.TPraos ( import qualified Cardano.Crypto.VRF as VRF import qualified Cardano.Ledger.Api.Era as L import qualified Cardano.Ledger.Api.Transition as L +import qualified Cardano.Ledger.Keys as L import qualified Cardano.Ledger.Shelley.API as SL import qualified Cardano.Protocol.TPraos.API as SL import qualified Cardano.Protocol.TPraos.OCert as Absolute (KESPeriod (..)) @@ -146,7 +147,7 @@ shelleySharedBlockForging hotKey slotToPeriod credentials = , shelleyLeaderCredentialsLabel = label } = credentials - forgingVRFHash :: SL.Hash c (SL.VerKeyVRF c) + forgingVRFHash :: L.VRFVerKeyHash 'L.GenDelegVRF c forgingVRFHash = SL.hashVerKeyVRF . VRF.deriveVerKeyVRF diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs b/ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs index d4961835e0..924653fe61 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs @@ -28,7 +28,7 @@ module Test.ThreadNet.Infra.ShelleyBasedHardFork ( ) where import qualified Cardano.Ledger.Api.Transition as L -import qualified Cardano.Ledger.Era as SL +import qualified Cardano.Ledger.Core as SL import qualified Cardano.Ledger.Shelley.API as SL import Control.Monad.Except (runExcept) import qualified Data.Map.Strict as Map diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysByron.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysByron.hs index e412bcc61f..892a18dc89 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysByron.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysByron.hs @@ -146,7 +146,7 @@ instance SerialiseAsRawBytes (SigningKey ByronKey) where either (const Nothing) (Just . ByronSigningKey . Byron.SigningKey) (snd <$> CBOR.deserialiseFromBytes decCBORXPrv (LB.fromStrict bs)) where - decCBORXPrv = toPlainDecoder byronProtVer Byron.decCBORXPrv + decCBORXPrv = toPlainDecoder Nothing byronProtVer Byron.decCBORXPrv newtype instance Hash ByronKey = ByronKeyHash Byron.KeyHash diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysPraos.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysPraos.hs index 5dd33d6dff..2ba92b0402 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysPraos.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysPraos.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE FlexibleInstances #-} @@ -203,8 +204,7 @@ instance SerialiseAsBech32 (SigningKey VrfKey) where bech32PrefixesPermitted _ = ["vrf_sk"] newtype instance Hash VrfKey = - VrfKeyHash (Shelley.Hash StandardCrypto - (Shelley.VerKeyVRF StandardCrypto)) + VrfKeyHash (Shelley.VRFVerKeyHash Shelley.StakePoolVRF StandardCrypto) deriving stock (Eq, Ord) deriving (Show, IsString) via UsingRawBytesHex (Hash VrfKey) deriving (ToCBOR, FromCBOR) via UsingRawBytes (Hash VrfKey) @@ -212,10 +212,10 @@ newtype instance Hash VrfKey = instance SerialiseAsRawBytes (Hash VrfKey) where serialiseToRawBytes (VrfKeyHash vkh) = - Crypto.hashToBytes vkh + Crypto.hashToBytes $ Shelley.unVRFVerKeyHash vkh deserialiseFromRawBytes (AsHash AsVrfKey) bs = - VrfKeyHash <$> Crypto.hashFromBytes bs + VrfKeyHash . Shelley.VRFVerKeyHash <$> Crypto.hashFromBytes bs instance HasTextEnvelope (VerificationKey VrfKey) where textEnvelopeType _ = "VrfVerificationKey_" <> fromString (Crypto.algorithmNameVRF proxy) diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/OperationalCertificate.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/OperationalCertificate.hs index f66cf4488b..9570a3175b 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/OperationalCertificate.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/OperationalCertificate.hs @@ -57,13 +57,13 @@ instance ToCBOR OperationalCertificate where toCBOR = CBOR.toPlainEncoding CBOR.shelleyProtVer . encCBOR instance FromCBOR OperationalCertificate where - fromCBOR = CBOR.toPlainDecoder CBOR.shelleyProtVer decCBOR + fromCBOR = CBOR.toPlainDecoder Nothing CBOR.shelleyProtVer decCBOR instance ToCBOR OperationalCertificateIssueCounter where toCBOR = CBOR.toPlainEncoding CBOR.shelleyProtVer . encCBOR instance FromCBOR OperationalCertificateIssueCounter where - fromCBOR = CBOR.toPlainDecoder CBOR.shelleyProtVer decCBOR + fromCBOR = CBOR.toPlainDecoder Nothing CBOR.shelleyProtVer decCBOR instance EncCBOR OperationalCertificate where encCBOR (OperationalCertificate ocert vkey) = diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/Headers.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/Headers.hs index f98b8b60c5..3376c36563 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/Headers.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/Headers.hs @@ -12,12 +12,11 @@ module Cardano.Tools.Headers ( ) where import Cardano.Crypto.DSIGN (deriveVerKeyDSIGN) -import Cardano.Crypto.VRF - (VRFAlgorithm (deriveVerKeyVRF, hashVerKeyVRF)) +import Cardano.Crypto.VRF (VRFAlgorithm (deriveVerKeyVRF)) import Cardano.Ledger.Api (ConwayEra, StandardCrypto) import Cardano.Ledger.Coin (Coin (..)) import Cardano.Ledger.Compactible (toCompact) -import Cardano.Ledger.Keys (VKey (..), hashKey) +import Cardano.Ledger.Keys (VKey (..), hashKey, hashVerKeyVRF) import Cardano.Ledger.PoolDistr (IndividualPoolStake (..)) import Cardano.Prelude (ExitCode (..), exitWith, forM_, hPutStrLn, stderr) diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ImmDBServer/Diffusion.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ImmDBServer/Diffusion.hs index 434b594361..ed6142daa7 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ImmDBServer/Diffusion.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ImmDBServer/Diffusion.hs @@ -11,6 +11,7 @@ import Control.Tracer import qualified Data.ByteString.Lazy as BL import Data.Functor.Contravariant ((>$<)) import Data.Void (Void) +import qualified Network.Mux as Mux import Network.Socket (SockAddr (..)) import Ouroboros.Consensus.Block import Ouroboros.Consensus.Config @@ -40,7 +41,7 @@ import System.FS.IO (ioHasFS) serve :: SockAddr -> N2N.Versions N2N.NodeToNodeVersion N2N.NodeToNodeVersionData - (OuroborosApplicationWithMinimalCtx 'ResponderMode SockAddr BL.ByteString IO Void ()) + (OuroborosApplicationWithMinimalCtx 'Mux.ResponderMode SockAddr BL.ByteString IO Void ()) -> IO Void serve sockAddr application = withIOManager \iocp -> do let sn = Snocket.socketSnocket iocp diff --git a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ImmDBServer/MiniProtocols.hs b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ImmDBServer/MiniProtocols.hs index ce5f4ae1ed..ce91cad39d 100644 --- a/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ImmDBServer/MiniProtocols.hs +++ b/ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/ImmDBServer/MiniProtocols.hs @@ -26,6 +26,7 @@ import qualified Data.Map.Strict as Map import Data.Typeable (Typeable) import Data.Void (Void) import GHC.Generics (Generic) +import qualified Network.Mux as Mux import Ouroboros.Consensus.Block import Ouroboros.Consensus.MiniProtocol.BlockFetch.Server (blockFetchServer') @@ -48,7 +49,7 @@ import Ouroboros.Network.Driver (runPeer) import Ouroboros.Network.KeepAlive (keepAliveServer) import Ouroboros.Network.Magic (NetworkMagic) import Ouroboros.Network.Mux (MiniProtocol (..), MiniProtocolCb (..), - MuxMode (..), OuroborosApplication (..), + OuroborosApplication (..), OuroborosApplicationWithMinimalCtx, RunMiniProtocol (..)) import Ouroboros.Network.NodeToNode (NodeToNodeVersionData (..), Versions (..)) @@ -74,7 +75,7 @@ immDBServer :: -> ImmutableDB m blk -> NetworkMagic -> Versions NodeToNodeVersion NodeToNodeVersionData - (OuroborosApplicationWithMinimalCtx 'ResponderMode addr BL.ByteString m Void ()) + (OuroborosApplicationWithMinimalCtx 'Mux.ResponderMode addr BL.ByteString m Void ()) immDBServer codecCfg encAddr decAddr immDB networkMagic = do forAllVersions application where @@ -98,7 +99,7 @@ immDBServer codecCfg encAddr decAddr immDB networkMagic = do application :: NodeToNodeVersion -> BlockNodeToNodeVersion blk - -> OuroborosApplicationWithMinimalCtx 'ResponderMode addr BL.ByteString m Void () + -> OuroborosApplicationWithMinimalCtx 'Mux.ResponderMode addr BL.ByteString m Void () application version blockVersion = OuroborosApplication miniprotocols where diff --git a/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Generators.hs b/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Generators.hs index d71bf21450..26fb068c45 100644 --- a/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Generators.hs +++ b/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/Consensus/Shelley/Generators.hs @@ -11,8 +11,8 @@ module Test.Consensus.Shelley.Generators (SomeResult (..)) where +import Cardano.Ledger.Core (toTxSeq) import Cardano.Ledger.Crypto (Crypto) -import Cardano.Ledger.Era (toTxSeq) import qualified Cardano.Ledger.Shelley.API as SL import qualified Cardano.Protocol.TPraos.API as SL import qualified Cardano.Protocol.TPraos.BHeader as SL diff --git a/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/ThreadNet/Infra/Shelley.hs b/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/ThreadNet/Infra/Shelley.hs index 2ca053c7a8..1d40354d2c 100644 --- a/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/ThreadNet/Infra/Shelley.hs +++ b/ouroboros-consensus-cardano/src/unstable-shelley-testlib/Test/ThreadNet/Infra/Shelley.hs @@ -36,18 +36,18 @@ module Test.ThreadNet.Infra.Shelley ( ) where import Cardano.Crypto.DSIGN (DSIGNAlgorithm (..), seedSizeDSIGN) -import Cardano.Crypto.Hash (Hash, HashAlgorithm) +import Cardano.Crypto.Hash (HashAlgorithm) import Cardano.Crypto.KES (KESAlgorithm (..)) import Cardano.Crypto.Seed (mkSeedFromBytes) import qualified Cardano.Crypto.Seed as Cardano.Crypto -import Cardano.Crypto.VRF (SignKeyVRF, VRFAlgorithm, VerKeyVRF, - deriveVerKeyVRF, genKeyVRF, seedSizeVRF) +import Cardano.Crypto.VRF (SignKeyVRF, deriveVerKeyVRF, genKeyVRF, + seedSizeVRF) import qualified Cardano.Ledger.Allegra.Scripts as SL import Cardano.Ledger.Alonzo (AlonzoEra) import Cardano.Ledger.BaseTypes (boundRational) import Cardano.Ledger.Crypto (Crypto, DSIGN, HASH, KES, VRF) import Cardano.Ledger.Hashes (EraIndependentTxBody) -import qualified Cardano.Ledger.Keys +import qualified Cardano.Ledger.Keys as LK import qualified Cardano.Ledger.Mary.Core as SL import Cardano.Ledger.SafeHash (HashAnnotated (..), SafeHash, hashAnnotated) @@ -182,7 +182,7 @@ genCoreNode startKESPeriod = do vrfKey <- genKeyVRF <$> genSeed (seedSizeVRF (Proxy @(VRF c))) kesKey <- genKeyKES <$> genSeed (seedSizeKES (Proxy @(KES c))) let kesPub = deriveVerKeyKES kesKey - sigma = Cardano.Ledger.Keys.signedDSIGN + sigma = LK.signedDSIGN @c delKey (SL.OCertSignable kesPub certificateIssueNumber startKESPeriod) @@ -522,9 +522,9 @@ mkVerKey = SL.VKey . deriveVerKeyDSIGN mkKeyPair :: Crypto c => SL.SignKeyDSIGN c -> TL.KeyPair r c mkKeyPair sk = TL.KeyPair { vKey = mkVerKey sk, sKey = sk } -mkKeyHashVrf :: (HashAlgorithm h, VRFAlgorithm vrf) - => SignKeyVRF vrf - -> Hash h (VerKeyVRF vrf) +mkKeyHashVrf :: (Crypto c) + => SignKeyVRF (VRF c) + -> LK.VRFVerKeyHash (r :: LK.KeyRoleVRF) c mkKeyHashVrf = SL.hashVerKeyVRF . deriveVerKeyVRF networkId :: SL.Network diff --git a/ouroboros-consensus-diffusion/changelog.d/20241120_160052_neilmayhew_release_srp.md b/ouroboros-consensus-diffusion/changelog.d/20241120_160052_neilmayhew_release_srp.md new file mode 100644 index 0000000000..12d1820d4c --- /dev/null +++ b/ouroboros-consensus-diffusion/changelog.d/20241120_160052_neilmayhew_release_srp.md @@ -0,0 +1,3 @@ +### Patch + +- Depend on `network-mux` from `ouroboros-network` and use its types. diff --git a/ouroboros-consensus-diffusion/ouroboros-consensus-diffusion.cabal b/ouroboros-consensus-diffusion/ouroboros-consensus-diffusion.cabal index c255270097..0a38e48c73 100644 --- a/ouroboros-consensus-diffusion/ouroboros-consensus-diffusion.cabal +++ b/ouroboros-consensus-diffusion/ouroboros-consensus-diffusion.cabal @@ -89,6 +89,7 @@ library hashable, io-classes ^>=1.5, mtl, + network-mux ^>=0.5, ouroboros-consensus ^>=0.21, ouroboros-network ^>=0.18, ouroboros-network-api ^>=0.11, diff --git a/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToClient.hs b/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToClient.hs index bae1f4ce6a..fcd971d6b1 100644 --- a/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToClient.hs +++ b/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToClient.hs @@ -42,6 +42,7 @@ import Control.ResourceRegistry import Control.Tracer import Data.ByteString.Lazy (ByteString) import Data.Void (Void) +import qualified Network.Mux as Mux import Network.TypedProtocol.Codec import qualified Network.TypedProtocol.Stateful.Codec as Stateful import Ouroboros.Consensus.Block @@ -465,7 +466,7 @@ mkApps kernel Tracers {..} Codecs {..} Handlers {..} = responder :: N.NodeToClientVersion -> Apps m (ConnectionId peer) b b b b a - -> OuroborosApplicationWithMinimalCtx 'ResponderMode peer b m Void a + -> OuroborosApplicationWithMinimalCtx 'Mux.ResponderMode peer b m Void a responder version Apps {..} = nodeToClientProtocols (NodeToClientProtocols { diff --git a/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToNode.hs b/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToNode.hs index f30ad37a31..83732d2603 100644 --- a/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToNode.hs +++ b/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToNode.hs @@ -52,6 +52,7 @@ import Data.Hashable (Hashable) import Data.Int (Int64) import Data.Map.Strict (Map) import Data.Void (Void) +import qualified Network.Mux as Mux import Network.TypedProtocol.Codec import Ouroboros.Consensus.Block import Ouroboros.Consensus.Config (DiffusionPipeliningSupport (..)) @@ -810,7 +811,7 @@ initiator :: -> NodeToNodeVersion -> PSTypes.PeerSharing -> Apps m addr b b b b b a c - -> OuroborosBundleWithExpandedCtx 'InitiatorMode addr b m a Void + -> OuroborosBundleWithExpandedCtx 'Mux.InitiatorMode addr b m a Void initiator miniProtocolParameters version ownPeerSharing Apps {..} = nodeToNodeProtocols miniProtocolParameters @@ -845,7 +846,7 @@ initiatorAndResponder :: -> NodeToNodeVersion -> PSTypes.PeerSharing -> Apps m addr b b b b b a c - -> OuroborosBundleWithExpandedCtx 'InitiatorResponderMode addr b m a c + -> OuroborosBundleWithExpandedCtx 'Mux.InitiatorResponderMode addr b m a c initiatorAndResponder miniProtocolParameters version ownPeerSharing Apps {..} = nodeToNodeProtocols miniProtocolParameters diff --git a/ouroboros-consensus-protocol/changelog.d/20241120_152542_neilmayhew_release_srp.md b/ouroboros-consensus-protocol/changelog.d/20241120_152542_neilmayhew_release_srp.md new file mode 100644 index 0000000000..24be4981f3 --- /dev/null +++ b/ouroboros-consensus-protocol/changelog.d/20241120_152542_neilmayhew_release_srp.md @@ -0,0 +1,10 @@ +### Breaking + +- Change the type of the `tpraosIsLeaderGenVRFHash` field of the `TPraosIsLeader` type + to use the new `VRFVerKeyHash` ledger type. +- Change the type of the `VRFKeyWrongVRFKey` constructor of the `PraosValidationErr` type + to use the new `VRFVerKeyHash` ledger type. +- Change the type of the `TPraosCannotForgeWrongVRF` constructor of the `TPraosCannotForge` type + to use the new `VRFVerKeyHash` ledger type. +- Change the type of the `tpraosCheckCanForge` function + to use the new `VRFVerKeyHash` ledger type. diff --git a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos.hs b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos.hs index 3ddbcf200b..6f42dfd1d3 100644 --- a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos.hs +++ b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Praos.hs @@ -37,7 +37,6 @@ module Ouroboros.Consensus.Protocol.Praos ( import Cardano.Binary (FromCBOR (..), ToCBOR (..), enforceSize) import qualified Cardano.Crypto.DSIGN as DSIGN import qualified Cardano.Crypto.KES as KES -import Cardano.Crypto.VRF (hashVerKeyVRF) import qualified Cardano.Crypto.VRF as VRF import Cardano.Ledger.BaseTypes (ActiveSlotCoeff, Nonce, (⭒)) import qualified Cardano.Ledger.BaseTypes as SL @@ -45,7 +44,7 @@ import qualified Cardano.Ledger.Chain as SL import Cardano.Ledger.Crypto (Crypto, DSIGN, KES, StandardCrypto, VRF) import Cardano.Ledger.Hashes (EraIndependentTxBody) import Cardano.Ledger.Keys (KeyHash, KeyRole (BlockIssuer), - VKey (VKey), coerceKeyRole, hashKey) + VKey (VKey), coerceKeyRole, hashKey, hashVerKeyVRF) import qualified Cardano.Ledger.Keys as SL import Cardano.Ledger.PoolDistr (IndividualPoolStake (IndividualPoolStake)) @@ -319,8 +318,8 @@ data PraosValidationErr c !(KeyHash SL.StakePool c) -- unknown VRF keyhash (not registered) | VRFKeyWrongVRFKey !(KeyHash SL.StakePool c) -- KeyHash of block issuer - !(SL.Hash c (SL.VerKeyVRF c)) -- VRF KeyHash registered with stake pool - !(SL.Hash c (SL.VerKeyVRF c)) -- VRF KeyHash from Header + !(SL.VRFVerKeyHash 'SL.StakePoolVRF c) -- VRF KeyHash registered with stake pool + !(SL.VRFVerKeyHash 'SL.StakePoolVRF c) -- VRF KeyHash from Header | VRFKeyBadProof !SlotNo -- Slot used for VRF calculation !Nonce -- Epoch nonce used for VRF calculation diff --git a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/TPraos.hs b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/TPraos.hs index 37a9475a8b..ffb316b9c1 100644 --- a/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/TPraos.hs +++ b/ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/TPraos.hs @@ -221,7 +221,7 @@ data TPraosIsLeader c = TPraosIsLeader { , tpraosIsLeaderProof :: SL.CertifiedVRF c Natural -- | When in the overlay schedule (otherwise 'Nothing'), return the hash -- of the VRF verification key in the overlay schedule - , tpraosIsLeaderGenVRFHash :: Maybe (SL.Hash c (SL.VerKeyVRF c)) + , tpraosIsLeaderGenVRFHash :: Maybe (SL.VRFVerKeyHash 'SL.GenDelegVRF c) } deriving (Generic) @@ -449,15 +449,15 @@ data TPraosCannotForge c = -- | We are a genesis delegate, but our VRF key (second argument) does not -- match the registered key for that delegate (first argument). | TPraosCannotForgeWrongVRF - !(SL.Hash c (SL.VerKeyVRF c)) - !(SL.Hash c (SL.VerKeyVRF c)) + !(SL.VRFVerKeyHash 'SL.GenDelegVRF c) + !(SL.VRFVerKeyHash 'SL.GenDelegVRF c) deriving (Generic) deriving instance SL.PraosCrypto c => Show (TPraosCannotForge c) tpraosCheckCanForge :: ConsensusConfig (TPraos c) - -> SL.Hash c (SL.VerKeyVRF c) + -> SL.VRFVerKeyHash 'SL.GenDelegVRF c -- ^ Precomputed hash of the VRF verification key -> SlotNo -> IsLeader (TPraos c) diff --git a/ouroboros-consensus/changelog.d/20241120_160044_neilmayhew_release_srp.md b/ouroboros-consensus/changelog.d/20241120_160044_neilmayhew_release_srp.md new file mode 100644 index 0000000000..36018328fa --- /dev/null +++ b/ouroboros-consensus/changelog.d/20241120_160044_neilmayhew_release_srp.md @@ -0,0 +1,3 @@ +### Non-Breaking + +- Drop NodeToClient versions < 16. diff --git a/ouroboros-consensus/ouroboros-consensus.cabal b/ouroboros-consensus/ouroboros-consensus.cabal index 774a787b19..2a5d2e6cda 100644 --- a/ouroboros-consensus/ouroboros-consensus.cabal +++ b/ouroboros-consensus/ouroboros-consensus.cabal @@ -278,7 +278,7 @@ library bytestring >=0.10 && <0.13, cardano-binary, cardano-crypto-class, - cardano-ledger-core ^>=1.15, + cardano-ledger-core ^>=1.16, cardano-prelude, cardano-slotting, cardano-strict-containers, diff --git a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/Query/Version.hs b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/Query/Version.hs index 204c8e5ded..5eea4d6674 100644 --- a/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/Query/Version.hs +++ b/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/Query/Version.hs @@ -20,13 +20,6 @@ data QueryVersion -- | Get the @QueryVersion@ supported by this @NodeToClientVersion@. nodeToClientVersionToQueryVersion :: NodeToClientVersion -> QueryVersion nodeToClientVersionToQueryVersion x = case x of - NodeToClientV_9 -> QueryVersion1 - NodeToClientV_10 -> QueryVersion2 - NodeToClientV_11 -> QueryVersion2 - NodeToClientV_12 -> QueryVersion2 - NodeToClientV_13 -> QueryVersion2 - NodeToClientV_14 -> QueryVersion2 - NodeToClientV_15 -> QueryVersion2 NodeToClientV_16 -> QueryVersion2 NodeToClientV_17 -> QueryVersion2 NodeToClientV_18 -> QueryVersion2