Skip to content

Commit

Permalink
Account for cardano-ledger changes
Browse files Browse the repository at this point in the history
  * Update `index-state` and affected `cardano-ledger` version bounds:
    `cardano-ledger` requires `plutus-ledger-api ^>=1.26.0`,
    hence the `index-state` update

  * Use `StandardCrypto` in protocol info tests:
    `exampleConwayGenesis` was made monomorphic here:
    IntersectMBO/cardano-ledger#4252
    The `Crypto c` constraint was removed and now it uses
    `StandardCrypto`.

  * Add `plutusV3CostModel` to `Conway` genesis file

  * Update `SupportsTwoPhaseValidation` instance for `Conway`:
    `ConwayUtxowFailure` was fixed to get rid of the possibility
    of injecting `UtxoFailure` in two separate ways
    (as seen in the code removed by this commit)
  • Loading branch information
Lucsanszky committed May 9, 2024
1 parent 98dbae0 commit a2e0047
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 35 deletions.
34 changes: 33 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ index-state:
-- Bump this if you need newer packages from Hackage
, hackage.haskell.org 2024-03-26T06:28:59Z
-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2024-04-05T13:36:27Z
, cardano-haskell-packages 2024-05-08T00:00:00Z

packages:
ouroboros-consensus
Expand All @@ -26,6 +26,38 @@ packages:
sop-extras
strict-sop-core

source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-ledger
tag: 15afd0483d81f281018cf7d42629ed561845bc86
--sha256: sha256-1YX3tq2+poqQULTccLh8oaKRWAlsaimtQVXDAmv1O+U=
subdir: eras/allegra/impl
eras/alonzo/impl
eras/alonzo/test-suite
eras/babbage/impl
eras/babbage/test-suite
eras/conway/impl
eras/conway/test-suite
eras/mary/impl
eras/shelley/impl
eras/shelley/test-suite
eras/shelley-ma/test-suite
libs/cardano-ledger-api
libs/cardano-ledger-core
libs/cardano-ledger-binary
libs/cardano-protocol-tpraos
libs/non-integral
libs/small-steps
libs/cardano-data
libs/set-algebra
libs/vector-map
eras/byron/chain/executable-spec
eras/byron/ledger/executable-spec
eras/byron/ledger/impl
eras/byron/ledger/impl/test
eras/byron/crypto
eras/byron/crypto/test

-- We want to always build the test-suites and benchmarks
tests: true
benchmarks: true
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.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Patch

- Update `SupportsTwoPhaseValidation` instance for `Conway`:
`ConwayUtxowFailure` was changed upstream

### Non-Breaking

- Update ledger packages:
- `cardano-ledger-alonzo`: `^>=1.8`
- `cardano-ledger-babbage`: `^>=1.8`
- `cardano-ledger-conway`: `^>=1.14`
- `cardano-ledger-core`: `^>=1.12`
- `cardano-ledger-mary`: `^>=1.6`
- `cardano-ledger-shelley`: `^>=1.11`

### Breaking

- Add `c ~ StandardCrypto` constraint to:
- `mkSimpleTestProtocolInfo`
- `mkTestProtocolInfo`
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Patch
- A bullet item for the Patch category.
-->
<!--
### Non-Breaking
- A bullet item for the Non-Breaking category.
-->

### Breaking

