Skip to content

Commit

Permalink
Temp
Browse files Browse the repository at this point in the history
Signed-off-by: Ana Pantilie <ana.pantilie95@gmail.com>
  • Loading branch information
ana-pantilie committed Jun 6, 2024
1 parent c4e88bd commit 21c5ebc
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

module PlutusBenchmark.ScriptContexts where

import Data.Eq qualified as Haskell
import PlutusLedgerApi.V1.Address
import PlutusLedgerApi.V1.Value
import PlutusLedgerApi.V3 (OutputDatum (NoOutputDatum), PubKeyHash (..), Redeemer (..),
Expand Down Expand Up @@ -141,7 +142,7 @@ mkScriptContextEqualityDataCode sc =
scriptContextEqualityTerm :: ScriptContext -> PlutusTx.BuiltinData -> ()
-- See Note [Redundant arguments to equality benchmarks]
scriptContextEqualityTerm sc _ =
if sc PlutusTx.== sc
if sc Haskell.== sc
then ()
else PlutusTx.traceError "The argument is not equal to itself"

Expand Down
9 changes: 0 additions & 9 deletions plutus-ledger-api/src/PlutusLedgerApi/V2/Contexts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ data TxInfo = TxInfo
, txInfoId :: TxId -- ^ Hash of the pending transaction body (i.e. transaction excluding witnesses)
} deriving stock (Generic, Haskell.Eq, Haskell.Show)

instance Eq TxInfo where
{-# INLINABLE (==) #-}
TxInfo i ri o f m c w r s rs d tid == TxInfo i' ri' o' f' m' c' w' r' s' rs' d' tid' =
i == i' && ri == ri' && o == o' && f == f' && m == m' && c == c' && w == w' && r == r' && s == s' && rs == rs' && d == d' && tid == tid'

instance Pretty TxInfo where
pretty TxInfo{txInfoInputs, txInfoReferenceInputs, txInfoOutputs, txInfoFee, txInfoMint, txInfoDCert, txInfoWdrl, txInfoValidRange, txInfoSignatories, txInfoRedeemers, txInfoData, txInfoId} =
vsep
Expand All @@ -115,10 +110,6 @@ data ScriptContext = ScriptContext
}
deriving stock (Generic, Haskell.Eq, Haskell.Show)

instance Eq ScriptContext where
{-# INLINABLE (==) #-}
ScriptContext info purpose == ScriptContext info' purpose' = info == info' && purpose == purpose'

instance Pretty ScriptContext where
pretty ScriptContext{scriptContextTxInfo, scriptContextPurpose} =
vsep
Expand Down
89 changes: 0 additions & 89 deletions plutus-ledger-api/src/PlutusLedgerApi/V3/Contexts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ instance Pretty Committee where
, "committeeQuorum:" <+> pretty committeeQuorum
]

