Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
description: |
Integration for cardano-node 11.1. Highlights:

Breaking:
- `initialLedgerState`, `foldBlocks`, `foldEpochState`, `mkProtocolInfoCardano`
and `genesisConfigToEnv` (all in `Cardano.Api.LedgerState`) take a new
`SomeHasFS IO` argument, used by consensus to stream genesis data from disk.
- In `Cardano.Api.Consensus`, the `ProtocolInfoArgs` data family is now
parameterised by the monad (`ProtocolInfoArgs m blk`) and `protocolInfo`
returns its result monadically. The `ProtocolInfoArgsCardano` and
`ProtocolInfoArgsShelley` constructors gain a `SomeHasFS m` field.
- The first type parameter of `Ledger.LedgerTables` is now the block
(e.g. `HardForkBlock (CardanoEras StandardCrypto)`) rather than
`LedgerState` of the block. This propagates through exported
`Cardano.Api.LedgerState` items including `AnyNewEpochState`,
`getLedgerTablesUTxOValues`, `toLedgerStateEvents`,
`tickThenReapplyCheckHash` and `tickThenApply`.
- Removed orphan `ToJSON` instances (previously made visible by
`import Cardano.Api`) for `NonEmptyMap`, `NonEmptySet`,
`Ledger.StakeSnapshots` and `Ledger.StakeSnapshot`. These instances are
now provided upstream.
- Dependency bound bumps:
`cardano-crypto-class ^>=2.5`, `small-steps ^>=1.2`, `fs-api ^>=0.4`.

Compatible:
- `shelleyGenesisDefaults` and `conwayGenesisDefaults` populate the new
`sgExtraConfig` / `cgExtraConfig` ledger fields with their default values.
kind:
- breaking
- compatible
pr: 1221
project: cardano-api
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
description: |
`Cardano.Rpc.Server.Internal.UtxoRpc.Type.txInTxOutToAnyUtxoData` now
serialises the UTxO RPC `nativeBytes` for tx outputs using the era's ledger
CBOR (`L.serialize' (eraProtVerHigh era)`) instead of the unversioned
`Cardano.Binary.serialize'`. Downstream gRPC consumers will see the era's
canonical encoding rather than the previous era-agnostic bytes.
kind:
- bugfix
pr: 1221
project: cardano-rpc
59 changes: 55 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ index-state:
, hackage.haskell.org 2026-05-28T20:13:41Z
, cardano-haskell-packages 2026-05-28T08:12:31Z

active-repositories:
, :rest
, cardano-haskell-packages:override

packages:
cardano-api
cardano-api-gen
Expand Down Expand Up @@ -160,3 +156,58 @@ if impl(ghc >=9.14)
, with-utf8:base
-- cabal-allow-newer end

source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-ledger.git
tag: 3f879bb37df4738ed8211e500c7d180443cfcbe4
--sha256: sha256-uLjiIHiU1SzAmoKs+rynQphc3FUYXKeJLlOnp87uNdg=
subdir:
eras/allegra/impl
eras/alonzo/impl
eras/babbage/impl
eras/byron/chain/executable-spec
eras/byron/crypto
eras/byron/ledger/executable-spec
eras/byron/ledger/impl
eras/conway/impl
eras/dijkstra/impl
eras/mary/impl
eras/shelley-ma/test-suite
eras/shelley/impl
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/small-steps
libs/vector-map

