Skip to content

Commit

Permalink
plutus-playground: Delete unused field from EvaluationResult (#2594)
Browse files Browse the repository at this point in the history
* plutus-playground: Delete unused field from EvaluationResult
  • Loading branch information
j-mueller committed Jan 14, 2021
1 parent de06e3d commit 5a858c2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions playground-common/src/Playground/Interpreter/Util.hs
Expand Up @@ -100,8 +100,7 @@ evaluationResultFold :: [Wallet] -> EmulatorEventFoldM effs EvaluationResult
evaluationResultFold wallets =
let pkh wallet = (pubKeyHash (walletPubKey wallet), wallet)
in Playground.Types.EvaluationResult
<$> L.generalize (reverse <$> Folds.blockchain)
<*> L.generalize (reverse <$> Folds.annotatedBlockchain)
<$> L.generalize (reverse <$> Folds.annotatedBlockchain)
<*> L.generalize (filter isInteresting <$> Folds.emulatorLog)
<*> renderInstanceTrace (walletInstanceTag <$> wallets)
<*> fmap (fmap (uncurry SimulatorWallet) . Map.toList) (funds wallets)
Expand Down
5 changes: 2 additions & 3 deletions playground-common/src/Playground/Types.hs
Expand Up @@ -26,7 +26,7 @@ import GHC.Generics (Generic)
import Language.Haskell.Interpreter (CompilationError, SourceCode)
import qualified Language.Haskell.Interpreter as HI
import Language.Plutus.Contract.Effects.ExposeEndpoint (EndpointDescription)
import Ledger (PubKeyHash, Tx, fromSymbol, pubKeyHash)
import Ledger (PubKeyHash, fromSymbol, pubKeyHash)
import qualified Ledger.Ada as Ada
import Ledger.Scripts (ValidatorHash)
import Ledger.Slot (Slot)
Expand Down Expand Up @@ -134,8 +134,7 @@ pubKeys Evaluation {..} = pubKeyHash . walletPubKey . simulatorWalletWallet <$>

data EvaluationResult =
EvaluationResult
{ resultBlockchain :: [[Tx]] -- ^ The blockchain, newest blocks first
, resultRollup :: [[AnnotatedTx]] -- ^ Annotated blockchain, newest blocks first
{ resultRollup :: [[AnnotatedTx]] -- ^ Annotated blockchain, newest blocks first
, emulatorLog :: [EmulatorEvent] -- ^ The emulator log, newest events first
, emulatorTrace :: Text
, fundsDistribution :: [SimulatorWallet]
Expand Down
3 changes: 0 additions & 3 deletions plutus-playground-client/src/Types.purs
Expand Up @@ -317,9 +317,6 @@ _createGistResult = _Newtype <<< prop (SProxy :: SProxy "createGistResult")
_gistUrl :: Lens' State (Maybe String)
_gistUrl = _Newtype <<< prop (SProxy :: SProxy "gistUrl")

_resultBlockchain :: Lens' EvaluationResult Blockchain
_resultBlockchain = _Newtype <<< prop (SProxy :: SProxy "resultBlockchain")

_walletKeys :: Lens' EvaluationResult (Array (JsonTuple PubKeyHash Wallet))
_walletKeys = _Newtype <<< prop (SProxy :: SProxy "walletKeys")

Expand Down
5 changes: 3 additions & 2 deletions plutus-playground-server/test/Playground/UsecasesSpec.hs
Expand Up @@ -42,7 +42,7 @@ import Playground.Types (CompilationRes
SimulatorWallet (SimulatorWallet), adaCurrency,
argument, argumentValues, caller, emulatorLog,
endpointDescription, fundsDistribution, program,
resultBlockchain, simulatorWalletBalance,
resultRollup, simulatorWalletBalance,
simulatorWalletWallet, sourceCode, walletKeys,
wallets)
import Playground.Usecases (crowdFunding, errorHandling, game, vesting)
Expand All @@ -51,6 +51,7 @@ import Test.Tasty (TestTree, test
import Test.Tasty.HUnit (Assertion, assertEqual, assertFailure, testCase)
import Wallet.Emulator.Types (Wallet (Wallet))
import Wallet.Rollup.Render (showBlockchain)
import Wallet.Rollup.Types (AnnotatedTx (tx))

tests :: TestTree
tests =
Expand Down Expand Up @@ -223,7 +224,7 @@ hasFundsDistribution _ (Left err) = assertFailure $ show err
hasFundsDistribution requiredDistribution (Right InterpreterResult {result = EvaluationResult {..}}) = do
unless (requiredDistribution == fundsDistribution) $ do
Text.putStrLn $
either id id $ showBlockchain walletKeys resultBlockchain
either id id $ showBlockchain walletKeys $ fmap (fmap tx) resultRollup
traverse_ print $ reverse emulatorLog
assertEqual "" requiredDistribution fundsDistribution

Expand Down

0 comments on commit 5a858c2

Please sign in to comment.