Skip to content

Commit

Permalink
Rename SupportsSegWit -> EraSegWits
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Jul 25, 2022
1 parent 859c6ec commit a2f8af0
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 47 deletions.
4 changes: 2 additions & 2 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Bbody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bbodyTransition ::
-- Conditions to define the rule in this Era
HasField "_d" (PParams era) UnitInterval,
HasField "_maxBlockExUnits" (PParams era) ExUnits,
SupportsSegWit era,
EraSegWits era,
AlonzoEraWitnesses era,
Era.TxSeq era ~ AlonzoTxSeq era,
Tx era ~ AlonzoTx era
Expand Down Expand Up @@ -204,7 +204,7 @@ instance
HasField "_maxBlockExUnits" (PParams era) ExUnits,
Era.TxSeq era ~ AlonzoTxSeq era,
Tx era ~ AlonzoTx era,
SupportsSegWit era
EraSegWits era
) =>
STS (AlonzoBBODY era)
where
Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxSeq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ data AlonzoTxSeq era = TxSeq'
}
deriving (Generic)

instance CC.Crypto c => SupportsSegWit (AlonzoEra c) where
instance CC.Crypto c => EraSegWits (AlonzoEra c) where
type TxSeq (AlonzoEra c) = AlonzoTxSeq (AlonzoEra c)
fromTxSeq = txSeqTxns
toTxSeq = AlonzoTxSeq
Expand Down
2 changes: 1 addition & 1 deletion eras/babbage/impl/src/Cardano/Ledger/Babbage/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ instance CC.Crypto c => AlonzoEraWitnesses (BabbageEra c) where
datsWitsL = datsAlonzoWitsL
rdmrsWitsL = rdmrsAlonzoWitsL

instance CC.Crypto c => SupportsSegWit (BabbageEra c) where
instance CC.Crypto c => EraSegWits (BabbageEra c) where
type TxSeq (BabbageEra c) = AlonzoTxSeq (BabbageEra c)
fromTxSeq = txSeqTxns
toTxSeq = AlonzoTxSeq
Expand Down
4 changes: 2 additions & 2 deletions eras/shelley-ma/impl/src/Cardano/Ledger/ShelleyMA.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Cardano.Ledger.ShelleyMA
)
where

import Cardano.Ledger.Core (SupportsSegWit (..))
import Cardano.Ledger.Core (EraSegWits (..))
import Cardano.Ledger.Shelley.BlockChain (ShelleyTxSeq (..))
import qualified Cardano.Ledger.Shelley.BlockChain as Shelley
( bbHash,
Expand All @@ -49,7 +49,7 @@ import Cardano.Ledger.ShelleyMA.TxBody (MATxBody, TxBody)

-- Uses the default instance of hashScript

instance MAClass ma crypto => SupportsSegWit (ShelleyMAEra ma crypto) where
instance MAClass ma crypto => EraSegWits (ShelleyMAEra ma crypto) where
type TxSeq (ShelleyMAEra ma crypto) = ShelleyTxSeq (ShelleyMAEra ma crypto)
fromTxSeq = Shelley.txSeqTxns
toTxSeq = ShelleyTxSeq
Expand Down
2 changes: 1 addition & 1 deletion eras/shelley/impl/src/Cardano/Ledger/Shelley/BlockChain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ data ShelleyTxSeq era = TxSeq'
}
deriving (Generic)

instance CC.Crypto c => SupportsSegWit (ShelleyEra c) where
instance CC.Crypto c => EraSegWits (ShelleyEra c) where
type TxSeq (ShelleyEra c) = ShelleyTxSeq (ShelleyEra c)
fromTxSeq = txSeqTxns
toTxSeq = ShelleyTxSeq
Expand Down
4 changes: 2 additions & 2 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Bbody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ instance
NoThunks (BbodyPredicateFailure era)

