Skip to content

Commit

Permalink
Minor clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Nov 28, 2023
1 parent f4f19a3 commit 72cbddf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions cardano-api/gen/Test/Gen/Cardano/Api/Byron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module Test.Gen.Cardano.Api.Byron

import Cardano.Api hiding (txIns)
import Cardano.Api.Byron
import qualified Cardano.Api.Byron as Byron

import Data.Proxy

Expand All @@ -22,7 +21,7 @@ import Test.Tasty.Hedgehog
prop_byron_roundtrip_txbody_CBOR :: Property
prop_byron_roundtrip_txbody_CBOR = property $ do
x <- forAll $ makeSignedByronTransaction [] <$> genTxBodyByron
tripping x Byron.serializeByronTx deserialiseByronTxCddl
tripping x serializeByronTx deserialiseByronTxCddl

prop_byron_roundtrip_witness_CBOR :: Property
prop_byron_roundtrip_witness_CBOR = property $ do
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/internal/Cardano/Api/Eras.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Cardano.Api.Eras

-- * Era case handling

-- ** Case on CardanoEra
-- ** Case on CardanoEra
, caseByronOrShelleyBasedEra

-- ** Case on ShelleyBasedEra
Expand Down
8 changes: 5 additions & 3 deletions cardano-api/internal/Cardano/Api/Eras/Case.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
Expand Down Expand Up @@ -37,14 +36,17 @@ import Cardano.Api.Eon.ShelleyToBabbageEra
import Cardano.Api.Eon.ShelleyToMaryEra
import Cardano.Api.Eras.Core

-- | @caseByronOrShelleyBasedEra f g era@ applies @f@ to byron and @g@ to other eras.
-- | @caseByronOrShelleyBasedEra f g era@ returns @f@ in Byron and applies @g@ to Shelley-based eras.
caseByronOrShelleyBasedEra :: ()
=> a
-> (ShelleyBasedEraConstraints era => ShelleyBasedEra era -> a)
-> CardanoEra era
-> a
caseByronOrShelleyBasedEra l r = \case
ByronEra -> l
ByronEra -> l -- We no longer provide the witness because Byron is isolated.
-- This function will be deleted shortly after build-raw --byron-era is
-- deprecated in cardano-cli

ShelleyEra -> r ShelleyBasedEraShelley
AllegraEra -> r ShelleyBasedEraAllegra
MaryEra -> r ShelleyBasedEraMary
Expand Down
6 changes: 2 additions & 4 deletions cardano-api/internal/Cardano/Api/InMode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ import GHC.Generics
-- LocalTxSubmission protocol.
--
data TxInMode where
-- | Shelley based transations.
-- | Shelley based transactions.
--
TxInMode
:: ShelleyBasedEra era
-> Tx era
-> TxInMode

-- | Legacy Byron transactions. Byron has various things we can
-- | Legacy Byron transactions and things we can
-- post to the chain which are not actually transactions.
-- This covers: update proposals, votes and delegation certs.
--
Expand Down Expand Up @@ -105,8 +105,6 @@ fromConsensusGenTx = \case
in TxInMode ShelleyBasedEraConway (ShelleyTx ShelleyBasedEraConway shelleyEraTx)


-- mkByronTx = Consensus.ByronTx (Consensus.byronIdTx tx) tx

toConsensusGenTx :: ()
=> Consensus.CardanoBlock L.StandardCrypto ~ block
=> TxInMode
Expand Down

0 comments on commit 72cbddf

Please sign in to comment.