source-repository-package
type: git
location: https://github.com/f-f/kes-agent.git
tag: 0b362519f6915841c92869ed288ce83f89b17b73
--sha256: sha256-8pZYF7MJZZ1tM19wIUhbLKORDL+OP2ckhueWJM4aG/c=
subdir:
kes-agent
kes-agent-crypto

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-consensus.git
tag: fc7665d0cb041565f1cce8819fefea51b395baf1
--sha256: sha256-uPn1cRPyfvlNkQqysjUfzmNJihdFauMdDztal1ZSbQg=
subdir:
.

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-network.git
tag: cb58582d5d55b3bce2b4c4ca8322ece46827e74e
--sha256: sha256-0aUzLQriB6Syq/+3sOw8EG8UMTZx5tN/o7IZV2c2WRo=
subdir:
./cardano-diffusion
./monoidal-synchronisation
./network-mux
./ouroboros-network
15 changes: 9 additions & 6 deletions cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ library
bytestring,
bytestring-trie,
cardano-addresses ^>=4.0.0,
cardano-base ^>=0.1,
cardano-binary,
cardano-crypto,
cardano-crypto-class ^>=2.3,
cardano-crypto-class ^>=2.5,
cardano-crypto-wrapper ^>=1.7,
cardano-data >=1.0,
cardano-diffusion:{api, cardano-diffusion} ^>=1.0,
Expand Down Expand Up @@ -164,11 +165,12 @@ library
extra,
filepath,
formatting,
fs-api ^>=0.4,
groups,
iproute,
memory,
mempack,
microlens <0.5,
microlens <0.6,
mono-traversable,
mtl,
network,
Expand All @@ -189,7 +191,7 @@ library
scientific,
serialise,
singletons,
small-steps ^>=1.1,
small-steps ^>=1.2,
sop-core,
sop-extras,
stm,
Expand Down Expand Up @@ -329,8 +331,8 @@ library gen
base16-bytestring,
bytestring,
cardano-api,
cardano-binary >=1.6 && <1.9,
cardano-crypto-class ^>=2.3,
cardano-binary >=1.6 && <1.10,
cardano-crypto-class ^>=2.5,
cardano-crypto-wrapper:testlib ^>=1.7,
cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib},
cardano-ledger-byron:testlib,
Expand All @@ -344,6 +346,7 @@ library gen
hedgehog >=1.1,
hedgehog-extras,
hedgehog-quickcheck,
mempack,
ordered-containers,
tasty,
tasty-hedgehog,
Expand All @@ -367,7 +370,7 @@ test-suite cardano-api-test
cardano-api:gen,
cardano-binary,
cardano-crypto,
cardano-crypto-class:{cardano-crypto-class, testlib} ^>=2.3,
cardano-crypto-class:{cardano-crypto-class, testlib} ^>=2.5,
cardano-crypto-wrapper:testlib,
cardano-ledger-alonzo,
cardano-ledger-api ^>=1.13,
Expand Down
7 changes: 6 additions & 1 deletion cardano-api/gen/Test/Gen/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import Cardano.Ledger.Plutus.CostModels qualified as Plutus
import Cardano.Ledger.Plutus.Language qualified as Alonzo
import Cardano.Ledger.Shelley.TxAuxData (Metadatum (..), ShelleyTxAuxData (..))

import Data.ByteString.Short qualified as SBS
import Data.Map.Strict qualified as Map
import Data.MemPack.Buffer (byteArrayFromShortByteString)
import Data.Word (Word64)
import GHC.Exts (IsList (..))

Expand All @@ -41,7 +43,10 @@ genMetadata = do
genMetadatum :: Gen Metadatum
genMetadatum = do
int <- Gen.list (Range.linear 1 5) (I <$> Gen.integral (Range.linear 1 100))
bytes <- Gen.list (Range.linear 1 5) (B <$> Gen.bytes (Range.linear 1 20))
bytes <-
Gen.list
(Range.linear 1 5)
(B . byteArrayFromShortByteString . SBS.toShort <$> Gen.bytes (Range.linear 1 20))
str <- Gen.list (Range.linear 1 5) (S <$> Gen.text (Range.linear 1 20) Gen.alphaNum)
let mDatumList = int ++ bytes ++ str

Expand Down
9 changes: 5 additions & 4 deletions cardano-api/src/Cardano/Api/Certificate/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Cardano.Api.Key.Internal
import Cardano.Api.Key.Internal.Praos
import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger

import Cardano.Base.IP (mkIPv4, mkIPv6, unIPv4, unIPv6)
import Cardano.Ledger.Coin qualified as L
import Cardano.Ledger.State qualified as Ledger

Expand Down Expand Up @@ -125,8 +126,8 @@ toShelleyPoolParams
toShelleyStakePoolRelay (StakePoolRelayIp mipv4 mipv6 mport) =
Ledger.SingleHostAddr
(fromIntegral <$> Ledger.maybeToStrictMaybe mport)
(Ledger.maybeToStrictMaybe mipv4)
(Ledger.maybeToStrictMaybe mipv6)
(Ledger.maybeToStrictMaybe (mkIPv4 <$> mipv4))
(Ledger.maybeToStrictMaybe (mkIPv6 <$> mipv6))
toShelleyStakePoolRelay (StakePoolRelayDnsARecord dnsname mport) =
Ledger.SingleHostName
(fromIntegral <$> Ledger.maybeToStrictMaybe mport)
Expand Down Expand Up @@ -192,8 +193,8 @@ fromShelleyPoolParams
fromShelleyStakePoolRelay :: Ledger.StakePoolRelay -> StakePoolRelay
fromShelleyStakePoolRelay (Ledger.SingleHostAddr mport mipv4 mipv6) =
StakePoolRelayIp
(Ledger.strictMaybeToMaybe mipv4)
(Ledger.strictMaybeToMaybe mipv6)
(fmap unIPv4 (Ledger.strictMaybeToMaybe mipv4))
(fmap unIPv6 (Ledger.strictMaybeToMaybe mipv6))
(fromIntegral . Ledger.portToWord16 <$> Ledger.strictMaybeToMaybe mport)
fromShelleyStakePoolRelay (Ledger.SingleHostName mport dnsname) =
StakePoolRelayDnsARecord
Expand Down
43 changes: 25 additions & 18 deletions cardano-api/src/Cardano/Api/Consensus/Internal/Protocol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,18 @@ import Ouroboros.Consensus.Shelley.ShelleyHFC (ShelleyBlockHFC)
import Ouroboros.Consensus.Util.IOLike (IOLike)

