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
78 changes: 74 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,84 @@ index-state:
-- Bump this if you need newer packages from Hackage
, hackage.haskell.org 2026-05-18T17:14:36Z
-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2026-05-18T13:56:34Z
, cardano-haskell-packages 2026-05-20T06:15:42Z

active-repositories:
Comment thread
f-f marked this conversation as resolved.
, :rest
Comment thread
jasagredo marked this conversation as resolved.
, cardano-haskell-packages:override

packages: .

-- cardano-base master, past the contra-tracer 0.2.1 bump (PR#659)
source-repository-package
Comment thread
jasagredo marked this conversation as resolved.
type: git
location: https://github.com/IntersectMBO/cardano-base.git
tag: d6e5c68bbb87f528fc1926a32c462c5bf06f1782
--sha256: sha256-VPm9BCey+R8dhpaopawx0v2CVxlQ3aGdVPSwurFngpA=
subdir:
base-deriving-via
cardano-base
cardano-binary
cardano-crypto-class
cardano-crypto-praos
cardano-git-rev
cardano-slotting
cardano-strict-containers
heapwords
measures

-- plutus master, past PR#7783 (Interval inclusiveLowerBound / inclusiveUpperBound)
source-repository-package
Comment thread
jasagredo marked this conversation as resolved.
type: git
location: https://github.com/IntersectMBO/plutus.git
tag: 59261563fd997a64f318cfb69305617f7892a7fa
--sha256: sha256-npZIAtR5PFqUKRooLehu4zrfgahbU5RkxGtLV7HTi6w=
subdir:
plutus-core
plutus-ledger-api
plutus-metatheory
plutus-tx
plutus-tx-plugin

-- kes-agent on branch f-f/allow-crypto-class-2.5
source-repository-package
Comment thread
jasagredo marked this conversation as resolved.
type: git
location: https://github.com/f-f/kes-agent.git
tag: 0b362519f6915841c92869ed288ce83f89b17b73
--sha256: sha256-8pZYF7MJZZ1tM19wIUhbLKORDL+OP2ckhueWJM4aG/c=
subdir:
kes-agent
kes-agent-crypto

-- cardano-ledger on branch f-f/prepare-11.1-2
source-repository-package
Comment thread
jasagredo marked this conversation as resolved.
type: git
location: https://github.com/IntersectMBO/cardano-ledger.git
tag: 6a71a6b37879c0b77abdeac30ae94102620f5a2c
--sha256: sha256-8mKgdf9b4UAy6c6OeaJh0yRPqt3NDeOUH9ko2uBSSBI=
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/impl
eras/shelley/test-suite
eras/shelley-ma/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

-- We want to always build the test-suites and benchmarks
tests: true
benchmarks: true
Expand All @@ -50,12 +120,12 @@ constraints:
plutus-ledger-api ^>=1.61,
plutus-tx ^>=1.61

-- ouroboros-network dependency after introducing `bracketKeepAlive` (PR#5371)
-- on coot/tracing-instances branch
source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-network
tag: e8d59d8a219563760fc21ba5bc86fab77d886742
--sha256: sha256-ElgaE5JeDTPfyDQnyZs5ZlOdzlnZYl7z1OgkzCBJjek=
tag: bd53562dff7311fc8ba09b9414b395df8f1e8158
--sha256: sha256-c7miOTTT/g89hXd9FjR0Ch0FYzXQVFn7X9rqJgr8oR4=
subdir:
ouroboros-network
cardano-diffusion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,9 @@ crossEraForecastByronToShelleyWrapper =
| forecastFor < maxFor =
return $
WrapLedgerView $
SL.mkInitialShelleyLedgerView
(toFromByronTranslationContext (shelleyLedgerGenesis cfgShelley))
SL.forecastToTPraosLedgerView $
SL.mkInitialShelleyForecast
(toFromByronTranslationContext (shelleyLedgerGenesis cfgShelley))
| otherwise =
throwError $
OutsideForecastRange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ import qualified Ouroboros.Consensus.Shelley.Node.TPraos as TPraos
import Ouroboros.Consensus.Storage.Serialisation
import Ouroboros.Consensus.TypeFamilyWrappers
import Ouroboros.Consensus.Util.Assert
import System.FS.API (SomeHasFS (..))

{-------------------------------------------------------------------------------
SerialiseHFC
Expand Down Expand Up @@ -580,23 +581,27 @@ protocolInfoCardano ::
( CardanoHardForkConstraints c
, KESAgentContext c m
) =>
SomeHasFS m ->
CardanoProtocolParams c ->
( ProtocolInfo (CardanoBlock c)
, Tracer.Tracer m KESAgentClientTrace -> m [MkBlockForging m (CardanoBlock c)]
)
protocolInfoCardano paramsCardano
m
( ProtocolInfo (CardanoBlock c)
, Tracer.Tracer m KESAgentClientTrace -> m [MkBlockForging m (CardanoBlock c)]
)
protocolInfoCardano (SomeHasFS hasFS) paramsCardano
| SL.Mainnet <- SL.sgNetworkId genesisShelley
, length credssShelleyBased > 1 =
error "Multiple Shelley-based credentials not allowed for mainnet"
| otherwise =
assertWithMsg
(validateGenesis genesisShelley)
( ProtocolInfo
{ pInfoConfig = cfg
, pInfoInitLedger = initExtLedgerStateCardano
}
, pure . mkBlockForgings
)
| otherwise = do
initExtLedgerStateCardano <- mkInitExtLedgerStateCardano
pure $
assertWithMsg
(validateGenesis genesisShelley)
( ProtocolInfo
{ pInfoConfig = cfg
, pInfoInitLedger = initExtLedgerStateCardano
}
, pure . mkBlockForgings
)
where
CardanoProtocolParams
{ byronProtocolParams
Expand Down Expand Up @@ -930,49 +935,56 @@ protocolInfoCardano paramsCardano
-- data from the genesis config (if provided) in the ledger state. For
-- example, this includes initial staking and initial funds (useful for
-- testing/benchmarking).
initExtLedgerStateCardano :: ExtLedgerState (CardanoBlock c) ValuesMK
initExtLedgerStateCardano =
ExtLedgerState
{ headerState = initHeaderState
, ledgerState = overShelleyBasedLedgerState initLedgerState
}
mkInitExtLedgerStateCardano :: m (ExtLedgerState (CardanoBlock c) ValuesMK)
mkInitExtLedgerStateCardano = do
let HardForkLedgerState st = initLedgerState
st' <- hsequence' (hap perEraInjections st)
pure
ExtLedgerState
{ headerState = initHeaderState
, ledgerState = HardForkLedgerState st'
}
where
overShelleyBasedLedgerState (HardForkLedgerState st) =
HardForkLedgerState $ hap (fn id :* registerAny) st

initHeaderState :: HeaderState (CardanoBlock c)
initLedgerState :: LedgerState (CardanoBlock c) ValuesMK
ExtLedgerState initLedgerState initHeaderState =
injectInitialExtLedgerState cfg $
initExtLedgerStateByron

registerAny :: NP (Flip LedgerState ValuesMK -.-> Flip LedgerState ValuesMK) (CardanoShelleyEras c)
registerAny =
hcmap (Proxy @IsShelleyBlock) injectIntoTestState $
WrapTransitionConfig transitionConfigShelley
:* WrapTransitionConfig transitionConfigAllegra
:* WrapTransitionConfig transitionConfigMary
:* WrapTransitionConfig transitionConfigAlonzo
:* WrapTransitionConfig transitionConfigBabbage
:* WrapTransitionConfig transitionConfigConway
:* WrapTransitionConfig transitionConfigDijkstra
:* Nil

injectIntoTestState ::
ShelleyBasedEra era =>
perEraInjections ::
NP
(Flip LedgerState ValuesMK -.-> (m :.: Flip LedgerState ValuesMK))
(CardanoEras c)
perEraInjections =
fn (Comp . pure)
:* hcmap (Proxy @IsShelleyBlock) shelleyInjection shelleyTcfgs

shelleyInjection ::
forall proto era.
Shelley.ShelleyCompatible proto era =>
Comment thread
f-f marked this conversation as resolved.
WrapTransitionConfig (ShelleyBlock proto era) ->
(Flip LedgerState ValuesMK -.-> Flip LedgerState ValuesMK) (ShelleyBlock proto era)
injectIntoTestState (WrapTransitionConfig tcfg) = fn $ \(Flip st) ->
-- We need to unstow the injected values
Flip $
unstowLedgerTables $
forgetLedgerTables $
st
{ Shelley.shelleyLedgerState =
L.injectIntoTestState
tcfg
(Shelley.shelleyLedgerState $ stowLedgerTables st)
}
(Flip LedgerState ValuesMK -.-> (m :.: Flip LedgerState ValuesMK))
(ShelleyBlock proto era)
shelleyInjection (WrapTransitionConfig tcfg) = fn $ \(Flip stIn) -> Comp $ do
let stowed = stowLedgerTables stIn
newNES <-
L.injectIntoTestState
hasFS
tcfg
(Shelley.shelleyLedgerState stowed)
pure . Flip . unstowLedgerTables . forgetLedgerTables $
stowed{Shelley.shelleyLedgerState = newNES}

shelleyTcfgs :: NP WrapTransitionConfig (CardanoShelleyEras c)
shelleyTcfgs =
WrapTransitionConfig transitionConfigShelley
:* WrapTransitionConfig transitionConfigAllegra
:* WrapTransitionConfig transitionConfigMary
:* WrapTransitionConfig transitionConfigAlonzo
:* WrapTransitionConfig transitionConfigBabbage
:* WrapTransitionConfig transitionConfigConway
:* WrapTransitionConfig transitionConfigDijkstra
:* Nil

-- \| For each element in the list, a block forging thread will be started.
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Ouroboros.Consensus.Shelley.Eras
, StandardCrypto
) where

import Cardano.Binary
import Cardano.Binary (FromCBOR, ToCBOR)
import Cardano.Ledger.Allegra (AllegraEra)
import Cardano.Ledger.Allegra.Translation ()
import Cardano.Ledger.Alonzo (AlonzoEra, ApplyTxError (AlonzoApplyTxError))
Expand Down Expand Up @@ -57,7 +57,6 @@ import qualified Cardano.Ledger.Shelley.API as SL
import qualified Cardano.Ledger.Shelley.LedgerState as SL
import qualified Cardano.Ledger.Shelley.Rules as SL
import qualified Cardano.Ledger.Shelley.Transition as SL
import qualified Cardano.Protocol.TPraos.API as SL
import Control.Monad.Except
import Control.State.Transition (PredicateFailure)
import Data.Data (Proxy (Proxy))
Expand Down Expand Up @@ -95,11 +94,9 @@ class
( Core.EraBlockBody era
, Core.EraGov era
, SL.ApplyTx era
, SL.ApplyBlock era
, SL.ApplyTick era
, SL.EraTransition era
, -- TODO This constraint is quite tight, since it fixes things to the
-- original TPraos ledger view. We would like to ultimately remove it.
SL.GetLedgerView era
, SL.EraForecast era
, NoThunks (SL.StashedAVVMAddresses era)
, EncCBOR (SL.StashedAVVMAddresses era)
, DecCBOR (SL.StashedAVVMAddresses era)
Expand All @@ -111,7 +108,6 @@ class
, EncCBOR (PredicateFailure (EraRule "UTXOW" era))
, Eq (PredicateFailure (EraRule "BBODY" era))
, Show (PredicateFailure (EraRule "BBODY" era))
, NoThunks (PredicateFailure (EraRule "BBODY" era))
Comment thread
geo2a marked this conversation as resolved.
, NoThunks (Core.TranslationContext era)
, ToCBOR (Core.TranslationContext era)
, FromCBOR (Core.TranslationContext era)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ module Ouroboros.Consensus.Shelley.HFEras
, StandardShelleyBlock
) where

import Cardano.Ledger.Dijkstra.Era (DijkstraEraBlockHeader (..))
import Cardano.Protocol.Crypto
import Ouroboros.Consensus.Protocol.Praos (Praos)
import qualified Ouroboros.Consensus.Protocol.Praos as Praos
import Ouroboros.Consensus.Protocol.Praos.Header (Header)
import Ouroboros.Consensus.Protocol.TPraos (TPraos)
import qualified Ouroboros.Consensus.Protocol.TPraos as TPraos
import Ouroboros.Consensus.Shelley.Eras
Expand Down Expand Up @@ -77,29 +79,11 @@ instance
TPraos.PraosCrypto c =>
ShelleyCompatible (TPraos c) AlonzoEra

-- This instance is required since the ledger view forecast function for
-- Praos/Babbage still goes through the forecast for TPraos. Once this is
-- addressed, we could remove this instance.
instance
(Praos.PraosCrypto c, TPraos.PraosCrypto c) =>
ShelleyCompatible (TPraos c) BabbageEra

instance Praos.PraosCrypto c => ShelleyCompatible (Praos c) BabbageEra

-- This instance is required since the ledger view forecast function for
-- Praos/Conway still goes through the forecast for TPraos. Once this is
-- addressed, we could remove this instance.
instance
(Praos.PraosCrypto c, TPraos.PraosCrypto c) =>
ShelleyCompatible (TPraos c) ConwayEra

instance Praos.PraosCrypto c => ShelleyCompatible (Praos c) ConwayEra

-- This instance is required since the ledger view forecast function for
-- Praos/Dijkstra still goes through the forecast for TPraos. Once this is
-- addressed, we could remove this instance.
instance
(Praos.PraosCrypto c, TPraos.PraosCrypto c) =>
ShelleyCompatible (TPraos c) DijkstraEra

instance Praos.PraosCrypto c => ShelleyCompatible (Praos c) DijkstraEra

instance Crypto c => DijkstraEraBlockHeader (Header c) DijkstraEra where
prevNonceBlockHeaderL = error "Not implemented. Peras placeholder"
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ import Cardano.Ledger.Binary
, FullByteString (..)
, serialize
)
import Cardano.Ledger.Binary.Group (EncCBORGroup)
import qualified Cardano.Ledger.Binary.Plain as Plain
import qualified Cardano.Ledger.Block as SL (EraBlockHeader)
import Cardano.Ledger.Core as SL
( eraDecoder
, eraProtVerLow
, toEraCBOR
)
import qualified Cardano.Ledger.Core as SL (TranslationContext, hashBlockBody)
import qualified Cardano.Ledger.Core as SL (BlockBody, TranslationContext, hashBlockBody)
import Cardano.Ledger.Hashes (HASH)
import qualified Cardano.Ledger.Shelley.API as SL
import Cardano.Protocol.Crypto (Crypto)
Expand Down Expand Up @@ -103,12 +105,15 @@ type instance BlockProtocol (ShelleyBlock proto era) = proto
class
( ShelleyBasedEra era
, ShelleyProtocol proto
, EncCBORGroup (SL.BlockBody era)
, -- Header constraints
Eq (ShelleyProtocolHeader proto)
, Show (ShelleyProtocolHeader proto)
, NoThunks (ShelleyProtocolHeader proto)
, EncCBOR (ShelleyProtocolHeader proto)
, DecCBOR (Annotator (ShelleyProtocolHeader proto))
, SL.EraBlockHeader (ShelleyProtocolHeader proto) era
, SL.ApplyBlock (ShelleyProtocolHeader proto) era
, Show (CannotForgeError proto)
, Show (SL.TranslationContext era)
, -- Currently the chain select view is identical
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
module Ouroboros.Consensus.Shelley.Ledger.Forge (forgeShelleyBlock) where

import qualified Cardano.Ledger.Core as Core (TopTx, Tx)
import qualified Cardano.Ledger.Core as SL (hashBlockBody, mkBasicBlockBody, txSeqBlockBodyL)
import qualified Cardano.Ledger.Core as SL
( blockBodySize
, hashBlockBody
, mkBasicBlockBody
, txSeqBlockBodyL
)
import qualified Cardano.Ledger.Shelley.API as SL (Block (..), extractTx)
import qualified Cardano.Ledger.Shelley.BlockBody as SL (bBodySize)
import qualified Cardano.Protocol.TPraos.BHeader as SL
import Control.Exception
import qualified Data.Sequence.Strict as Seq
Expand Down Expand Up @@ -80,7 +84,7 @@ forgeShelleyBlock
SL.mkBasicBlockBody
& SL.txSeqBlockBodyL .~ Seq.fromList (fmap extractTx txs)

actualBodySize = SL.bBodySize protocolVersion body
actualBodySize = SL.blockBodySize protocolVersion body

extractTx :: Validated (GenTx (ShelleyBlock proto era)) -> Core.Tx Core.TopTx era
extractTx (ShelleyValidatedTx _txid vtx) = SL.extractTx vtx
Expand Down
Loading
Loading