Skip to content

Commit

Permalink
Drop the MockServer and DirectSpec
Browse files Browse the repository at this point in the history
We arrived at a point where we would need to be fixing the MockServer
because it seems to rely on some behavior not present in the "new"
TinyWallet behavior anymore. But the identical test against a real
cardano-node works. So we decided we do not want to bother.
  • Loading branch information
ch1bo committed Jun 3, 2022
1 parent 3ff93d6 commit 613c0d4
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 403 deletions.
2 changes: 0 additions & 2 deletions hydra-node/hydra-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,9 @@ test-suite tests
Hydra.Chain.Direct.Contract.Mutation
Hydra.Chain.Direct.ContractSpec
Hydra.Chain.Direct.Fixture
Hydra.Chain.Direct.MockServer
Hydra.Chain.Direct.StateSpec
Hydra.Chain.Direct.TxSpec
Hydra.Chain.Direct.WalletSpec
Hydra.Chain.DirectSpec
Hydra.ClientInputSpec
Hydra.CryptoSpec
Hydra.FireForgetSpec
Expand Down
289 changes: 0 additions & 289 deletions hydra-node/test/Hydra/Chain/Direct/MockServer.hs

This file was deleted.

30 changes: 0 additions & 30 deletions hydra-node/test/Hydra/Chain/Direct/WalletSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,16 @@ import qualified Data.Map.Strict as Map
import qualified Data.Sequence.Strict as StrictSeq
import qualified Data.Set as Set
import Hydra.Cardano.Api (
NetworkId (..),
PaymentCredential (PaymentCredentialByKey),
PaymentKey,
VerificationKey,
fromConsensusPointHF,
fromLedgerTx,
mkVkAddress,
toLedgerAddr,
toLedgerTxIn,
toLedgerUTxO,
verificationKeyHash,
)
import qualified Hydra.Cardano.Api as Api
import qualified Hydra.Cardano.Api as Cardano.Api
import Hydra.Cardano.Api.Prelude (fromShelleyPaymentCredential)
import Hydra.Chain.Direct.Fixture (epochInfo, pparams, systemStart, testNetworkId)
import Hydra.Chain.Direct.Util (Block, Era, markerDatum)
Expand Down Expand Up @@ -311,32 +307,6 @@ genValidatedTx = do
body <- (\x -> x{txfee = Coin 0}) <$> arbitrary
pure $ tx{body, wits = mempty}

genPaymentTo :: NetworkId -> VerificationKey PaymentKey -> Gen (ValidatedTx Era)
genPaymentTo networkId vk = do
toValidatedTx =<< arbitrary @TxOut `suchThat` atLeast 2_000_000_000
where
atLeast v = \case
TxOut _ value _ ->
coin value > Coin v

toValidatedTx = \case
TxOut _ value _ -> do
ValidatedTx{body, wits, isValid, auxiliaryData} <- arbitrary
let myAddr =
toLedgerAddr $
mkVkAddress @Cardano.Api.Era networkId vk
pure $
ValidatedTx
{ body =
body
{ outputs =
StrictSeq.fromList [TxOut myAddr value (SJust $ hashData $ Data @Era markerDatum)]
}
, wits
, isValid
, auxiliaryData
}

--
-- Helpers
--
Expand Down
Loading

0 comments on commit 613c0d4

Please sign in to comment.