import Control.Tracer qualified as Tracer
import Data.Bifunctor (bimap)
import System.FS.API (SomeHasFS)

import Type.Reflection ((:~:) (..))

class (RunNode blk, IOLike m) => Protocol m blk where
data ProtocolInfoArgs blk
data ProtocolInfoArgs m blk
protocolInfo
:: ProtocolInfoArgs blk
-> ( ProtocolInfo blk
, Tracer.Tracer m KESAgentClientTrace -> m [MkBlockForging m blk]
)
:: ProtocolInfoArgs m blk
-> m
( ProtocolInfo blk
, Tracer.Tracer m KESAgentClientTrace -> m [MkBlockForging m blk]
)

-- | Node client support for each consensus protocol.
--
Expand All @@ -62,22 +63,27 @@ class RunNode blk => ProtocolClient blk where

-- | Run PBFT against the Byron ledger
instance IOLike m => Protocol m ByronBlockHFC where
data ProtocolInfoArgs ByronBlockHFC = ProtocolInfoArgsByron ProtocolParamsByron
data ProtocolInfoArgs m ByronBlockHFC = ProtocolInfoArgsByron ProtocolParamsByron
protocolInfo (ProtocolInfoArgsByron params) =
( inject $ protocolInfoByron params
, \_ -> pure . map (MkBlockForging . pure . inject) $ blockForgingByron params
)
pure
( inject $ protocolInfoByron params
, \_ -> pure . map (MkBlockForging . pure . inject) $ blockForgingByron params
)

instance
(CardanoHardForkConstraints StandardCrypto, IOLike m, MonadKESAgent m)
( CardanoHardForkConstraints StandardCrypto
, IOLike m
, MonadKESAgent m
)
=> Protocol m (CardanoBlock StandardCrypto)
where
data ProtocolInfoArgs (CardanoBlock StandardCrypto)
data ProtocolInfoArgs m (CardanoBlock StandardCrypto)
= ProtocolInfoArgsCardano
(SomeHasFS m)
(CardanoProtocolParams StandardCrypto)

protocolInfo (ProtocolInfoArgsCardano paramsCardano) =
protocolInfoCardano paramsCardano
protocolInfo (ProtocolInfoArgsCardano fs paramsCardano) =
protocolInfoCardano fs paramsCardano

instance ProtocolClient ByronBlockHFC where
data ProtocolClientInfoArgs ByronBlockHFC
Expand All @@ -102,14 +108,15 @@ instance
)
=> Protocol m (ShelleyBlockHFC (Consensus.TPraos StandardCrypto) ShelleyEra)
where
data ProtocolInfoArgs (ShelleyBlockHFC (Consensus.TPraos StandardCrypto) ShelleyEra)
data ProtocolInfoArgs m (ShelleyBlockHFC (Consensus.TPraos StandardCrypto) ShelleyEra)
= ProtocolInfoArgsShelley
(SomeHasFS m)
ShelleyGenesis
(ProtocolParamsShelleyBased StandardCrypto)
ProtVer
protocolInfo (ProtocolInfoArgsShelley genesis paramsShelleyBased_ paramsShelley_) =
bimap inject (fmap $ fmap $ map inject) $
protocolInfoShelley genesis paramsShelleyBased_ paramsShelley_
protocolInfo (ProtocolInfoArgsShelley fs genesis paramsShelleyBased_ paramsShelley_) = do
(pinfo, bf) <- protocolInfoShelley fs genesis paramsShelleyBased_ paramsShelley_
pure (inject pinfo, \tr -> map inject <$> bf tr)

instance
Consensus.LedgerSupportsProtocol
Expand Down
2 changes: 2 additions & 0 deletions cardano-api/src/Cardano/Api/Genesis/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ shelleyGenesisDefaults =
, sgStaking = emptyGenesisStaking
, sgInitialFunds = ListMap.empty
, sgMaxLovelaceSupply = 0
, sgExtraConfig = SJust DefaultClass.def
}
where
k = knownNonZeroBounded @2160
Expand Down Expand Up @@ -215,6 +216,7 @@ conwayGenesisDefaults =
, cgCommittee = DefaultClass.def
, cgDelegs = mempty
, cgInitialDReps = mempty
, cgExtraConfig = SJust DefaultClass.def
}
where
defaultUpgradeConwayParams :: UpgradeConwayPParams Identity
Expand Down
Loading
Loading