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
10 changes: 10 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,13 @@ if impl(ghc >=9.14)
, universe-base:base
, universe-base:containers
, uuid-types:template-haskell

source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-base.git
--sha256: sha256-qpShH6TD09thz4Nar6iKsrwWLkzzigVcuOLzxf+ZkDc=
tag: 9a18592565cf15b900329095d699997b763b6bd3
subdir:
cardano-base
cardano-crypto-class
cardano-crypto-praos
11 changes: 9 additions & 2 deletions eras/allegra/impl/src/Cardano/Ledger/Allegra/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ deriving stock instance
) =>
Eq (AllegraUtxoPredFailure era)

deriving stock instance
( Ord (TxOut era)
, Ord (Value era)
, Ord (EraRuleFailure "PPUP" era)
) =>
Ord (AllegraUtxoPredFailure era)

instance
( Era era
, NFData (TxOut era)
Expand Down Expand Up @@ -151,7 +158,7 @@ utxoTransition ::
, EraCertState era
, ShelleyEraTxBody era
, AllegraEraTxBody era
, Eq (EraRuleFailure "PPUP" era)
, Ord (EraRuleFailure "PPUP" era)
, Show (EraRuleFailure "PPUP" era)
, Embed (EraRule "PPUP" era) (EraRule "UTXO" era)
, Environment (EraRule "PPUP" era) ~ Shelley.PpupEnv era
Expand Down Expand Up @@ -291,7 +298,7 @@ instance
, State (EraRule "PPUP" era) ~ ShelleyGovState era
, Signal (EraRule "PPUP" era) ~ StrictMaybe (Update era)
, AtMostEra "Babbage" era
, Eq (EraRuleFailure "PPUP" era)
, Ord (EraRuleFailure "PPUP" era)
, Show (EraRuleFailure "PPUP" era)
, EraRule "UTXO" era ~ AllegraUTXO era
, GovState era ~ ShelleyGovState era
Expand Down
4 changes: 2 additions & 2 deletions eras/allegra/impl/src/Cardano/Ledger/Allegra/Scripts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ data TimelockRaw era
| -- Note that the Int may be negative in which case (TimelockMOf (-2) [..]) is always True
TimelockTimeStart !SlotNo -- The start time
| TimelockTimeExpire !SlotNo -- The time it expires
deriving (Eq, Generic, NFData)
deriving (Eq, Ord, Generic, NFData)

class ShelleyEraScript era => AllegraEraScript era where
mkTimeStart :: SlotNo -> NativeScript era
Expand Down Expand Up @@ -242,7 +242,7 @@ instance Era era => DecCBOR (Annotator (TimelockRaw era)) where
-- =================================================================

newtype Timelock era = MkTimelock (MemoBytes (TimelockRaw era))
deriving (Eq, Generic)
deriving (Eq, Ord, Generic)
deriving newtype (ToCBOR, NFData, SafeToHash)

instance Era era => MemPack (Timelock era) where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ toPlutusTxInfoForPurpose proxy lti sp =

class
( AlonzoEraScript era
, Eq (ContextError era)
, Ord (ContextError era)
, Show (ContextError era)
, NFData (ContextError era)
, EncCBOR (ContextError era)
Expand Down Expand Up @@ -352,6 +352,10 @@ deriving instance
(AlonzoEraScript era, Eq (ContextError era)) =>
Eq (CollectError era)

deriving instance
(AlonzoEraScript era, Ord (ContextError era)) =>
Ord (CollectError era)

deriving instance
(AlonzoEraScript era, Show (ContextError era)) =>
Show (CollectError era)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ instance EraPlutusContext AlonzoEra where
data AlonzoContextError era
= TranslationLogicMissingInput TxIn
| TimeTranslationPastHorizon Text
deriving (Eq, Show, Generic)
deriving (Eq, Ord, Show, Generic)

instance Era era => NFData (AlonzoContextError era)

Expand Down
4 changes: 4 additions & 0 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Bbody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ deriving instance
(Era era, Eq (PredicateFailure (EraRule "LEDGERS" era))) =>
Eq (AlonzoBbodyPredFailure era)

deriving instance
(Era era, Ord (PredicateFailure (EraRule "LEDGERS" era))) =>
Ord (AlonzoBbodyPredFailure era)

instance
(Era era, EncCBOR (PredicateFailure (EraRule "LEDGERS" era))) =>
EncCBOR (AlonzoBbodyPredFailure era)
Expand Down
8 changes: 8 additions & 0 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ deriving stock instance
) =>
Eq (AlonzoUtxoPredFailure era)

deriving stock instance
( Era era
, Ord (Value era)
, Ord (TxOut era)
, Ord (PredicateFailure (EraRule "UTXOS" era))
) =>
Ord (AlonzoUtxoPredFailure era)

instance
( Era era
, NFData (Value era)
Expand Down
22 changes: 15 additions & 7 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxos.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ instance
, Environment (EraRule "PPUP" era) ~ Shelley.PpupEnv era
, Signal (EraRule "PPUP" era) ~ StrictMaybe (Update era)
, EncCBOR (PredicateFailure (EraRule "PPUP" era)) -- Serializing the PredicateFailure,
, Eq (EraRuleFailure "PPUP" era)
, Ord (EraRuleFailure "PPUP" era)
, Show (EraRuleFailure "PPUP" era)
, EraPlutusContext era
, EraCertState era
Expand Down Expand Up @@ -166,7 +166,7 @@ utxosTransition ::
, Signal (EraRule "PPUP" era) ~ StrictMaybe (Update era)
, Embed (EraRule "PPUP" era) (AlonzoUTXOS era)
, EncCBOR (PredicateFailure (EraRule "PPUP" era)) -- Serializing the PredicateFailure
, Eq (EraRuleFailure "PPUP" era)
, Ord (EraRuleFailure "PPUP" era)
, Show (EraRuleFailure "PPUP" era)
, EraPlutusContext era
, EraCertState era
Expand Down Expand Up @@ -295,7 +295,7 @@ invalidEnd = intercalate "," ["[LEDGER][SCRIPTS_NOT_VALIDATE_TRANSITION]", "END"

data FailureDescription
= PlutusFailure Text BS.ByteString
deriving (Show, Eq, Generic, NoThunks)
deriving (Show, Eq, Ord, Generic, NoThunks)

instance NFData FailureDescription

Expand Down Expand Up @@ -329,7 +329,7 @@ scriptFailureToFailureDescription (ScriptFailure msg pwc) =
data TagMismatchDescription
= PassedUnexpectedly
| FailedUnexpectedly (NonEmpty FailureDescription)
deriving (Show, Eq, Generic, NoThunks)
deriving (Show, Eq, Ord, Generic, NoThunks)

instance NFData TagMismatchDescription

Expand Down Expand Up @@ -411,7 +411,6 @@ deriving stock instance
( AlonzoEraScript era
, Show (TxCert era)
, Show (ContextError era)
, Show (Shelley.UTxOState era)
, Show (EraRuleFailure "PPUP" era)
) =>
Show (AlonzoUtxosPredFailure era)
Expand All @@ -420,16 +419,25 @@ deriving stock instance
( AlonzoEraScript era
, Eq (TxCert era)
, Eq (ContextError era)
, Eq (Shelley.UTxOState era)
, Eq (EraRuleFailure "PPUP" era)
) =>
Eq (AlonzoUtxosPredFailure era)

deriving stock instance
( AlonzoEraScript era
, Ord (TxCert era)
, Ord (ContextError era)
, Ord (GovState era)
, Ord (InstantStake era)
, Ord (EraRuleFailure "PPUP" era)
, EraTxOut era
) =>
Ord (AlonzoUtxosPredFailure era)

instance
( AlonzoEraScript era
, NFData (TxCert era)
, NFData (ContextError era)
, NFData (Shelley.UTxOState era)
, NFData (EraRuleFailure "PPUP" era)
) =>
NFData (AlonzoUtxosPredFailure era)
Expand Down
7 changes: 7 additions & 0 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ deriving instance
) =>
Eq (AlonzoUtxowPredFailure era)

deriving instance
( AlonzoEraScript era
, Ord (TxCert era)
, Ord (PredicateFailure (EraRule "UTXO" era))
) =>
Ord (AlonzoUtxowPredFailure era)

instance
( AlonzoEraScript era
, NFData (TxCert era)
Expand Down
8 changes: 8 additions & 0 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Scripts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class
, NFData (PlutusScript era)
, SafeToHash (PlutusScript era)
, Eq (PlutusPurpose AsItem era)
, Ord (PlutusPurpose AsItem era)
, Show (PlutusPurpose AsItem era)
, EncCBOR (PlutusPurpose AsItem era)
, DecCBOR (PlutusPurpose AsItem era)
Expand All @@ -146,6 +147,7 @@ class
, NoThunks (PlutusPurpose AsIx era)
, NFData (PlutusPurpose AsIx era)
, Eq (PlutusPurpose AsIxItem era)
, Ord (PlutusPurpose AsIxItem era)
, Show (PlutusPurpose AsIxItem era)
, NoThunks (PlutusPurpose AsIxItem era)
, NFData (PlutusPurpose AsIxItem era)
Expand Down Expand Up @@ -322,12 +324,16 @@ instance NoThunks (AlonzoPlutusPurpose AsIx era)

deriving instance Eq (TxCert era) => Eq (AlonzoPlutusPurpose AsItem era)

deriving instance Ord (TxCert era) => Ord (AlonzoPlutusPurpose AsItem era)

deriving instance Show (TxCert era) => Show (AlonzoPlutusPurpose AsItem era)

instance NoThunks (TxCert era) => NoThunks (AlonzoPlutusPurpose AsItem era)

deriving instance Eq (TxCert era) => Eq (AlonzoPlutusPurpose AsIxItem era)

deriving instance Ord (TxCert era) => Ord (AlonzoPlutusPurpose AsIxItem era)

deriving instance Show (TxCert era) => Show (AlonzoPlutusPurpose AsIxItem era)

instance NoThunks (TxCert era) => NoThunks (AlonzoPlutusPurpose AsIxItem era)
Expand Down Expand Up @@ -463,6 +469,8 @@ instance

deriving instance (Eq (PlutusScript era), Eq (NativeScript era)) => Eq (AlonzoScript era)

deriving instance (Ord (PlutusScript era), Ord (NativeScript era)) => Ord (AlonzoScript era)

instance
(Era era, NoThunks (PlutusScript era), NoThunks (NativeScript era)) =>
NoThunks (AlonzoScript era)
Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ import NoThunks.Class (InspectHeap (..), NoThunks)
-- | Tag indicating whether non-native scripts in this transaction are expected
-- to validate. This is added by the block creator when constructing the block.
newtype IsValid = IsValid Bool
deriving (Eq, Show, Generic)
deriving (Eq, Ord, Show, Generic)
deriving newtype (NoThunks, NFData, ToCBOR, EncCBOR, DecCBOR, ToJSON, FromJSON)

data AlonzoTx l era where
Expand Down
6 changes: 4 additions & 2 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxOut.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ data Addr28Extra
{-# UNPACK #-} !Word64 -- Payment Addr
{-# UNPACK #-} !Word64 -- Payment Addr
{-# UNPACK #-} !Word64 -- Payment Addr (32bits) + ... + 0/1 for Testnet/Mainnet + 0/1 Script/Pubkey
deriving (Eq, Show, Generic, NoThunks)
deriving (Eq, Ord, Show, Generic, NoThunks)

instance MemPack Addr28Extra where
packedByteCount _ = 32
Expand All @@ -115,7 +115,7 @@ data DataHash32
{-# UNPACK #-} !Word64 -- DataHash
{-# UNPACK #-} !Word64 -- DataHash
{-# UNPACK #-} !Word64 -- DataHash
deriving (Eq, Show, Generic, NoThunks)
deriving (Eq, Ord, Show, Generic, NoThunks)

instance MemPack DataHash32 where
packedByteCount _ = 32
Expand Down Expand Up @@ -197,6 +197,8 @@ instance (Era era, MemPack (CompactForm (Value era))) => MemPack (AlonzoTxOut er

deriving stock instance (Eq (Value era), Compactible (Value era)) => Eq (AlonzoTxOut era)

deriving stock instance (Ord (Value era), Compactible (Value era)) => Ord (AlonzoTxOut era)

deriving instance Generic (AlonzoTxOut era)

-- | Already in NF
Expand Down
10 changes: 10 additions & 0 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ deriving instance
) =>
Eq (BabbageUtxoPredFailure era)

deriving instance
( Era era
, Ord (Alonzo.AlonzoUtxoPredFailure era)
, Ord (PredicateFailure (EraRule "UTXO" era))
, Ord (TxOut era)
, Ord (Script era)
, Ord TxIn
) =>
Ord (BabbageUtxoPredFailure era)

instance
( Era era
, NFData (Value era)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ instance
, State (EraRule "PPUP" era) ~ ShelleyGovState era
, Signal (BabbageUTXOS era) ~ StAnnTx TopTx era
, EncCBOR (EraRuleFailure "PPUP" era)
, Eq (EraRuleFailure "PPUP" era)
, Ord (EraRuleFailure "PPUP" era)
, Show (EraRuleFailure "PPUP" era)
, InjectRuleFailure "UTXOS" Alonzo.AlonzoUtxosPredFailure era
, InjectRuleEvent "UTXOS" Alonzo.AlonzoUtxosEvent era
Expand Down
12 changes: 11 additions & 1 deletion eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ deriving instance
) =>
Eq (BabbageUtxowPredFailure era)

deriving instance
( AlonzoEraScript era
, Ord (Shelley.ShelleyUtxowPredFailure era)
, Ord (PredicateFailure (EraRule "UTXO" era))
, Ord (PredicateFailure (EraRule "UTXOS" era))
, Ord (TxOut era)
, Ord (TxCert era)
) =>
Ord (BabbageUtxowPredFailure era)

instance
( AlonzoEraScript era
, EncCBOR (PredicateFailure (EraRule "UTXO" era))
Expand Down Expand Up @@ -398,7 +408,7 @@ instance
, Environment (EraRule "UTXO" era) ~ Shelley.UtxoEnv era
, State (EraRule "UTXO" era) ~ UTxOState era
, Signal (EraRule "UTXO" era) ~ StAnnTx TopTx era
, Eq (PredicateFailure (EraRule "UTXOS" era))
, Ord (PredicateFailure (EraRule "UTXOS" era))
, Show (PredicateFailure (EraRule "UTXOS" era))
, EraCertState era
) =>
Expand Down
4 changes: 4 additions & 0 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/TxInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ deriving instance
(Eq (AlonzoContextError era), Eq (PlutusPurpose AsIx era)) =>
Eq (BabbageContextError era)

deriving instance
(Ord (AlonzoContextError era), Ord (PlutusPurpose AsIx era)) =>
Ord (BabbageContextError era)

deriving instance
(Show (AlonzoContextError era), Show (PlutusPurpose AsIx era)) =>
Show (BabbageContextError era)
Expand Down
4 changes: 4 additions & 0 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/TxOut.hs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ deriving stock instance
(Era era, Eq (Script era), Eq (CompactForm (Value era))) =>
Eq (BabbageTxOut era)

deriving stock instance
(Era era, Ord (Script era), Ord (CompactForm (Value era))) =>
Ord (BabbageTxOut era)

-- | Already in NF
instance NFData (BabbageTxOut era) where
rnf = rwhnf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ data BlockHeader = BlockHeader
, _bhUpdHash :: !Hash
-- ^ Update payload hash
}
deriving (Eq, Generic, Show, Data)
deriving (Eq, Ord, Show, Generic, Data)

-- TODO: BlockVersion – the protocol (block) version that created the block
-- TODO: SoftwareVersion – the software version that created the block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ data BbodyPredicateFailure
| BUPIFailure (PredicateFailure BUPI)
| DelegationFailure (PredicateFailure DELEG)
| UTXOWSFailure (PredicateFailure UTXOWS)
deriving (Eq, Show, Data)
deriving (Eq, Ord, Show, Data)

instance STS BBODY where
type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data BupiPredicateFailure
= UPIREGFailure (PredicateFailure UPIREG)
| UPIVOTESFailure (PredicateFailure UPIVOTES)
| UPIENDFailure (PredicateFailure UPIEND)
deriving (Eq, Show, Data)
deriving (Eq, Ord, Show, Data)

instance STS BUPI where
type Environment BUPI = UPIEnv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data ChainPredicateFailure
| MaximumBlockSize Natural Natural
| LedgerDelegationFailure (PredicateFailure DELEG)
| LedgerUTxOFailure (PredicateFailure UTXOWS)
deriving (Eq, Show, Data)
deriving (Eq, Ord, Show, Data)

instance STS CHAIN where
type
Expand Down
Loading