Skip to content
Merged
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
2 changes: 1 addition & 1 deletion eras/allegra/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Make `Test.Cardano.Ledger.Allegra.Imp.spec` accept `Proxy era`
* In `Test.Cardano.Ledger.Allegra.Examples`:
- Remove `mkAllegraBasedExampleTx`, `exampleAllegraBasedTxBody`, `exampleAllegraBasedShelleyTxBody`
- Add `exampleAllegraBasedTx`
- Add `exampleAllegraBasedTx`, `exampleAllegraTx`

## 1.9.0.0

Expand Down
5 changes: 4 additions & 1 deletion eras/allegra/impl/cardano-ledger-allegra.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ description:

category: Network
build-type: Simple
data-files: cddl/data/allegra.cddl
data-files:
cddl/data/allegra.cddl
golden/*.cbor

extra-source-files: CHANGELOG.md

source-repository head
Expand Down
Binary file added eras/allegra/impl/golden/tx.cbor
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import Cardano.Ledger.Allegra.Core
import Cardano.Ledger.Allegra.Scripts
import Cardano.Ledger.MemoBytes (EqRaw)
import Cardano.Ledger.Plutus (emptyCostModels)
import Paths_cardano_ledger_allegra (getDataFileName)
import Test.Cardano.Ledger.Allegra.Arbitrary ()
import Test.Cardano.Ledger.Allegra.Binary.Annotator ()
import Test.Cardano.Ledger.Allegra.Examples (exampleAllegraTx)
import Test.Cardano.Ledger.Allegra.TreeDiff ()
import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Shelley.Era
Expand All @@ -37,6 +39,10 @@ instance EraTest AllegraEra where

accountsFromAccountsMap = shelleyAccountsFromAccountsMap

mkEraFullPath = getDataFileName

exampleTx = exampleAllegraTx

instance ShelleyEraTest AllegraEra

instance AllegraEraTest AllegraEra
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-- don't care, we are only interested in serialisation, not validation.
module Test.Cardano.Ledger.Allegra.Examples (
ledgerExamples,
exampleAllegraTx,
exampleAllegraBasedTx,
) where

Expand Down Expand Up @@ -44,14 +45,14 @@ ledgerExamples =
exampleCoin
exampleAllegraTx
NoGenesis
where
exampleAllegraTx :: Tx TopTx AllegraEra
exampleAllegraTx =
exampleAllegraBasedTx
& addShelleyBasedTopTxExampleFee
& addShelleyToBabbageExampleProposedPUpdates
& addShelleyToBabbageTxCerts
& addShelleyToConwayTxCerts

exampleAllegraTx :: Tx TopTx AllegraEra
exampleAllegraTx =
exampleAllegraBasedTx
& addShelleyBasedTopTxExampleFee
& addShelleyToBabbageExampleProposedPUpdates
& addShelleyToBabbageTxCerts
& addShelleyToConwayTxCerts

-- Complete transaction which is compatible with any era starting with Allegra.
-- This transaction forms the basis on which future era transactions will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Test.Cardano.Ledger.Allegra.Imp (spec) where

Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* `TranslationInstance` has a new field `tiPlutusPurpose`
* In `Test.Cardano.Ledger.Alonzo.Examples`:
- Remove `mkAlonzoBasedExampleTx`, `exampleAlonzoBasedShelleyTxBody`, `exampleAlonzoBasedTxBody`, `exampleRedeemer`
- Add `exampleAlonzoBasedTopTx`, `exampleAlonzoBasedTopTx`, `addAlonzoToConwayExampleReqSigners`
- Add `exampleAlonzoTx`, `exampleAlonzoBasedTopTx`, `exampleAlonzoBasedTopTx`, `addAlonzoToConwayExampleReqSigners`

## 1.15.0.0

Expand Down
4 changes: 2 additions & 2 deletions eras/alonzo/impl/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import qualified Test.Cardano.Ledger.Alonzo.Binary.CddlSpec as CddlSpec
import qualified Test.Cardano.Ledger.Alonzo.Binary.CostModelsSpec as CostModelsSpec
import qualified Test.Cardano.Ledger.Alonzo.Binary.TxWitsSpec as TxWitsSpec
import qualified Test.Cardano.Ledger.Alonzo.BinarySpec as BinarySpec
import qualified Test.Cardano.Ledger.Alonzo.GoldenSpec as Golden
import qualified Test.Cardano.Ledger.Alonzo.GoldenSpec as GoldenSpec
import qualified Test.Cardano.Ledger.Alonzo.GoldenTranslation as GoldenTranslation
import qualified Test.Cardano.Ledger.Alonzo.Imp as Imp
import qualified Test.Cardano.Ledger.Alonzo.Imp.TxInfoSpec as TxInfo
Expand All @@ -35,7 +35,7 @@ main =
roundTripJsonEraSpec @AlonzoEra
roundTripJsonShelleyEraSpec @AlonzoEra
GoldenTranslation.tests
Golden.spec
GoldenSpec.spec
describe "CostModels" $ do
CostModelsSpec.spec @AlonzoEra
describe "TxWits" $ do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Cardano.Ledger.Core
import Cardano.Ledger.MemoBytes (zipMemoRawType)
import Cardano.Ledger.Plutus.Data (BinaryData, Data (..))
import Test.Cardano.Ledger.Alonzo.Arbitrary ()
import qualified Test.Cardano.Ledger.Alonzo.Binary.Golden as Golden
import Test.Cardano.Ledger.Alonzo.Binary.RoundTrip (roundTripAlonzoCommonSpec)
import Test.Cardano.Ledger.Alonzo.Binary.Twiddle ()
import Test.Cardano.Ledger.Alonzo.TreeDiff ()
Expand Down Expand Up @@ -43,4 +42,3 @@ spec = do
decoderEquivalenceEraSpec @AlonzoEra @(TxDats AlonzoEra)
decoderEquivalenceEraSpec @AlonzoEra @(Redeemers AlonzoEra)
Binary.txSizeSpec @AlonzoEra
Golden.spec @AlonzoEra
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module Test.Cardano.Ledger.Alonzo.GoldenSpec (spec) where

import Cardano.Ledger.Alonzo
import Paths_cardano_ledger_alonzo (getDataFileName)
import qualified Test.Cardano.Ledger.Alonzo.Binary.Golden as Golden
import Test.Cardano.Ledger.Alonzo.Era ()
import qualified Test.Cardano.Ledger.Alonzo.Binary.Golden as GoldenBinary
import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Core.JSON (goldenJsonPParamsSpec, goldenJsonPParamsUpdateSpec)

Expand All @@ -18,4 +17,5 @@ spec =
goldenJsonPParamsSpec @AlonzoEra
beforeAll (getDataFileName "golden/pparams-update.json") $
goldenJsonPParamsUpdateSpec @AlonzoEra
describe "CBOR" $ Golden.spec @AlonzoEra
describe "CBOR" $ do
GoldenBinary.spec @AlonzoEra
6 changes: 6 additions & 0 deletions eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import Cardano.Ledger.Alonzo.Plutus.Context
import Cardano.Ledger.Alonzo.UTxO
import Cardano.Ledger.Plutus (Language (..))
import Data.TreeDiff
import Paths_cardano_ledger_alonzo (getDataFileName)
import Test.Cardano.Ledger.Alonzo.Arbitrary ()
import Test.Cardano.Ledger.Alonzo.Binary.Annotator ()
import Test.Cardano.Ledger.Alonzo.Examples (exampleAlonzoTx)
import Test.Cardano.Ledger.Alonzo.TreeDiff ()
import Test.Cardano.Ledger.Common (Arbitrary)
import Test.Cardano.Ledger.Mary.Era
Expand Down Expand Up @@ -45,6 +47,10 @@ instance EraTest AlonzoEra where

accountsFromAccountsMap = shelleyAccountsFromAccountsMap

mkEraFullPath = getDataFileName

exampleTx = exampleAlonzoTx

instance ShelleyEraTest AlonzoEra

instance AllegraEraTest AlonzoEra
Expand Down
19 changes: 10 additions & 9 deletions eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Examples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
module Test.Cardano.Ledger.Alonzo.Examples (
ledgerExamples,
mkAlonzoBasedLedgerExamples,
exampleAlonzoTx,
exampleAlonzoBasedTx,
exampleAlonzoBasedTopTx,
addAlonzoToConwayExampleReqSigners,
Expand Down Expand Up @@ -86,15 +87,6 @@ ledgerExamples =
exampleAlonzoTx
exampleAlonzoGenesis
where
exampleAlonzoTx :: Tx TopTx AlonzoEra
exampleAlonzoTx =
exampleAlonzoBasedTopTx
& addShelleyBasedTopTxExampleFee
& addShelleyToBabbageExampleProposedPUpdates
& addShelleyToBabbageTxCerts
& addShelleyToConwayTxCerts
& addAlonzoToConwayExampleReqSigners

exampleAlonzoGenesis =
AlonzoGenesis
{ agCoinsPerUTxOWord = CoinPerWord $ Coin 1
Expand All @@ -108,6 +100,15 @@ ledgerExamples =
, agExtraConfig = Nothing
}

exampleAlonzoTx :: Tx TopTx AlonzoEra
exampleAlonzoTx =
exampleAlonzoBasedTopTx
& addShelleyBasedTopTxExampleFee
& addShelleyToBabbageExampleProposedPUpdates
& addShelleyToBabbageTxCerts
& addShelleyToConwayTxCerts
& addAlonzoToConwayExampleReqSigners

mkAlonzoBasedLedgerExamples ::
forall era.
AlonzoEraPParams era =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import Test.Cardano.Ledger.Mary.Golden (
import Test.Cardano.Ledger.Plutus (zeroTestingCostModels)
import Test.Cardano.Ledger.Shelley.Examples.Cast (aliceAddr, bobAddr, carlAddr)
import Test.Cardano.Protocol.TPraos.Examples (
LedgerExamples (..),
ProtocolLedgerExamples (..),
ledgerExamplesAlonzo,
)
Expand Down Expand Up @@ -187,11 +186,6 @@ goldenCborSerialization =
"golden/block.cbor"
(eraProtVerLow @AlonzoEra)
(pleBlock ledgerExamplesAlonzo)
cborAnnGoldenSpec
Comment thread
koslambrou marked this conversation as resolved.
getDataFileName
"golden/tx.cbor"
(eraProtVerLow @AlonzoEra)
(leTx $ pleLedgerExamples ledgerExamplesAlonzo)

goldenJsonSerialization :: Spec
goldenJsonSerialization =
Expand Down
2 changes: 1 addition & 1 deletion eras/babbage/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Add `Test.Cardano.Ledger.Babbage.Imp.PoolSpec` module with `babbageEraSpecificSpec`
* In `Test.Cardano.Ledger.Babbage.Examples`:
- Remove `mkBabbageBasedExampleTx`, `exampleBabbageBasedTxBody`
- Add `exampleBabbageBasedTx`, `exampleBabbageBasedTopTx`
- Add `exampleBabbageBasedTx`, `exampleBabbageBasedTopTx`, `exampleBabbageTx`

## 1.13.0.0

Expand Down
2 changes: 2 additions & 0 deletions eras/babbage/impl/cardano-ledger-babbage.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ library testlib
Test.Cardano.Ledger.Babbage.Arbitrary
Test.Cardano.Ledger.Babbage.Binary.Annotator
Test.Cardano.Ledger.Babbage.Binary.Cddl
Test.Cardano.Ledger.Babbage.Binary.Golden
Test.Cardano.Ledger.Babbage.Binary.Twiddle
Test.Cardano.Ledger.Babbage.Era
Test.Cardano.Ledger.Babbage.Examples
Expand Down Expand Up @@ -205,6 +206,7 @@ library testlib
cardano-slotting,
cardano-strict-containers,
containers,
data-default,
generic-random,
microlens,
microlens-ghc,
Expand Down
Binary file added eras/babbage/impl/golden/tx.cbor
Binary file not shown.
4 changes: 2 additions & 2 deletions eras/babbage/impl/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import qualified Test.Cardano.Ledger.Alonzo.Binary.TxWitsSpec as TxWitsSpec
import qualified Test.Cardano.Ledger.Alonzo.Imp as Alonzo
import qualified Test.Cardano.Ledger.Babbage.Binary.CddlSpec as CddlSpec
import qualified Test.Cardano.Ledger.Babbage.BinarySpec as BinarySpec
import qualified Test.Cardano.Ledger.Babbage.GoldenSpec as Golden
import qualified Test.Cardano.Ledger.Babbage.GoldenSpec as GoldenSpec
import qualified Test.Cardano.Ledger.Babbage.GoldenTranslation as GoldenTranslation
import qualified Test.Cardano.Ledger.Babbage.Imp as Imp
import Test.Cardano.Ledger.Babbage.ImpTest ()
Expand All @@ -32,7 +32,7 @@ main =
ledgerEraTestMain @BabbageEra $ do
TxInfo.spec @BabbageEra
GoldenTranslation.spec
Golden.spec
GoldenSpec.spec
BinarySpec.spec
CddlSpec.spec
roundTripJsonEraSpec @BabbageEra
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Test.Cardano.Ledger.Babbage.GoldenSpec (spec) where

import Cardano.Ledger.Babbage
import Paths_cardano_ledger_babbage (getDataFileName)
import qualified Test.Cardano.Ledger.Alonzo.Binary.Golden as Golden
import qualified Test.Cardano.Ledger.Babbage.Binary.Golden as Golden
import Test.Cardano.Ledger.Babbage.Era ()
import Test.Cardano.Ledger.Common
import Test.Cardano.Ledger.Core.JSON (goldenJsonPParamsSpec, goldenJsonPParamsUpdateSpec)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Test.Cardano.Ledger.Babbage.Binary.Golden (
spec,
module Test.Cardano.Ledger.Alonzo.Binary.Golden,
) where

import Cardano.Ledger.Alonzo.Core (ShelleyEraTxCert)
import Test.Cardano.Ledger.Alonzo.Binary.Golden hiding (spec)
import qualified Test.Cardano.Ledger.Alonzo.Binary.Golden as AlonzoGolden
import Test.Cardano.Ledger.Babbage.Era (BabbageEraTest)
import Test.Cardano.Ledger.Common (Spec)

spec ::
forall era.
( BabbageEraTest era
, ShelleyEraTxCert era
) =>
Spec
spec = do
AlonzoGolden.spec @era
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import Cardano.Ledger.Alonzo.Plutus.Context (EraPlutusTxInfo)
import Cardano.Ledger.Babbage
import Cardano.Ledger.Babbage.Core
import Cardano.Ledger.Plutus (Language (..))
import Paths_cardano_ledger_babbage (getDataFileName)
import Test.Cardano.Ledger.Alonzo.Era
import Test.Cardano.Ledger.Babbage.Arbitrary ()
import Test.Cardano.Ledger.Babbage.Binary.Annotator ()
import Test.Cardano.Ledger.Babbage.Examples (exampleBabbageTx)
import Test.Cardano.Ledger.Babbage.TreeDiff ()
import Test.Cardano.Ledger.Plutus (zeroTestingCostModels)

Expand All @@ -28,10 +30,15 @@ class

instance EraTest BabbageEra where
zeroCostModels = zeroTestingCostModels [PlutusV1 .. PlutusV2]

mkTestAccountState = mkShelleyTestAccountState

accountsFromAccountsMap = shelleyAccountsFromAccountsMap

mkEraFullPath = getDataFileName

exampleTx = exampleBabbageTx

instance ShelleyEraTest BabbageEra

instance AllegraEraTest BabbageEra
Expand Down
35 changes: 23 additions & 12 deletions eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/Examples.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
module Test.Cardano.Ledger.Babbage.Examples (
ledgerExamples,
exampleBabbageNewEpochState,
exampleBabbageTx,
exampleBabbageBasedTx,
exampleBabbageBasedTopTx,
) where
Expand All @@ -26,8 +27,14 @@ import Cardano.Ledger.Plutus.Data (
dataToBinaryData,
)
import Cardano.Ledger.Plutus.Language (Language (..), plutusBinary)
import Cardano.Ledger.Shelley.LedgerState (NewEpochState (..))
import Cardano.Ledger.Shelley.LedgerState (
EraCertState (..),
NewEpochState (..),
StashedAVVMAddresses,
)
import qualified Cardano.Ledger.Shelley.Rules as Shelley
import Cardano.Ledger.State (EraStake)
import Data.Default (Default)
import qualified Data.List.NonEmpty as NE
import qualified Data.Map.Strict as Map
import qualified Data.MapExtras as Map
Expand All @@ -42,7 +49,6 @@ import Test.Cardano.Ledger.Alonzo.Examples (
exampleDatum,
mkAlonzoBasedLedgerExamples,
)
import Test.Cardano.Ledger.Babbage.Era
import Test.Cardano.Ledger.Core.KeyPair (mkAddr)
import Test.Cardano.Ledger.Mary.Examples (exampleMultiAssetValue)
import Test.Cardano.Ledger.Plutus (alwaysSucceedsPlutus)
Expand Down Expand Up @@ -73,19 +79,24 @@ ledgerExamples =
exampleBabbageNewEpochState
exampleBabbageTx
NoGenesis
where
exampleBabbageTx :: Tx TopTx BabbageEra
exampleBabbageTx =
exampleBabbageBasedTopTx
& addShelleyBasedTopTxExampleFee
& addShelleyToBabbageExampleProposedPUpdates
& addShelleyToBabbageTxCerts
& addShelleyToConwayTxCerts
& addAlonzoToConwayExampleReqSigners

exampleBabbageTx :: Tx TopTx BabbageEra
exampleBabbageTx =
exampleBabbageBasedTopTx
& addShelleyBasedTopTxExampleFee
& addShelleyToBabbageExampleProposedPUpdates
& addShelleyToBabbageTxCerts
& addShelleyToConwayTxCerts
& addAlonzoToConwayExampleReqSigners

exampleBabbageNewEpochState ::
( BabbageEraTest era
( BabbageEraPParams era
, Value era ~ MaryValue
, EraTxOut era
, EraGov era
, EraStake era
, EraCertState era
, Default (StashedAVVMAddresses era)
) =>
NewEpochState era
exampleBabbageNewEpochState =
Expand Down
Loading