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
25 changes: 14 additions & 11 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ repository cardano-haskell-packages
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

index-state:
, hackage.haskell.org 2025-09-11T07:59:00Z
, cardano-haskell-packages 2025-09-11T08:36:14Z
, hackage.haskell.org 2026-05-08T22:40:19Z
, cardano-haskell-packages 2026-05-08T13:26:45Z

packages:
./
Expand Down Expand Up @@ -46,26 +46,29 @@ package direct-sqlite
flags: +nomutex

constraints:
, any.cardano-node == 10.5.1
, any.cardano-node == 11.0.1

, any.cardano-ledger-core == 1.17.0.0
, any.cardano-ledger-shelley == 1.16.0.0
, any.cardano-ledger-conway == 1.19.0.0
, any.cardano-ledger-conway >= 1.22.1.0

, any.ouroboros-consensus == 0.27.0.0
, any.ouroboros-consensus-cardano == 0.25.1.0
, any.ouroboros-network == 0.21.3.0
, any.ouroboros-consensus ^>= 3.0.1
, any.ouroboros-network ^>= 1.1

, any.io-classes == 1.5.0.0
, any.io-classes-mtl == 0.1.2.0
, any.io-classes ^>= 1.8
, any.formatting == 7.2.0
, any.validation < 1.2
, any.text source

-- Use serial block IO instead of io_uring to avoid requiring liburing
, any.blockio +serialblockio

, direct-sqlite == 2.3.29.1
, sqlite-simple == 0.4.19.0.1

allow-newer:
*:formatting
, katip:Win32
, io-sim:time
, io-classes:time

-- NOTE update hash using
-- nix-prefetch-git https://github.com/CardanoSolutions/ogmios.git --rev <tag> --fetch-submodules --quiet | jq '.hash' | tail -c +9 | head -c -2
Expand Down
26 changes: 17 additions & 9 deletions kupo.cabal

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

