Skip to content

Commit

Permalink
Upgrade cardano-base dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
tdammers authored and lehins committed Dec 11, 2024
1 parent 9c9ce36 commit cddb913
Show file tree
Hide file tree
Showing 32 changed files with 120 additions and 312 deletions.
29 changes: 17 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## Roles and responsibilities

The
[@cardano-ledger](https://github.com/orgs/input-output-hk/teams/cardano-ledger)
[@cardano-ledger](https://github.com/orgs/IntersectMBO/teams/cardano-ledger?query=membership%3Achild-team)
group is responsible for
helping with reviewing and merging pull requests, adjudicating technical (or other) disputes,
releasing the ledger packages on [CHaP](https://github.com/input-output-hk/cardano-haskell-packages).
releasing the ledger packages on [CHaP](https://github.com/IntersectMBO/cardano-haskell-packages).

@hamishmack can help with issues regarding this repository's continuous integration and nix infrastructure.

Expand Down Expand Up @@ -43,21 +43,21 @@ See documentation on the adopted [release and versioning processes](./RELEASING.

### Releasing the ledger packages to CHaP

Ledger packages are released to [CHaP](https://github.com/input-output-hk/cardano-haskell-packages).
Ledger packages are released to [CHaP](https://github.com/IntersectMBO/cardano-haskell-packages).

Also see the CHaP README for [instructions](https://github.com/input-output-hk/cardano-haskell-packages#-from-github).
Also see the CHaP README for [instructions](https://github.com/IntersectMBO/cardano-haskell-packages#-from-github).

## Building

See the [Readme](https://github.com/intersectmbo/cardano-ledger#building) for instructions on building.
See the [Readme](https://github.com/IntersectMBO/cardano-ledger#building) for instructions on building.

### GHC 9.2 transition
### GHC 9.x transition

We are transitioning to use GHC 9.2 rather than GHC 8.10.
We need to retain 8.10 compatibility until we are sure that the Cardano node can switch over to 9.2 without any problems.
We are transitioning to use GHC 9.x rather than GHC 8.10.
We need to retain 8.10 compatibility until we are sure that the Cardano node can switch over to 9.8 without any problems.
At that point we can drop it.

The main `nix develop` shell will now give you a GHC 9.2 compiler, but you can get a GHC 8.10 shell by calling
The main `nix develop` shell will now give you a GHC 9.8 compiler, but you can get a GHC 8.10 shell by calling
```
nix develop .#ghc8107
```
Expand All @@ -67,7 +67,7 @@ nix develop .#ghc8107

Our Haskell packages come from two package repositories:
- Hackage
- [CHaP](https://github.com/input-output-hk/cardano-haskell-packages) (which is essentially another Hackage)
- [CHaP](https://github.com/IntersectMBO/cardano-haskell-packages) (which is essentially another Hackage)

The "index state" of each repository is pinned to a particular time in `cabal.project`.
This tells Cabal to treat the repository "as if" it was the specified time, ensuring reproducibility.
Expand All @@ -80,6 +80,11 @@ Note that `cabal` itself keeps track of what index states it knows about, so whe
The Nix code which builds our packages also cares about the index state.
This is represented by inputs managed by `nix flake`:
You can update these by running:
- `nix flake update haskellNix/hackage` for Hackage
- `nix flake update CHaP` for CHaP (Cardano Haskell Packages)

or this, if you are on an older `nix flake`:

- `nix flake lock --update-input haskellNix/hackage` for Hackage
- `nix flake lock --update-input CHaP` for CHaP (Cardano Haskell Packages)

Expand All @@ -91,10 +96,10 @@ error: Unknown index-state 2021-08-08T00:00:00Z, the latest index-state I know a
### Use of `source-repository-package`s

We *can* use Cabal's `source-repository-package` mechanism to pull in un-released package versions.
However, we should try and avoid this.
However, we must avoid this for dependencies of packages that are subject to release process.
In particular, we should not release our packages to CHaP while we depend on a `source-repository-package`.

If we are stuck in a situation where we need a long-running fork of a package, we should release it to CHaP instead (see the [CHaP README](https://github.com/input-output-hk/cardano-haskell-packages) for more).
If we are stuck in a situation where we need a long-running fork of a package, we should release it to CHaP instead (see the [CHaP README](https://github.com/IntersectMBO/cardano-haskell-packages) for more).

If you do add a `source-repository-package`, you need to provide a `--sha256` comment in `cabal.project` so that Nix knows the hash of the content.

Expand Down
21 changes: 19 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,27 @@ source-repository-package
-- Before merging a PR in `cardano-ledger`, make sure that the above SRP
-- points to a commit in `MAlonzo-code` if you were fiddling with the SRP
-- as part of your PR.
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-base
tag: b6f0b11d9dedfbd1bff83d3406f6b463edcd6c6c
--sha256: sha256-R90EOAHn44FQe9wQf9qMmnRgmfD0dlkfHcFpaDsZYIc=
subdir:
cardano-crypto-class
cardano-crypto-tests
cardano-crypto-praos

source-repository-package
type: git
location: https://github.com/IntersectMBO/plutus
tag: 3a950466e6949822602267e2022e832b73a46f30
--sha256: sha256-eb7i9wZgEgoeowERyA5GrZOh3G/JDeuqAFm61qJnnXk=
subdir:
plutus-core

index-state:
-- Bump this if you need newer packages from Hackage
-- Bump this if you need newer packages from CHaP
, hackage.haskell.org 2024-11-20T00:00:00Z
, hackage.haskell.org 2024-12-10T00:00:00Z
, cardano-haskell-packages 2024-11-27T20:49:28Z

packages:
Expand Down
2 changes: 1 addition & 1 deletion eras/allegra/impl/cardano-ledger-allegra.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ library
bytestring,
cardano-crypto-class,
cardano-ledger-binary >=1.4,
cardano-ledger-core >=1.16 && <1.17,
cardano-ledger-core >=1.17 && <1.18,
cardano-ledger-shelley ^>=1.15,
cardano-slotting,
cardano-strict-containers,
Expand Down
4 changes: 2 additions & 2 deletions eras/alonzo/impl/cardano-ledger-alonzo.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ library
cardano-crypto-class,
cardano-data ^>=1.2.1,
cardano-ledger-allegra ^>=1.6.1,
cardano-ledger-binary ^>=1.5,
cardano-ledger-core ^>=1.16,
cardano-ledger-binary ^>=1.6,
cardano-ledger-core ^>=1.17,
cardano-ledger-mary ^>=1.7,
cardano-ledger-shelley ^>=1.15,
cardano-slotting,
Expand Down
2 changes: 1 addition & 1 deletion eras/babbage/impl/cardano-ledger-babbage.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ library
cardano-ledger-allegra ^>=1.6.1,
cardano-ledger-alonzo >=1.12,
cardano-ledger-binary >=1.4,
cardano-ledger-core >=1.16 && <1.17,
cardano-ledger-core >=1.17 && <1.18,
cardano-ledger-mary ^>=1.7,
cardano-ledger-shelley ^>=1.15,
cardano-strict-containers,
Expand Down
4 changes: 2 additions & 2 deletions eras/conway/impl/cardano-ledger-conway.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ library
cardano-ledger-allegra ^>=1.6.1,
cardano-ledger-alonzo ^>=1.12,
cardano-ledger-babbage ^>=1.10.1,
cardano-ledger-binary ^>=1.5,
cardano-ledger-core ^>=1.16,
cardano-ledger-binary ^>=1.6,
cardano-ledger-core ^>=1.17,
cardano-ledger-mary ^>=1.7,
cardano-ledger-shelley ^>=1.15,
cardano-slotting,
Expand Down
2 changes: 1 addition & 1 deletion eras/mary/impl/cardano-ledger-mary.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ library
cardano-data ^>=1.2,
cardano-ledger-allegra ^>=1.6.1,
cardano-ledger-binary >=1.4,
cardano-ledger-core >=1.16 && <1.17,
cardano-ledger-core >=1.17 && <1.18,
cardano-ledger-shelley ^>=1.15,
cardano-strict-containers,
containers,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: cardano-ledger-shelley-ma-test
version: 1.2.2.4
version: 1.2.2.5
license: Apache-2.0
maintainer: [email protected]
author: IOHK
Expand Down Expand Up @@ -47,7 +47,7 @@ library
base >=4.14 && <5,
bytestring,
cardano-ledger-allegra:{cardano-ledger-allegra, testlib} >=1.6 && <1.7,
cardano-ledger-binary:{cardano-ledger-binary, testlib} ^>=1.5,
cardano-ledger-binary:{cardano-ledger-binary, testlib} ^>=1.6,
cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14,
cardano-ledger-mary:{cardano-ledger-mary, testlib} >=1.7 && <1.8,
cardano-ledger-shelley:{cardano-ledger-shelley, testlib} >=1.12,
Expand Down
4 changes: 2 additions & 2 deletions eras/shelley/impl/cardano-ledger-shelley.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ library
cardano-crypto-class,
cardano-crypto-wrapper,
cardano-data ^>=1.2.2,
cardano-ledger-binary ^>=1.5,
cardano-ledger-binary ^>=1.6,
cardano-ledger-byron,
cardano-ledger-core ^>=1.16,
cardano-ledger-core ^>=1.17,
cardano-slotting,
cardano-strict-containers,
containers,
Expand Down
4 changes: 2 additions & 2 deletions eras/shelley/test-suite/cardano-ledger-shelley-test.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ library
cardano-crypto-class,
cardano-crypto-wrapper,
cardano-data >=1.2,
cardano-ledger-binary:{cardano-ledger-binary, testlib} ^>=1.5,
cardano-ledger-binary:{cardano-ledger-binary, testlib} ^>=1.6,
cardano-ledger-byron,
cardano-ledger-core:{cardano-ledger-core, testlib} >=1.15,
cardano-ledger-core:{cardano-ledger-core, testlib} >=1.17,
cardano-ledger-shelley:{cardano-ledger-shelley, testlib} >=1.14,
cardano-protocol-tpraos:{cardano-protocol-tpraos, testlib} >=1.0.1,
cardano-slotting:{cardano-slotting, testlib},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module Test.Cardano.Ledger.Shelley.Examples.Consensus where

import Cardano.Crypto.DSIGN as DSIGN
import Cardano.Crypto.Hash as Hash
import Cardano.Crypto.KES as KES
import Cardano.Crypto.Seed as Seed
import qualified Cardano.Crypto.VRF as VRF
import Cardano.Ledger.AuxiliaryData
Expand Down Expand Up @@ -181,7 +182,7 @@ exampleShelleyLedgerBlock tx = Block blockHeader blockBody
KeyPair vKeyCold _ = aikCold keys

blockHeader :: BHeader (EraCrypto era)
blockHeader = BHeader blockHeaderBody (signedKES () 0 blockHeaderBody hotKey)
blockHeader = BHeader blockHeaderBody (unsoundPureSignedKES () 0 blockHeaderBody hotKey)

blockHeaderBody :: BHBody (EraCrypto era)
blockHeaderBody =
Expand Down
11 changes: 6 additions & 5 deletions eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ import Cardano.Crypto.Hash (
hashToBytes,
)
import Cardano.Crypto.KES (
KESAlgorithm (..),
deriveVerKeyKES,
genKeyKES,
UnsoundPureKESAlgorithm (..),
unsoundPureDeriveVerKeyKES,
unsoundPureGenKeyKES,
)
import Cardano.Crypto.Seed (Seed, mkSeedFromBytes)
import Cardano.Crypto.VRF (
Expand Down Expand Up @@ -211,10 +211,11 @@ mkCertifiedVRF a sk =
-- | For testing purposes, generate a deterministic KES key pair given a seed.
mkKESKeyPair :: Crypto c => RawSeed -> KESKeyPair c
mkKESKeyPair seed =
let sk = genKeyKES $ mkSeedFromWords seed
let sk = unsoundPureGenKeyKES (mkSeedFromWords seed)
vk = unsoundPureDeriveVerKeyKES sk
in KESKeyPair
{ kesSignKey = sk
, kesVerKey = deriveVerKeyKES sk
, kesVerKey = vk
}

runShelleyBase :: ShelleyBase a -> a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
module Test.Cardano.Ledger.Shelley.Serialisation.Golden.Encoding (tests) where

import qualified Cardano.Crypto.Hash as Monomorphic
import Cardano.Crypto.KES (SignedKES)
import Cardano.Crypto.KES (SignedKES, unsoundPureSignedKES)
import Cardano.Crypto.VRF (CertifiedVRF)
import Cardano.Ledger.Address (Addr (..), RewardAccount (..))
import Cardano.Ledger.BaseTypes (
Expand Down Expand Up @@ -76,7 +76,6 @@ import Cardano.Ledger.Keys (
hashKey,
hashVerKeyVRF,
signedDSIGN,
signedKES,
)
import Cardano.Ledger.PoolParams (
PoolMetadata (..),
Expand Down Expand Up @@ -382,7 +381,7 @@ testBHBSigTokens ::
testBHBSigTokens = e
where
s =
signedKES @(KES (EraCrypto era))
unsoundPureSignedKES @(KES (EraCrypto era))
()
0
(testBHB @era)
Expand Down Expand Up @@ -990,7 +989,7 @@ tests =
)
, -- checkEncodingCBOR "block_header"
let sig :: (SignedKES (KES C_Crypto) (BHBody C_Crypto))
sig = signedKES () 0 (testBHB @C) (kesSignKey $ testKESKeys @C_Crypto)
sig = unsoundPureSignedKES () 0 (testBHB @C) (kesSignKey $ testKESKeys @C_Crypto)
in checkEncodingCBORAnnotated
shelleyProtVer
"block_header"
Expand All @@ -1001,7 +1000,7 @@ tests =
)
, -- checkEncodingCBOR "empty_block"
let sig :: (SignedKES (KES C_Crypto) (BHBody C_Crypto))
sig = signedKES () 0 (testBHB @C) (kesSignKey $ testKESKeys @C_Crypto)
sig = unsoundPureSignedKES () 0 (testBHB @C) (kesSignKey $ testKESKeys @C_Crypto)
bh = BHeader (testBHB @C) sig
txns = ShelleyTxSeq StrictSeq.Empty
in checkEncodingCBORAnnotated
Expand All @@ -1014,7 +1013,7 @@ tests =
)
, -- checkEncodingCBOR "rich_block"
let sig :: SignedKES (KES C_Crypto) (BHBody C_Crypto)
sig = signedKES () 0 (testBHB @C) (kesSignKey $ testKESKeys @C_Crypto)
sig = unsoundPureSignedKES () 0 (testBHB @C) (kesSignKey $ testKESKeys @C_Crypto)
bh = BHeader (testBHB @C) sig
tout = StrictSeq.singleton $ ShelleyTxOut @C testAddrE (Coin 2)
txb :: Word64 -> ShelleyTxBody C
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

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

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
'';

shell = {

# force LANG to be UTF-8, otherwise GHC might choke on UTF encoded data.
shellHook = ''
export LANG=en_US.UTF-8
Expand Down
2 changes: 1 addition & 1 deletion libs/cardano-ledger-api/cardano-ledger-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ library
cardano-ledger-babbage >=1.10.1 && <=1.11,
cardano-ledger-binary >=1.4,
cardano-ledger-conway >=1.13 && <1.19,
cardano-ledger-core >=1.16 && <1.17,
cardano-ledger-core >=1.17 && <1.18,
cardano-ledger-mary ^>=1.7,
cardano-ledger-shelley ^>=1.15,
cardano-strict-containers,
Expand Down
2 changes: 1 addition & 1 deletion libs/cardano-ledger-binary/.ghcid
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--command="cabal repl --repl-options='-isrc -fwarn-unused-binds -fwarn-unused-imports -fno-code -fobject-code -g2 -fno-break-on-exception -fno-break-on-error -ferror-spans -j -Wno-unused-packages'" --clear --no-height-limit --reverse-errors --reload=../../ --outputfile=/tmp/cardano-ledger-binary-ghcid.txt
--command="cabal repl --repl-options='-isrc -fwarn-unused-binds -fwarn-unused-imports -fno-code -fobject-code -g2 -fno-break-on-exception -fno-break-on-error -ferror-spans -j -Wno-unused-packages'" --clear --no-height-limit --reverse-errors --reload=../../ --outputfile=/tmp/cardano-ledger-binary-ghcid.txt
5 changes: 5 additions & 0 deletions libs/cardano-ledger-binary/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Version history for `cardano-ledger-binary`

## 1.6.0.0

* Remove `encodeSignKeyKES` and `decodeSignKeyKES`
* Remove `EncCBOR` and `DecCBOR` instances for `SignKeyKES`

## 1.5.0.0

* Remove deprecated `decodeAnnotator`, `decCBORMaybe`, `encCBORMaybe`, `sizedDecoder`, `encodePair`
Expand Down
2 changes: 1 addition & 1 deletion libs/cardano-ledger-binary/cardano-ledger-binary.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: cardano-ledger-binary
version: 1.5.0.0
version: 1.6.0.0
license: Apache-2.0
maintainer: [email protected]
author: IOHK
Expand Down
10 changes: 0 additions & 10 deletions libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Crypto.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ module Cardano.Ledger.Binary.Crypto (
-- * KES
encodeVerKeyKES,
decodeVerKeyKES,
encodeSignKeyKES,
decodeSignKeyKES,
encodeSigKES,
decodeSigKES,
encodeSignedKES,
Expand Down Expand Up @@ -85,14 +83,6 @@ decodeVerKeyKES :: C.KESAlgorithm v => Decoder s (C.VerKeyKES v)
decodeVerKeyKES = fromPlainDecoder C.decodeVerKeyKES
{-# INLINE decodeVerKeyKES #-}

encodeSignKeyKES :: C.KESAlgorithm v => C.SignKeyKES v -> Encoding
encodeSignKeyKES = fromPlainEncoding . C.encodeSignKeyKES
{-# INLINE encodeSignKeyKES #-}

decodeSignKeyKES :: C.KESAlgorithm v => Decoder s (C.SignKeyKES v)
decodeSignKeyKES = fromPlainDecoder C.decodeSignKeyKES
{-# INLINE decodeSignKeyKES #-}

encodeSigKES :: C.KESAlgorithm v => C.SigKES v -> Encoding
encodeSigKES = fromPlainEncoding . C.encodeSigKES
{-# INLINE encodeSigKES #-}
Expand Down
Loading

0 comments on commit cddb913

Please sign in to comment.