instance PlutusTx.Eq Committee where
{-# INLINEABLE (==) #-}
Committee a b == Committee a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'

-- | A constitution. The optional anchor is omitted.
newtype Constitution = Constitution
{ constitutionScript :: Haskell.Maybe V2.ScriptHash
Expand Down Expand Up @@ -325,25 +320,6 @@ data GovernanceAction
deriving stock (Generic, Haskell.Show, Haskell.Eq)
deriving (Pretty) via (PrettyShow GovernanceAction)

instance PlutusTx.Eq GovernanceAction where
{-# INLINEABLE (==) #-}
ParameterChange a b c == ParameterChange a' b' c' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b' PlutusTx.&& c PlutusTx.== c'
HardForkInitiation a b == HardForkInitiation a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
TreasuryWithdrawals a b == TreasuryWithdrawals a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
NoConfidence a == NoConfidence a' = a PlutusTx.== a'
UpdateCommittee a b c d == UpdateCommittee a' b' c' d' =
a PlutusTx.== a'
PlutusTx.&& b PlutusTx.== b'
PlutusTx.&& c PlutusTx.== c'
PlutusTx.&& d PlutusTx.== d'
NewConstitution a b == NewConstitution a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
InfoAction == InfoAction = Haskell.True
_ == _ = Haskell.False

-- | A proposal procedure. The optional anchor is omitted.
data ProposalProcedure = ProposalProcedure
{ ppDeposit :: V2.Lovelace
Expand All @@ -360,13 +336,6 @@ instance Pretty ProposalProcedure where
, "ppGovernanceAction:" <+> pretty ppGovernanceAction
]

instance PlutusTx.Eq ProposalProcedure where
{-# INLINEABLE (==) #-}
ProposalProcedure a b c == ProposalProcedure a' b' c' =
a PlutusTx.== a'
PlutusTx.&& b PlutusTx.== b'
PlutusTx.&& c PlutusTx.== c'

-- | A `ScriptPurpose` uniquely identifies a Plutus script within a transaction.
data ScriptPurpose
= Minting V2.CurrencySymbol
Expand All @@ -384,22 +353,6 @@ data ScriptPurpose
deriving stock (Generic, Haskell.Show, Haskell.Eq)
deriving (Pretty) via (PrettyShow ScriptPurpose)

instance PlutusTx.Eq ScriptPurpose where
{-# INLINEABLE (==) #-}
Minting a == Minting a' =
a PlutusTx.== a'
Spending a == Spending a' =
a PlutusTx.== a'
Rewarding a == Rewarding a' =
a PlutusTx.== a'
Certifying a b == Certifying a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
Voting a == Voting a' =
a PlutusTx.== a'
Proposing a b == Proposing a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
_ == _ = Haskell.False

-- | Like `ScriptPurpose` but with an optional datum for spending scripts.
data ScriptInfo
= MintingScript V2.CurrencySymbol
Expand All @@ -417,22 +370,6 @@ data ScriptInfo
deriving stock (Generic, Haskell.Show, Haskell.Eq)
deriving (Pretty) via (PrettyShow ScriptInfo)

instance PlutusTx.Eq ScriptInfo where
{-# INLINEABLE (==) #-}
MintingScript a == MintingScript a' =
a PlutusTx.== a'
SpendingScript a b== SpendingScript a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
RewardingScript a == RewardingScript a' =
a PlutusTx.== a'
CertifyingScript a b == CertifyingScript a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
VotingScript a == VotingScript a' =
a PlutusTx.== a'
ProposingScript a b == ProposingScript a' b' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b'
_ == _ = Haskell.False

-- | An input of a pending transaction.
data TxInInfo = TxInInfo
{ txInInfoOutRef :: V3.TxOutRef
Expand Down Expand Up @@ -494,27 +431,6 @@ instance Pretty TxInfo where
, "Treasury Donation:" <+> pretty txInfoTreasuryDonation
]

instance PlutusTx.Eq TxInfo where
{-# INLINEABLE (==) #-}
TxInfo a b c d e f g h i j k l m n o p
== TxInfo a' b' c' d' e' f' g' h' i' j' k' l' m' n' o' p' =
a PlutusTx.== a'
PlutusTx.&& b PlutusTx.== b'
PlutusTx.&& c PlutusTx.== c'
PlutusTx.&& d PlutusTx.== d'
PlutusTx.&& e PlutusTx.== e'
PlutusTx.&& f PlutusTx.== f'
PlutusTx.&& g PlutusTx.== g'
PlutusTx.&& h PlutusTx.== h'
PlutusTx.&& i PlutusTx.== i'
PlutusTx.&& j PlutusTx.== j'
PlutusTx.&& k PlutusTx.== k'
PlutusTx.&& l PlutusTx.== l'
PlutusTx.&& m PlutusTx.== m'
PlutusTx.&& n PlutusTx.== n'
PlutusTx.&& o PlutusTx.== o'
PlutusTx.&& p PlutusTx.== p'

-- | The context that the currently-executing script can access.
data ScriptContext = ScriptContext
{ scriptContextTxInfo :: TxInfo
Expand All @@ -534,11 +450,6 @@ instance Pretty ScriptContext where
, nest 2 (vsep ["TxInfo:", pretty scriptContextTxInfo])
]

instance PlutusTx.Eq ScriptContext where
{-# INLINEABLE (==) #-}
ScriptContext a b c == ScriptContext a' b' c' =
a PlutusTx.== a' PlutusTx.&& b PlutusTx.== b' PlutusTx.&& c PlutusTx.== c'

{-# INLINEABLE findOwnInput #-}

-- | Find the input currently being validated.
Expand Down
5 changes: 0 additions & 5 deletions plutus-tx/src/PlutusTx/AssocMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ newtype Map k v = Map {unMap :: [(k, v)]}
deriving stock (Generic, Haskell.Show, Data, TH.Lift)
deriving newtype (NFData)

instance (Eq k, Eq v) => Eq (Map k v) where
Map m1 == m2 =
length m1 == length m2
&& List.all (\(k, v) -> lookup k m2 == Just v) m1

instance (Haskell.Eq k, Haskell.Eq v) => Haskell.Eq (Map k v) where
Map m1 == Map m2 =
Haskell.all (\(k, v) -> Haskell.lookup k m2 Haskell.== Just v) m1
Expand Down

0 comments on commit 21c5ebc

Please sign in to comment.