16 changes: 9 additions & 7 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ library:
- cardano-ledger-byron
- cardano-ledger-conway
- cardano-ledger-core
- cardano-ledger-dijkstra
- cardano-ledger-mary
- cardano-ledger-shelley
- cardano-slotting
Expand All @@ -93,13 +94,13 @@ library:
- modern-uri
- network-mux
- optparse-applicative
- cardano-diffusion
- ouroboros-consensus
- ouroboros-consensus-cardano
- ouroboros-consensus-diffusion
- ouroboros-network
- ouroboros-network-api
- ouroboros-network-framework
- ouroboros-network-protocols
- ouroboros-consensus:cardano
- ouroboros-consensus:diffusion
- ouroboros-network:api
- ouroboros-network:framework
- ouroboros-network:protocols
- prometheus
- relude
- resource-pool
Expand Down Expand Up @@ -139,14 +140,15 @@ tests:
- http-types
- io-classes
- io-sim
- network
- kupo
- lens-aeson
- openapi3
- process
- QuickCheck
- quickcheck-state-machine
- relude
- si-timers
- io-classes:si-timers
- sqlite-simple
- stm
- temporary
Expand Down
8 changes: 5 additions & 3 deletions src/Kupo/Control/MonadOuroboros.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import Kupo.Control.MonadThrow
import Network.Mux
( StartOnDemandOrEagerly (..)
)
import qualified Network.Mux
import Ouroboros.Consensus.Byron.Ledger.Config
( CodecConfig (..)
)
Expand Down Expand Up @@ -74,7 +75,7 @@ import Ouroboros.Network.Mux
, OuroborosApplication (..)
, RunMiniProtocol (..)
)
import Ouroboros.Network.NodeToClient
import Cardano.Network.NodeToClient
( NetworkConnectTracers (..)
, NodeToClientVersion (..)
, NodeToClientVersionData (..)
Expand Down Expand Up @@ -119,7 +120,7 @@ instance MonadOuroboros IO where
connectTo (mkLocalSnocket iocp) tracers versions socket >>= either throwIO return
where
tracers = NetworkConnectTracers
{ nctMuxTracer = nullTracer
{ nctMuxTracers = Network.Mux.nullTracers
, nctHandshakeTracer = nullTracer
}

Expand Down Expand Up @@ -167,7 +168,7 @@ codecs epochSlots nodeToClientV =
supportedVersions =
supportedNodeToClientVersions (Proxy @(BlockT IO))
cfg =
CardanoCodecConfig byron shelley allegra mary alonzo babbage conway
CardanoCodecConfig byron shelley allegra mary alonzo babbage conway dijkstra
where
byron = ByronCodecConfig epochSlots
shelley = ShelleyCodecConfig
Expand All @@ -176,3 +177,4 @@ codecs epochSlots nodeToClientV =
alonzo = ShelleyCodecConfig
babbage = ShelleyCodecConfig
conway = ShelleyCodecConfig
dijkstra = ShelleyCodecConfig
58 changes: 50 additions & 8 deletions src/Kupo/Data/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ import Kupo.Data.Cardano.Value

import qualified Cardano.Chain.UTxO as Ledger.Byron
import qualified Cardano.Ledger.Alonzo.Core as Ledger
import qualified Cardano.Ledger.Alonzo.Tx as Ledger
import qualified Cardano.Ledger.Alonzo.TxWits as Ledger
import qualified Cardano.Ledger.Babbage.Core as Ledger
import qualified Cardano.Ledger.Block as Ledger
Expand Down Expand Up @@ -184,17 +183,19 @@ instance IsBlock Block where
in
foldrWithIndex ignoreProtocolTxs result (extractTxs blk)
BlockShelley (ShelleyBlock (Ledger.Block _ txs) _) ->
foldrWithIndex (\ix -> fn ix . TransactionShelley) result (Ledger.fromTxSeq txs)
foldrWithIndex (\ix -> fn ix . TransactionShelley) result (txs ^. Ledger.txSeqBlockBodyL)
BlockAllegra (ShelleyBlock (Ledger.Block _ txs) _) ->
foldrWithIndex (\ix -> fn ix . TransactionAllegra) result (Ledger.fromTxSeq txs)
foldrWithIndex (\ix -> fn ix . TransactionAllegra) result (txs ^. Ledger.txSeqBlockBodyL)
BlockMary (ShelleyBlock (Ledger.Block _ txs) _) ->
foldrWithIndex (\ix -> fn ix . TransactionMary) result (Ledger.fromTxSeq txs)
foldrWithIndex (\ix -> fn ix . TransactionMary) result (txs ^. Ledger.txSeqBlockBodyL)
BlockAlonzo (ShelleyBlock (Ledger.Block _ txs) _) ->
foldrWithIndex (\ix -> fn ix . TransactionAlonzo) result (Ledger.fromTxSeq txs)
foldrWithIndex (\ix -> fn ix . TransactionAlonzo) result (txs ^. Ledger.txSeqBlockBodyL)
BlockBabbage (ShelleyBlock (Ledger.Block _ txs) _) ->
foldrWithIndex (\ix -> fn ix . TransactionBabbage) result (Ledger.fromTxSeq txs)
foldrWithIndex (\ix -> fn ix . TransactionBabbage) result (txs ^. Ledger.txSeqBlockBodyL)
BlockConway (ShelleyBlock (Ledger.Block _ txs) _) ->
foldrWithIndex (\ix -> fn ix . TransactionConway) result (Ledger.fromTxSeq txs)
foldrWithIndex (\ix -> fn ix . TransactionConway) result (txs ^. Ledger.txSeqBlockBodyL)
BlockDijkstra (ShelleyBlock (Ledger.Block _ txs) _) ->
foldrWithIndex (\ix -> fn ix . TransactionDijkstra) result (txs ^. Ledger.txSeqBlockBodyL)

spentInputs
:: Transaction
Expand Down Expand Up @@ -226,6 +227,12 @@ instance IsBlock Block where
tx ^. Ledger.bodyTxL . Ledger.inputsTxBodyL
Ledger.IsValid False ->
tx ^. Ledger.bodyTxL . Ledger.collateralInputsTxBodyL
TransactionDijkstra tx ->
case tx ^. Ledger.isValidTxL of
Ledger.IsValid True ->
tx ^. Ledger.bodyTxL . Ledger.inputsTxBodyL
Ledger.IsValid False ->
tx ^. Ledger.bodyTxL . Ledger.collateralInputsTxBodyL
where
transformByron (Ledger.Byron.TxInUtxo txId ix) =
mkOutputReference
Expand Down Expand Up @@ -309,12 +316,29 @@ instance IsBlock Block where
in
case tx ^. Ledger.isValidTxL of
Ledger.IsValid True ->
traverseAndTransform identity txId meta 0 outs
traverseAndTransform fromConwayOutput txId meta 0 outs
Ledger.IsValid False ->
-- From Conway formal specification:
--
-- Note that the new collOuts function generates a single output
-- with an index |txouts{txb}|.
let start = fromIntegral (length outs) in
case body ^. Ledger.collateralReturnTxBodyL of
SNothing ->
[]
SJust r ->
traverseAndTransform fromConwayOutput txId meta start (r :<| mempty)
TransactionDijkstra tx ->
let
body = tx ^. Ledger.bodyTxL
txId = Ledger.txIdTxBody @DijkstraEra body
outs = body ^. Ledger.outputsTxBodyL
meta = tx ^. Ledger.auxDataTxL & strictMaybe emptyMetadata fromDijkstraMetadata
in
case tx ^. Ledger.isValidTxL of
Ledger.IsValid True ->
traverseAndTransform identity txId meta 0 outs
Ledger.IsValid False ->
let start = fromIntegral (length outs) in
case body ^. Ledger.collateralReturnTxBodyL of
SNothing ->
Expand Down Expand Up @@ -381,6 +405,8 @@ instance IsBlock Block where
fromBabbageData <$> Ledger.unTxDats (tx ^. Ledger.witsTxL . Ledger.datsTxWitsL)
TransactionConway tx ->
fromConwayData <$> Ledger.unTxDats (tx ^. Ledger.witsTxL . Ledger.datsTxWitsL)
TransactionDijkstra tx ->
fromDijkstraData <$> Ledger.unTxDats (tx ^. Ledger.witsTxL . Ledger.datsTxWitsL)

witnessedScripts
:: Transaction
Expand Down Expand Up @@ -413,6 +439,13 @@ instance IsBlock Block where
& scriptsFromOutputs
(fromBabbageOutput <$> tx ^. Ledger.bodyTxL . Ledger.outputsTxBodyL)
TransactionConway tx ->
( fromConwayScript <$> tx ^. Ledger.witsTxL . Ledger.scriptTxWitsL
) & strictMaybe identity
(scriptFromAlonzoAuxiliaryData fromConwayScript)
(tx ^. Ledger.auxDataTxL)
& scriptsFromOutputs
(fromConwayOutput <$> tx ^. Ledger.bodyTxL . Ledger.outputsTxBodyL)
TransactionDijkstra tx ->
( tx ^. Ledger.witsTxL . Ledger.scriptTxWitsL
) & strictMaybe identity
(scriptFromAlonzoAuxiliaryData identity)
Expand Down Expand Up @@ -468,6 +501,13 @@ instance IsBlock Block where
SJust auxData ->
let meta = fromConwayMetadata auxData
in Just (hashMetadata meta, meta)
TransactionDijkstra tx ->
case tx ^. Ledger.auxDataTxL of
SNothing ->
Nothing
SJust auxData ->
let meta = fromDijkstraMetadata auxData
in Just (hashMetadata meta, meta)

spendRedeemer
:: Transaction
Expand All @@ -489,3 +529,5 @@ instance IsBlock Block where
Just (RedeemersBabbage (tx ^. Ledger.witsTxL . Ledger.rdmrsTxWitsL))
TransactionConway tx ->
Just (RedeemersConway (tx ^. Ledger.witsTxL . Ledger.rdmrsTxWitsL))
TransactionDijkstra tx ->
Just (RedeemersDisjkstra (tx ^. Ledger.witsTxL . Ledger.rdmrsTxWitsL))
4 changes: 0 additions & 4 deletions src/Kupo/Data/Cardano/AssetName.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ module Kupo.Data.Cardano.AssetName where

import Kupo.Prelude

import Ouroboros.Consensus.Util
( eitherToMaybe
)

import qualified Cardano.Ledger.Mary.Value as Ledger
import qualified Data.ByteString as BS

Expand Down
Loading