Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Event Log" #2356

Merged
merged 1 commit into from
Jun 24, 2021
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
6 changes: 2 additions & 4 deletions alonzo/test/test/Test/Cardano/Ledger/Alonzo/Trials.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ import Shelley.Spec.Ledger.LedgerState
UTxOState,
)
import Shelley.Spec.Ledger.PParams (PParams' (..))
import Shelley.Spec.Ledger.STS.Chain (CHAIN, ChainPredicateFailure (..), ChainState (..), Event (..))
import Shelley.Spec.Ledger.STS.Ledger (Event (..), LEDGER, LedgerEnv (..), LedgerPredicateFailure (UtxowFailure))
import Shelley.Spec.Ledger.STS.Chain (CHAIN, ChainPredicateFailure (..), ChainState (..))
import Shelley.Spec.Ledger.STS.Ledger (LEDGER, LedgerEnv (..), LedgerPredicateFailure (UtxowFailure))
import System.Timeout
import Test.Cardano.Ledger.Alonzo.AlonzoEraGen ()
import Test.Cardano.Ledger.EraBuffet (TestCrypto)
Expand Down Expand Up @@ -118,11 +118,9 @@ import Test.Tasty.QuickCheck

instance Embed (AlonzoBBODY (AlonzoEra TestCrypto)) (CHAIN (AlonzoEra TestCrypto)) where
wrapFailed = BbodyFailure
wrapEvent = BbodyEvent

instance Embed (AlonzoUTXOW (AlonzoEra TestCrypto)) (LEDGER (AlonzoEra TestCrypto)) where
wrapFailed = UtxowFailure
wrapEvent = UtxowEvent

-- ======================================================================================
-- It is incredably hard to debug property test generators. These functions mimic the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Byron.Spec.Ledger.Update (PParams, UPIState, maxBkSz)
import Byron.Spec.Ledger.UTxO (UTxO)
import Control.State.Transition (Embed, Environment, STS (..), Signal, State,
TRC (TRC), initialRules, judgmentContext, trans, transitionRules, wrapFailed,
(?!), wrapEvent)
(?!))

import Byron.Spec.Chain.STS.Block

Expand Down Expand Up @@ -57,11 +57,6 @@ instance STS BBODY where

type PredicateFailure BBODY = BbodyPredicateFailure

data Event _
= BUPIEvent (Event BUPI)
| DelegationEvent (Event DELEG)
| UTXOWSEvent (Event UTXOWS)

initialRules = []

transitionRules =
Expand Down Expand Up @@ -98,12 +93,9 @@ instance STS BBODY where

instance Embed BUPI BBODY where
wrapFailed = BUPIFailure
wrapEvent = BUPIEvent

instance Embed DELEG BBODY where
wrapFailed = DelegationFailure
wrapEvent = DelegationEvent

instance Embed UTXOWS BBODY where
wrapFailed = UTXOWSFailure
wrapEvent = UTXOWSEvent
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Data.Data (Data, Typeable)


import Control.State.Transition (Embed, Environment, PredicateFailure, STS, Signal, State,
TRC (TRC), TransitionRule, Event, initialRules, judgmentContext, trans,
transitionRules, wrapFailed, wrapEvent)
TRC (TRC), TransitionRule, initialRules, judgmentContext, trans,
transitionRules, wrapFailed)
import Byron.Spec.Ledger.Core (VKey)
import Byron.Spec.Ledger.Update (ProtVer, UPIEND, UPIEnv, UPIREG, UPIState, UPIVOTES, UProp, Vote)

Expand Down Expand Up @@ -39,11 +39,6 @@ instance STS BUPI where

type PredicateFailure BUPI = BupiPredicateFailure

data Event _
= UPIREGEvent (Event UPIREG)
| UPVOTESEvent (Event UPIVOTES)
| UPIENDEvent (Event UPIEND)

initialRules = []

transitionRules =
Expand Down Expand Up @@ -72,12 +67,9 @@ instance STS BUPI where

instance Embed UPIREG BUPI where
wrapFailed = UPIREGFailure
wrapEvent = UPIREGEvent

instance Embed UPIVOTES BUPI where
wrapFailed = UPIVOTESFailure
wrapEvent = UPVOTESEvent

instance Embed UPIEND BUPI where
wrapFailed = UPIENDFailure
wrapEvent = UPIENDEvent
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ instance STS CHAIN where

type PredicateFailure CHAIN = ChainPredicateFailure

data Event _
= UPIREGEvent ( Event UPIREG )
| UPVOTESEvent ( Event UPIVOTES )
| UPIENDEvent ( Event UPIEND )
| EpochEvent ( Event EPOCH )
| BBodyEvent ( Event BBODY )
| PBFTEvent ( Event PBFT )
| LedgerDelegationEvent ( Event DELEG )
| LedgerUTxOEvent ( Event UTXOWS )