instance
( SupportsSegWit era,
( EraSegWits era,
DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody),
Embed (EraRule "LEDGERS" era) (BBODY era),
Environment (EraRule "LEDGERS" era) ~ LedgersEnv era,
Expand Down Expand Up @@ -128,7 +128,7 @@ instance
bbodyTransition ::
forall era.
( STS (BBODY era),
SupportsSegWit era,
EraSegWits era,
Embed (EraRule "LEDGERS" era) (BBODY era),
Environment (EraRule "LEDGERS" era) ~ LedgersEnv era,
State (EraRule "LEDGERS" era) ~ LedgerState era,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type ShelleyBasedEra' era =
defaultShelleyLedgerExamples ::
forall era.
( ShelleyBasedEra' era,
SupportsSegWit era,
EraSegWits era,
PredicateFailure (Core.EraRule "DELEGS" era) ~ DelegsPredicateFailure era,
PredicateFailure (Core.EraRule "LEDGER" era) ~ LedgerPredicateFailure era,
Core.PParams era ~ ShelleyPParams era,
Expand Down Expand Up @@ -160,7 +160,7 @@ defaultShelleyLedgerExamples mkWitnesses mkAlonzoTx value txBody auxData transla

exampleShelleyLedgerBlock ::
forall era.
(Core.EraTx era, SupportsSegWit era, ShelleyBasedEra' era) =>
(Core.EraTx era, EraSegWits era, ShelleyBasedEra' era) =>
Core.Tx era ->
Block (BHeader (Era.Crypto era)) era
exampleShelleyLedgerBlock tx = Block blockHeader blockBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ mkBlockHeader prev pkeys s blockNo enonce kesPeriod c0 oCert bodySize bodyHash =

mkBlock ::
forall era r.
(SupportsSegWit era, Mock (Crypto era)) =>
(EraSegWits era, Mock (Crypto era)) =>
-- | Hash of previous block
HashHeader (Crypto era) ->
-- | All keys in the stake pool
Expand Down Expand Up @@ -564,7 +564,7 @@ mkBlock prev pkeys txns s blockNo enonce kesPeriod c0 oCert =
-- | Create a block with a faked VRF result.
mkBlockFakeVRF ::
forall era r.
(SupportsSegWit era, ExMock (Crypto era)) =>
(EraSegWits era, ExMock (Crypto era)) =>
-- | Hash of previous block
HashHeader (Crypto era) ->
-- | All keys in the stake pool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class Show (TxOut era) => MinGenTxout era where
-- ======================================================================================

class
( SupportsSegWit era,
( EraSegWits era,
ShelleyEraTxBody era,
Split (Value era),
ScriptClass era,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ import Test.QuickCheck (Gen)
-- with meaningful delegation certificates, protocol and application updates, withdrawals etc.
instance
( EraGen era,
Core.SupportsSegWit era,
Core.EraSegWits era,
Mock (Crypto era),
ApplyBlock era,
GetLedgerView era,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Cardano.Binary
annotatorSlice,
)
import Cardano.Ledger.Block (Block (..))
import Cardano.Ledger.Core (Era, EraTx, SupportsSegWit (TxSeq))
import Cardano.Ledger.Core (Era, EraTx, EraSegWits (TxSeq))
import Cardano.Ledger.Serialization (decodeRecordNamed)
import Cardano.Ledger.Shelley.BlockChain (ShelleyTxSeq, txSeqDecoder)
import Data.Typeable (Typeable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ relevantCasesAreCovered = do
relevantCasesAreCoveredForTrace ::
forall era.
( ChainProperty era,
SupportsSegWit era,
EraSegWits era,
ShelleyEraTxBody era
) =>
Trace (CHAIN era) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ stakeIncrTest =

incrStakeComp ::
forall era ledger.
(SupportsSegWit era, ChainProperty era, TestingLedger era ledger) =>
(EraSegWits era, ChainProperty era, TestingLedger era ledger) =>
SourceSignalTarget (CHAIN era) ->
Property
incrStakeComp SourceSignalTarget {source = chainSt, signal = block} =
Expand Down Expand Up @@ -312,7 +312,7 @@ adaPreservationChain =
-- ADA should be preserved for all state transitions in the generated trace
checkPreservation ::
forall era.
( SupportsSegWit era,
( EraSegWits era,
ShelleyEraTxBody era,
HasField "_protocolVersion" (PParams era) ProtVer,
HasField "_keyDeposit" (PParams era) Coin,
Expand Down Expand Up @@ -539,7 +539,7 @@ potsSumIncreaseWdrlsPerTx SourceSignalTarget {source = chainSt, signal = block}
potsSumIncreaseByRewardsPerTx ::
forall era ledger.
( ChainProperty era,
SupportsSegWit era,
EraSegWits era,
TestingLedger era ledger
) =>
SourceSignalTarget (CHAIN era) ->
Expand Down Expand Up @@ -648,7 +648,7 @@ preserveBalanceRestricted ::
( ChainProperty era,
TestingLedger era ledger,
ShelleyEraTxBody era,
SupportsSegWit era,
EraSegWits era,
HasField "_keyDeposit" (PParams era) Coin,
HasField "_poolDeposit" (PParams era) Coin
) =>
Expand Down Expand Up @@ -710,7 +710,7 @@ preserveOutputsTx SourceSignalTarget {source = chainSt, signal = block} =
canRestrictUTxO ::
forall era ledger.
( ChainProperty era,
SupportsSegWit era,
EraSegWits era,
TestingLedger era ledger
) =>
SourceSignalTarget (CHAIN era) ->
Expand Down Expand Up @@ -931,7 +931,7 @@ poolProperties =
-- retirement.
poolRetirement ::
( ChainProperty era,
SupportsSegWit era,
EraSegWits era,
ShelleyEraTxBody era,
HasField "_eMax" (PParams era) EpochNo,
HasField "_minPoolCost" (PParams era) Coin
Expand All @@ -951,7 +951,7 @@ poolRetirement SourceSignalTarget {source = chainSt, signal = block} =
-- in the retiring map.
poolRegistration ::
( ChainProperty era,
SupportsSegWit era,
EraSegWits era,
ShelleyEraTxBody era,
HasField "_eMax" (PParams era) EpochNo,
HasField "_minPoolCost" (PParams era) Coin
Expand All @@ -968,7 +968,7 @@ poolRegistration (SourceSignalTarget {source = chainSt, signal = block}) =
-- POOL` transition.
poolStateIsInternallyConsistent ::
( ChainProperty era,
SupportsSegWit era,
EraSegWits era,
ShelleyEraTxBody era,
HasField "_eMax" (PParams era) EpochNo,
HasField "_minPoolCost" (PParams era) Coin
Expand Down Expand Up @@ -1025,7 +1025,7 @@ delegProperties =
ledgerTraceFromBlock ::
forall era ledger.
( ChainProperty era,
SupportsSegWit era,
EraSegWits era,
TestingLedger era ledger
) =>
ChainState era ->
Expand All @@ -1045,7 +1045,7 @@ ledgerTraceFromBlock chainSt block =
ledgerTraceFromBlockWithRestrictedUTxO ::
forall era ledger.
( ChainProperty era,
SupportsSegWit era,
EraSegWits era,
TestingLedger era ledger
) =>
ChainState era ->
Expand All @@ -1069,7 +1069,7 @@ poolTraceFromBlock ::
forall era.
( ChainProperty era,
ShelleyEraTxBody era,
SupportsSegWit era,
EraSegWits era,
HasField "_eMax" (PParams era) EpochNo,
HasField "_minPoolCost" (PParams era) Coin
) =>
Expand Down Expand Up @@ -1099,7 +1099,7 @@ delegTraceFromBlock ::
forall era.
( ChainProperty era,
ShelleyEraTxBody era,
SupportsSegWit era
EraSegWits era
) =>
ChainState era ->
Block (BHeader (Crypto era)) era ->
Expand Down Expand Up @@ -1132,7 +1132,7 @@ delegTraceFromBlock chainSt block =
-- transactions with the LEDGERS rule)
ledgerTraceBase ::
forall era.
( SupportsSegWit era,
( EraSegWits era,
GetLedgerView era,
ApplyBlock era
) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import Cardano.Ledger.BaseTypes
textToUrl,
)
import Cardano.Ledger.Coin (CompactForm (..), DeltaCoin (..))
import Cardano.Ledger.Core (Crypto, Era, EraScript (..), SupportsSegWit (..))
import Cardano.Ledger.Core (Crypto, Era, EraScript (..), EraSegWits (..))
import qualified Cardano.Ledger.Core as Core
import Cardano.Ledger.Crypto (DSIGN)
import qualified Cardano.Ledger.Crypto as CC (Crypto)
Expand Down Expand Up @@ -831,7 +831,7 @@ genTx =

genBlock ::
forall era h.
( SupportsSegWit era,
( EraSegWits era,
Mock (Crypto era),
Arbitrary (Core.Tx era),
h ~ BHeader (Crypto era)
Expand All @@ -850,7 +850,7 @@ genBlock = Block <$> arbitrary <*> (toTxSeq @era <$> arbitrary)
genCoherentBlock ::
forall era h.
( Mock (Crypto era),
SupportsSegWit era,
EraSegWits era,
Arbitrary (Core.Tx era),
h ~ BHeader (Crypto era)
) =>
Expand Down Expand Up @@ -894,7 +894,7 @@ instance
instance
( Core.EraTxBody era,
ToCBORGroup (TxSeq era),
SupportsSegWit era,
EraSegWits era,
Mock (Crypto era),
Arbitrary (Core.Tx era),
h ~ BHeader (Crypto era)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ blockEx1 ::
forall era.
( HasCallStack,
ShelleyTest era,
SupportsSegWit era,
EraSegWits era,
ExMock (Crypto era)
) =>
Block (BHeader (Crypto era)) era
Expand All @@ -76,7 +76,7 @@ blockNonce ::
( HasCallStack,
PreAlonzo era,
ShelleyTest era,
SupportsSegWit era,
EraSegWits era,
ExMock (Crypto era)
) =>
Nonce
Expand All @@ -85,7 +85,7 @@ blockNonce = getBlockNonce (blockEx1 @era)
expectedStEx1 ::
forall era.
( ShelleyTest era,
SupportsSegWit era,
EraSegWits era,
ExMock (Crypto era),
PreAlonzo era,
PParams era ~ ShelleyPParams era
Expand All @@ -104,7 +104,7 @@ exEmptyBlock ::
( ShelleyTest era,
ExMock (Crypto era),
PreAlonzo era,
SupportsSegWit era,
EraSegWits era,
PParams era ~ ShelleyPParams era
) =>
CHAINExample (BHeader (Crypto era)) era
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type TwoPoolsConstraints era =
Core.Tx era ~ ShelleyTx era,
Core.PParams era ~ ShelleyPParams era,
PreAlonzo era,
Core.SupportsSegWit era,
Core.EraSegWits era,
ToCBOR (Core.Script era)
)

Expand Down
4 changes: 2 additions & 2 deletions libs/cardano-ledger-core/src/Cardano/Ledger/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ instance (EraTx era, Typeable h) => ToCBOR (Block h era) where

instance
forall h era.
( SupportsSegWit era,
( EraSegWits era,
FromCBOR (Annotator h),
Typeable h
) =>
Expand Down Expand Up @@ -151,7 +151,7 @@ bbody (Block' _ txs _) = txs
-- and present only those to the ledger.
neededTxInsForBlock ::
forall h era.
SupportsSegWit era =>
EraSegWits era =>
Block h era ->
Set (TxIn (Crypto era))
neededTxInsForBlock (Block' _ txsSeq _) = Set.filter isNotNewInput allTxIns
Expand Down
4 changes: 2 additions & 2 deletions libs/cardano-ledger-core/src/Cardano/Ledger/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module Cardano.Ledger.Core
translateEra',
translateEraMaybe,
-- $segWit
SupportsSegWit (..),
EraSegWits (..),

-- * Protocol version constraints
ProtVerAtLeast,
Expand Down Expand Up @@ -410,7 +410,7 @@ class
ToCBORGroup (TxSeq era),
FromCBOR (Annotator (TxSeq era))
) =>
SupportsSegWit era
EraSegWits era
where
type TxSeq era = (r :: Type) | r -> era

Expand Down
2 changes: 1 addition & 1 deletion libs/cardano-ledger-core/src/Cardano/Ledger/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Cardano.Ledger.Era
translateEra',
translateEraMaybe,
-- $segWit
SupportsSegWit (..),
EraSegWits (..),
)
where

Expand Down
Loading

0 comments on commit a2f8af0

Please sign in to comment.