Skip to content

Commit

Permalink
Merge pull request #1654 from Plutonomicon/dshuiski/cardano-testnet-s…
Browse files Browse the repository at this point in the history
…tartup

Fix startCardanoTestnet
  • Loading branch information
errfrom authored Dec 4, 2024
2 parents 391dda3 + 5ceff62 commit b02718b
Show file tree
Hide file tree
Showing 14 changed files with 350 additions and 260 deletions.
30 changes: 18 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,47 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [[Unreleased]](#unreleased)
- [Changed](#changed)
- [Fixed](#fixed)
- [[v9.3.1]](#v931)
- [Fixed](#fixed-1)
- [[v9.3.0]](#v930)
- [Fixed](#fixed-2)
- [Changed](#changed)
- [Changed](#changed-1)
- [[v9.2.0]](#v920)
- [Added](#added)
- [Changed](#changed-1)
- [Changed](#changed-2)
- [Removed](#removed)
- [Fixed](#fixed-3)
- [[v9.1.0]](#v910)
- [Added](#added-1)
- [Changed](#changed-2)
- [Changed](#changed-3)
- [Removed](#removed-1)
- [Fixed](#fixed-4)
- [[v9.0.0]](#v900)
- [Deprecated](#deprecated)
- [Added](#added-2)
- [Removed](#removed-2)
- [Changed](#changed-3)
- [Changed](#changed-4)
- [Fixed](#fixed-5)
- [[v8.0.0]](#v800)
- [Added](#added-3)
- [Changed](#changed-4)
- [Changed](#changed-5)
- [Fixed](#fixed-6)
- [Removed](#removed-3)
- [[v7.0.0]](#v700)
- [Added](#added-4)
- [Changed](#changed-5)
- [Changed](#changed-6)
- [Fixed](#fixed-7)
- [Removed](#removed-4)
- [[v6.0.0]](#v600)
- [Added](#added-5)
- [Changed](#changed-6)
- [Changed](#changed-7)
- [Fixed](#fixed-8)
- [Removed](#removed-5)
- [[v5.0.0]](#v500)
- [Added](#added-6)
- [Changed](#changed-7)
- [Changed](#changed-8)
- [Removed](#removed-6)
- [Fixed](#fixed-9)
- [Runtime Dependencies](#runtime-dependencies)
Expand All @@ -57,25 +58,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Added](#added-7)
- [[v4.0.0] - 2022-12-15](#v400---2022-12-15)
- [Added](#added-8)
- [Changed](#changed-8)
- [Changed](#changed-9)
- [Removed](#removed-7)
- [Fixed](#fixed-11)
- [Runtime Dependencies](#runtime-dependencies-1)
- [[3.0.0] - 2022-11-21](#300---2022-11-21)
- [Added](#added-9)
- [Changed](#changed-9)
- [Changed](#changed-10)
- [Removed](#removed-8)
- [Fixed](#fixed-12)
- [Runtime Dependencies](#runtime-dependencies-2)
- [[2.0.0] - 2022-09-12](#200---2022-09-12)
- [Added](#added-10)
- [Changed](#changed-10)
- [Changed](#changed-11)
- [Removed](#removed-9)
- [Fixed](#fixed-13)
- [[2.0.0-alpha] - 2022-07-05](#200-alpha---2022-07-05)
- [Added](#added-11)
- [Removed](#removed-10)
- [Changed](#changed-11)
- [Changed](#changed-12)
- [Fixed](#fixed-14)
- [[1.1.0] - 2022-06-30](#110---2022-06-30)
- [Fixed](#fixed-15)
Expand All @@ -87,9 +88,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Changed

- `cardano-serialization-lib` has been updated to `v13.2.0` ([#1656](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1656))

### Fixed

- Fixed transaction witness set 'attach' functions. Previously, the updated witness set was incorrectly appended to the existing set, causing performance degradation when processing constraints for complex transactions. ([#1653](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1653))
- Updating to CSL `v13.2.0` should resolve the issue of occasional transaction script integrity hash mismatches on tx submission ([#1656](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1656))

## [v9.3.1]

Expand Down
50 changes: 25 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"license": "MIT",
"dependencies": {
"@mlabs-haskell/cardano-message-signing": "^1.0.1",
"@mlabs-haskell/cardano-serialization-lib-gc": "12.0.0",
"@mlabs-haskell/cardano-serialization-lib-gc": "13.2.0",
"@mlabs-haskell/json-bigint": "2.0.0",
"@mlabs-haskell/uplc-apply-args": "1.0.29-alpha",
"@noble/secp256k1": "^1.7.0",
Expand Down
4 changes: 2 additions & 2 deletions packages.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ let additions =
]
, repo =
"https://github.com/mlabs-haskell/purescript-cardano-serialization-lib"
, version = "v2.0.0"
, version = "v3.0.0"
}
, cardano-plutus-data-schema =
{ dependencies = [ "prelude" ]
Expand Down Expand Up @@ -372,7 +372,7 @@ let additions =
, "unsafe-coerce"
]
, repo = "https://github.com/mlabs-haskell/purescript-cardano-types"
, version = "v3.0.0"
, version = "v4.0.0"
}
, cardano-message-signing =
{ dependencies =
Expand Down
12 changes: 6 additions & 6 deletions spago-packages.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions src/Internal/Spawn.purs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ spawn' cmd args opts mbFilter cont = do
child <- ChildProcess.spawn cmd args opts
let fullCmd = cmd <> foldMap (" " <> _) args
closedAVar <- AVar.empty
interface <- RL.createInterface (stdout child) mempty
stdoutInterfaceRef <- Ref.new Nothing
stderrInterface <- RL.createInterface (stderr child) mempty
flip RL.setLineHandler stderrInterface \str -> do
traceM $ "stderr: " <> str
outputRef <- Ref.new ""
ChildProcess.onClose child \code -> do
RL.close interface
stdoutInterface <- Ref.read stdoutInterfaceRef
traverse_ RL.close stdoutInterface
RL.close stderrInterface
void $ AVar.tryPut code closedAVar
output <- Ref.read outputRef
cont $ Left $ error
Expand All @@ -113,16 +115,18 @@ spawn' cmd args opts mbFilter cont = do
case mbFilter of
Nothing -> cont (pure mp)
Just filter -> do
flip RL.setLineHandler interface
stdoutInterface <- RL.createInterface (stdout child) mempty
Ref.write (Just stdoutInterface) stdoutInterfaceRef
flip RL.setLineHandler stdoutInterface
\str -> do
output <- Ref.modify (_ <> str <> "\n") outputRef
filter { output, line: str } >>= case _ of
Success -> do
clearLineHandler interface
clearLineHandler stdoutInterface
cont (pure mp)
Cancel -> do
kill SIGINT child
clearLineHandler interface
clearLineHandler stdoutInterface
cont $ Left $ error
$ "Process cancelled because output received: "
<> str
Expand Down
12 changes: 6 additions & 6 deletions src/Internal/Testnet/Contract.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module Ctl.Internal.Testnet.Contract
import Contract.Prelude

import Cardano.Serialization.Lib (privateKey_generateEd25519) as Csl
import Cardano.Types (NetworkId(TestnetId))
import Cardano.Types.Address (Address, getPaymentCredential, getStakeCredential)
import Cardano.Types.Address (toBech32) as Address
import Cardano.Types.BigInt (BigInt)
Expand Down Expand Up @@ -65,6 +64,7 @@ import Ctl.Internal.Testnet.DistributeFunds (Tx(Tx)) as DistrFunds
import Ctl.Internal.Testnet.Server
( StartedTestnetCluster
, makeClusterContractEnv
, mkLogging
, startTestnetCluster
)
import Ctl.Internal.Testnet.Types (TestnetConfig)
Expand Down Expand Up @@ -242,13 +242,13 @@ startTestnetContractEnv
}
startTestnetContractEnv cfg distr cleanupRef = do
_ <- cleanupOnExit cleanupRef
cluster <- startTestnetCluster cfg cleanupRef
{ env, printLogs, clearLogs } <- makeClusterContractEnv cleanupRef cfg
let env' = env { networkId = TestnetId }
wallets <- mkWallets env' cluster
logging@{ logger } <- liftEffect $ mkLogging cfg
cluster <- startTestnetCluster cfg cleanupRef logger
{ env, printLogs, clearLogs } <- makeClusterContractEnv cleanupRef logging
wallets <- mkWallets env cluster
pure
{ cluster
, env: env'
, env
, wallets
, printLogs
, clearLogs
Expand Down
Loading

0 comments on commit b02718b

Please sign in to comment.