initialRules =
[ do
IRC (_sNow, utxo0', ads, pps', k) <- judgmentContext
Expand Down Expand Up @@ -172,23 +162,18 @@ instance STS CHAIN where

instance Embed EPOCH CHAIN where
wrapFailed = EpochFailure
wrapEvent = EpochEvent

instance Embed BBODY CHAIN where
wrapFailed = BBodyFailure
wrapEvent = BBodyEvent

instance Embed PBFT CHAIN where
wrapFailed = PBFTFailure
wrapEvent = PBFTEvent

instance Embed DELEG CHAIN where
wrapFailed = LedgerDelegationFailure
wrapEvent = LedgerDelegationEvent

instance Embed UTXOWS CHAIN where
wrapFailed = LedgerUTxOFailure
wrapEvent = LedgerUTxOEvent

isHeaderSizeTooBigFailure :: PredicateFailure CHAIN -> Bool
isHeaderSizeTooBigFailure (HeaderSizeTooBig _ _ _) = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ instance STS EPOCH where
type Signal EPOCH = Slot
type PredicateFailure EPOCH = EpochPredicateFailure

data Event _ = UPIECEvent (Event UPIEC)

initialRules = []

transitionRules =
Expand All @@ -59,4 +57,3 @@ instance STS EPOCH where

instance Embed UPIEC EPOCH where
wrapFailed = UPIECFailure
wrapEvent = UPIECEvent
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ instance STS PBFT where

type PredicateFailure PBFT = PbftPredicateFailure

data Event _ = SigCountEvent (Event SIGCNT)

initialRules = []

transitionRules =
Expand All @@ -63,4 +61,3 @@ instance STS PBFT where

instance Embed SIGCNT PBFT where
wrapFailed = SigCountFailure
wrapEvent = SigCountEvent
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ instance STS SIGCNT where
type Signal SIGCNT = VKey
type PredicateFailure SIGCNT = SigcntPredicateFailure

data Event _

initialRules = []

transitionRules =
Expand Down
2 changes: 1 addition & 1 deletion byron/crypto/test/Test/Cardano/Crypto/Limits.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tests = checkParallel $$discover
-- is almost certainly amiss.

newtype Limit t = Limit
{ getLimit :: Word32
{ getLimit :: Word32
} deriving (Eq, Ord, Show, Num, Enum, Real, Integral)

instance Functor Limit where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ import Lens.Micro (Lens', lens, to, (%~), (&), (.~), (<>~), (^.), _1)
import Lens.Micro.TH (makeFields)
import NoThunks.Class (NoThunks (..), allNoThunks, noThunksInKeysAndValues)

import Control.State.Transition (Embed(..), Environment, IRC (IRC), PredicateFailure, STS(..),
import Control.State.Transition (Embed, Environment, IRC (IRC), PredicateFailure, STS,
Signal, State, TRC (TRC), initialRules, judgmentContext, trans,
transitionRules, wrapFailed, (?!))
import Control.State.Transition.Generator (HasTrace, SignalGenerator, envGen, genTrace,
Expand Down Expand Up @@ -301,7 +301,6 @@ instance STS SDELEG where
type Signal SDELEG = DCert
type Environment SDELEG = DSEnv
type PredicateFailure SDELEG = SdelegPredicateFailure
data Event _

initialRules = [ return DSState
{ _dSStateScheduledDelegations = []
Expand Down Expand Up @@ -375,7 +374,6 @@ instance STS ADELEG where
type Signal ADELEG = (Slot, (VKeyGenesis, VKey))
type Environment ADELEG = Set VKeyGenesis
type PredicateFailure ADELEG = AdelegPredicateFailure
data Event _


initialRules = [
Expand Down Expand Up @@ -435,7 +433,6 @@ instance STS SDELEGS where
type Signal SDELEGS = [DCert]
type Environment SDELEGS = DSEnv
type PredicateFailure SDELEGS = SdelegsPredicateFailure
data Event _ = SDelegEvent (Event SDELEG)

initialRules = [ do
IRC env <- judgmentContext
Expand All @@ -454,7 +451,6 @@ instance STS SDELEGS where

instance Embed SDELEG SDELEGS where
wrapFailed = SDelegFailure
wrapEvent = SDelegEvent

-- | Delegation rules sequencing
data ADELEGS deriving (Data, Typeable)
Expand All @@ -467,7 +463,6 @@ instance STS ADELEGS where
type State ADELEGS = DState
type Signal ADELEGS = [(Slot, (VKeyGenesis, VKey))]
type Environment ADELEGS = Set VKeyGenesis
data Event _ = ADelegEvent (Event ADELEG)

type PredicateFailure ADELEGS
= AdelegsPredicateFailure
Expand All @@ -489,7 +484,6 @@ instance STS ADELEGS where

instance Embed ADELEG ADELEGS where
wrapFailed = ADelegFailure
wrapEvent = ADelegEvent

-- | Delegation interface
data DELEG deriving (Data, Typeable)
Expand All @@ -505,9 +499,6 @@ instance STS DELEG where
type Environment DELEG = DIEnv

type PredicateFailure DELEG = DelegPredicateFailure
data Event _
= SDelegSEvent (Event SDELEGS)
| ADelegSEvent (Event ADELEGS)

initialRules = [ do
IRC env <- judgmentContext
Expand Down Expand Up @@ -537,11 +528,9 @@ instance STS DELEG where

instance Embed SDELEGS DELEG where
wrapFailed = SDelegSFailure
wrapEvent = SDelegSEvent

instance Embed ADELEGS DELEG where
wrapFailed = ADelegSFailure
wrapEvent = ADelegSEvent

--------------------------------------------------------------------------------
-- Generators
Expand Down Expand Up @@ -621,7 +610,6 @@ instance STS MSDELEG where
type State MSDELEG = DSState
type Signal MSDELEG = Maybe DCert
type PredicateFailure MSDELEG = MsdelegPredicateFailure
data Event _ = SDELEGEvent (Event SDELEG)

initialRules = []

Expand All @@ -635,7 +623,6 @@ instance STS MSDELEG where

instance Embed SDELEG MSDELEG where
wrapFailed = SDELEGFailure
wrapEvent = SDELEGEvent

instance HasTrace MSDELEG where

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import Data.Data (Data, Typeable)
import qualified Data.Set as Set
import GHC.Generics (Generic)

import Control.State.Transition (Environment, IRC (IRC), PredicateFailure, STS, Event, Signal,
import Control.State.Transition (Environment, IRC (IRC), PredicateFailure, STS, Signal,
State, TRC (TRC), initialRules, judgmentContext, transitionRules, (?!))
import Byron.Spec.Ledger.Core (Lovelace, dom, range, (∪), (⊆), (⋪), (◁))
import Byron.Spec.Ledger.GlobalParams (lovelaceCap)
Expand Down Expand Up @@ -70,7 +70,6 @@ instance STS UTXO where
type State UTXO = UTxOState
type Signal UTXO = Tx
type PredicateFailure UTXO = UtxoPredicateFailure
data Event _

initialRules =
[ do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import qualified Hedgehog.Gen as Gen
import Hedgehog.Internal.Property (CoverPercentage)
import qualified Hedgehog.Range as Range

import Control.State.Transition (Embed(..), Environment, IRC (IRC), STS (..),
import Control.State.Transition (Embed, Environment, IRC (IRC), STS (..),
Signal, State, TRC (TRC), initialRules, judgmentContext, trans,
transitionRules, wrapFailed, (?!))
import Control.State.Transition.Generator (HasTrace, SignalGenerator, coverFailures,
Expand Down Expand Up @@ -58,7 +58,6 @@ instance STS UTXOW where
type State UTXOW = UTxOState
type Signal UTXOW = Tx
type PredicateFailure UTXOW = UtxowPredicateFailure
data Event _ = UtxoEvent (Event UTXO)

initialRules =
[ do
Expand Down Expand Up @@ -94,7 +93,6 @@ witnessed (Tx tx wits) utxo =

instance Embed UTXO UTXOW where
wrapFailed = UtxoFailure
wrapEvent = UtxoEvent

-- | Constant list of addresses intended to be used in the generators.
traceAddrs :: [Addr]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import GHC.Generics (Generic)
import Byron.Spec.Ledger.STS.UTXO (UTxOEnv, UTxOState)
import Byron.Spec.Ledger.STS.UTXOW (UTXOW)
import Byron.Spec.Ledger.UTxO (Tx)
import Control.State.Transition (Embed, Environment, IRC (IRC), PredicateFailure, STS(..),
import Control.State.Transition (Embed, Environment, IRC (IRC), PredicateFailure, STS,
Signal, State, TRC (TRC), initialRules, judgmentContext, trans,
transitionRules, wrapFailed, wrapEvent)
transitionRules, wrapFailed)
import Control.State.Transition.Generator (HasTrace, envGen, genTrace, sigGen)
import Control.State.Transition.Trace (TraceOrder (OldestFirst), traceSignals)

Expand All @@ -37,7 +37,6 @@ instance STS UTXOWS where
type Signal UTXOWS = [Tx]
type Environment UTXOWS = UTxOEnv
type PredicateFailure UTXOWS = UtxowsPredicateFailure
data Event _ = UtxowEvent (Event UTXOW)

initialRules =
[ do
Expand All @@ -58,7 +57,6 @@ instance STS UTXOWS where

instance Embed UTXOW UTXOWS where
wrapFailed = UtxowFailure
wrapEvent = UtxowEvent

instance HasTrace UTXOWS where
envGen = envGen @UTXOW
Expand Down
Loading