- Remove `getProposedProtocolVersion` and `defaultGetProposedProtocolVersion`
- Remove `ProtocolUpdate`, `UpdateProposal`, `UpdateState` and `protocolUpdates`
- Add `pparamsUpdate`
- Change `ShelleyLedgerUpdate` by replacing `ShelleyUpdatedProtocolUpdates` with `ShelleyUpdatedPParams`
12 changes: 6 additions & 6 deletions ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ library
cardano-crypto-class,
cardano-crypto-wrapper,
cardano-ledger-allegra ^>=1.4,
cardano-ledger-alonzo ^>=1.7,
cardano-ledger-alonzo ^>=1.8,
cardano-ledger-api ^>=1.9,
cardano-ledger-babbage ^>=1.7,
cardano-ledger-babbage ^>=1.8,
cardano-ledger-binary ^>=1.3,
cardano-ledger-byron ^>=1.0,
cardano-ledger-conway ^>=1.13,
cardano-ledger-core ^>=1.11,
cardano-ledger-mary ^>=1.5,
cardano-ledger-shelley ^>=1.10,
cardano-ledger-conway ^>=1.14,
cardano-ledger-core ^>=1.12,
cardano-ledger-mary ^>=1.6,
cardano-ledger-shelley ^>=1.11,
cardano-prelude,
cardano-protocol-tpraos ^>=1.2,
cardano-slotting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,30 +353,13 @@ instance SupportsTwoPhaseValidation (BabbageEra c) where
instance SupportsTwoPhaseValidation (ConwayEra c) where
isIncorrectClaimedFlag _ = \case
SL.ConwayUtxowFailure
( Babbage.AlonzoInBabbageUtxowPredFailure
( Alonzo.ShelleyInAlonzoUtxowPredFailure
( SL.UtxoFailure
( Babbage.AlonzoInBabbageUtxoPredFailure
( Alonzo.UtxosFailure
( Conway.ValidationTagMismatch
(Alonzo.IsValid _claimedFlag)
_validationErrs
)
)
)
)
)
) -> True
SL.ConwayUtxowFailure
( Babbage.UtxoFailure
( Babbage.AlonzoInBabbageUtxoPredFailure
( Alonzo.UtxosFailure
( Conway.UtxoFailure
( Conway.UtxosFailure
( Conway.ValidationTagMismatch
(Alonzo.IsValid _claimedFlag)
_validationErrs
)
)
)
) -> True
_ -> False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ instance
protocolLedgerView _cfg = SL.currentLedgerView . tickedShelleyLedgerState

-- Extra context available in
-- https://github.com/IntersectMBO/ouroboros-network/blob/master/ouroboros-consensus/docs/HardWonWisdom.md#why-doesnt-ledger-code-ever-return-pasthorizonexception
-- https://github.com/IntersectMBO/ouroboros-consensus/blob/main/docs/website/contents/for-developers/HardWonWisdom.md#why-doesnt-ledger-code-ever-return-pasthorizonexception
ledgerViewForecastAt cfg ledgerState = Forecast at $ \for ->
if
| NotOrigin for == at ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}

-- | Utility functions to elaborate a Cardano 'ProtocolInfo' from certain parameters.
module Test.Consensus.Cardano.ProtocolInfo (
Expand All @@ -23,6 +24,7 @@ module Test.Consensus.Cardano.ProtocolInfo (

import qualified Cardano.Chain.Genesis as CC.Genesis
import qualified Cardano.Chain.Update as CC.Update
import Cardano.Ledger.Api.Era (StandardCrypto)
import qualified Cardano.Ledger.Api.Transition as L
import qualified Cardano.Ledger.BaseTypes as SL
import qualified Cardano.Protocol.TPraos.OCert as SL
Expand Down Expand Up @@ -177,7 +179,7 @@ hardForkInto Conway =
--
mkSimpleTestProtocolInfo ::
forall c
. CardanoHardForkConstraints c
. (CardanoHardForkConstraints c, c ~ StandardCrypto)
=> Shelley.DecentralizationParam
-- ^ Network decentralization parameter.
-> SecurityParam
Expand Down Expand Up @@ -244,7 +246,7 @@ mkSimpleTestProtocolInfo
--
mkTestProtocolInfo ::
forall m c
. (CardanoHardForkConstraints c, IOLike m)
. (CardanoHardForkConstraints c, IOLike m, c ~ StandardCrypto)
=> (CoreNodeId, Shelley.CoreNode c)
-- ^ Id of the node for which the protocol info will be elaborated.
-> ShelleyGenesis c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}

module Test.ThreadNet.Cardano (tests) where

Expand Down Expand Up @@ -47,7 +48,6 @@ import Ouroboros.Consensus.Protocol.Praos.Translate ()
import Ouroboros.Consensus.Shelley.Ledger.SupportsProtocol ()
import Ouroboros.Consensus.Shelley.Node
import Ouroboros.Consensus.Util.IOLike (IOLike)
import Test.Consensus.Cardano.MockCrypto (MockCryptoCompatByron)
import Test.Consensus.Cardano.ProtocolInfo (HardForkSpec (..),
mkTestProtocolInfo)
import Test.QuickCheck
Expand All @@ -73,7 +73,7 @@ import Test.Util.TestEnv

-- | Use 'MockCryptoCompatByron' so that bootstrap addresses and
-- bootstrap witnesses are supported.
type Crypto = MockCryptoCompatByron
type Crypto = StandardCrypto

-- | The varying data of this test
--
Expand Down Expand Up @@ -428,7 +428,7 @@ prop_simple_cardano_convergence TestSetup
property $ maxRollbacks setupK >= finalIntersectionDepth

mkProtocolCardanoAndHardForkTxs ::
forall c m. (IOLike m, CardanoHardForkConstraints c)
forall c m. (IOLike m, c ~ StandardCrypto)
-- Byron
=> PBftParams
-> CoreNodeId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dRepDeposit": 0,
"dRepActivity": 0,
"minFeeRefScriptCostPerByte": 0,
"plutusV3CostModel": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"constitution": {
"anchor": {
"url": "",
Expand Down

0 comments on commit a2e0047

Please sign in to comment.