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

Integrate ouroboros-network and cardano-ledger #1314

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 55 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
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.

Original file line number Diff line number Diff line change
@@ -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.
19 changes: 10 additions & 9 deletions ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -549,6 +549,7 @@ library unstable-cardano-tools
microlens,
mtl,
network,
network-mux,
nothunks,
ouroboros-consensus ^>=0.21,
ouroboros-consensus-cardano,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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'.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading