Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Jan 11, 2024
1 parent ccd3209 commit e655ba3
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cardano-testnet/src/Testnet/Components/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ createSPOGenesisAndFiles testnetOptions startTime (TmpAbsolutePath tempAbsPath')
-- TODO: Remove this rewrite.
-- 50 second epochs
-- Epoch length should be "10 * k / f" where "k = securityParam, f = activeSlotsCoeff"
H.rewriteJsonFile createStakedInitialGenesisFile $ J.rewriteObject
H.rewriteJsonFile genesisShelleyFpAbs $ J.rewriteObject
( KM.insert "securityParam" (toJSON @Int 5) -- TODO: USE config p arameter
. adjustKM
(J.rewriteObject
Expand Down
3 changes: 2 additions & 1 deletion cardano-testnet/src/Testnet/Runtime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ startNode tp node port testnetMagic nodeCmd = GHC.withFrozenCallStack $ do

let nodeStdoutFile = logDir </> node </> "stdout.log"
nodeStderrFile = logDir </> node </> "stderr.log"
sprocket = Sprocket tempBaseAbsPath (socketDir </> node </> "sock")
socketRelPath = socketDir </> node </> "sock"
sprocket = Sprocket tempBaseAbsPath socketRelPath

hNodeStdout <- handleIOExceptT FileRelatedFailure $ IO.openFile nodeStdoutFile IO.WriteMode
hNodeStderr <- handleIOExceptT FileRelatedFailure $ IO.openFile nodeStderrFile IO.ReadWriteMode
Expand Down
5 changes: 3 additions & 2 deletions cardano-testnet/src/Testnet/Start/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,9 @@ cardanoTestnet testnetOptions Conf {tempAbsPath} = do
let spoNodesWithPortNos = L.zip poolKeysFps [3001..]
nodeConfigFile = tempAbsPath' </> "configuration.yaml"
ePoolNodes <- forM (L.zip spoNodesWithPortNos poolKeys) $ \((node, port),key) -> do

eRuntime <- lift . lift . runExceptT $ startNode tempAbsPath node port testnetMagic
let nodeName = tail $ snd (break (== '/') node)

Check warning on line 264 in cardano-testnet/src/Testnet/Start/Cardano.hs

View workflow job for this annotation

GitHub Actions / build

Warning in cardanoTestnet in module Testnet.Start.Cardano: Use dropWhile ▫︎ Found: "snd (break (== '/') node)" ▫︎ Perhaps: "dropWhile (not . (== '/')) node"
H.note_ $ "Node name: " <> nodeName
eRuntime <- lift . lift . runExceptT $ startNode tempAbsPath nodeName port testnetMagic
[ "run"
, "--config", nodeConfigFile
, "--topology", tempAbsPath' </> node </> "topology.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ hprop_leadershipSchedule = H.integrationRetryWorkspace 2 "babbage-leadership-sch
]

utxo1Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-1.json"
UTxO utxo1 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo1Json
UTxO utxo1 <- H.noteShowM $ decodeEraUTxO sbe utxo1Json
txin1 <- H.noteShow =<< H.headM (Map.keys utxo1)

(stakePoolIdNewSpo, stakePoolColdSigningKey, stakePoolColdVKey, vrfSkey, _)
Expand Down Expand Up @@ -166,7 +166,7 @@ hprop_leadershipSchedule = H.integrationRetryWorkspace 2 "babbage-leadership-sch
H.cat $ work </> "utxo-2.json"

utxo2Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-2.json"
UTxO utxo2 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo2Json
UTxO utxo2 <- H.noteShowM $ decodeEraUTxO sbe utxo2Json
txin2 <- H.noteShow =<< H.headM (Map.keys utxo2)

let eraFlag = convertToEraFlag $ cardanoNodeEra cTestnetOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ hprop_transaction = H.integrationRetryWorkspace 0 "babbage-transaction" $ \tempA
]

utxo1Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-1.json"
UTxO utxo1 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo1Json
UTxO utxo1 <- H.noteShowM $ decodeEraUTxO sbe utxo1Json
txin1 <- H.noteShow =<< H.headM (Map.keys utxo1)

void $ execCli' execConfig
Expand Down Expand Up @@ -123,7 +123,7 @@ hprop_transaction = H.integrationRetryWorkspace 0 "babbage-transaction" $ \tempA
]

utxo2Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-2.json"
UTxO utxo2 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo2Json
UTxO utxo2 <- H.noteShowM $ decodeEraUTxO sbe utxo2Json
txouts2 <- H.noteShow $ L.unCoin . txOutValueLovelace . txOutValue . snd <$> Map.toList utxo2

H.assert $ 5_000_001 `List.elem` txouts2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ hprop_kes_period_info = H.integrationRetryWorkspace 2 "kes-period-info" $ \tempA
]

utxo1Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-1.json"
UTxO utxo1 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo1Json
UTxO utxo1 <- H.noteShowM $ decodeEraUTxO sbe utxo1Json
txin1 <- H.noteShow =<< H.headM (Map.keys utxo1)

(stakePoolId, stakePoolColdSigningKey, stakePoolColdVKey, _, _)
Expand Down Expand Up @@ -153,7 +153,7 @@ hprop_kes_period_info = H.integrationRetryWorkspace 2 "kes-period-info" $ \tempA
H.cat $ work </> "utxo-2.json"

utxo2Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-2.json"
UTxO utxo2 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo2Json
UTxO utxo2 <- H.noteShowM $ decodeEraUTxO sbe utxo2Json
txin2 <- H.noteShow =<< H.headM (Map.keys utxo2)

let eraFlag = convertToEraFlag $ cardanoNodeEra cTestnetOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ hprop_ledger_events_propose_new_constitution = H.integrationWorkspace "propose-n
]

utxo1Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-1.json"
UTxO utxo1 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo1Json
UTxO utxo1 <- H.noteShowM $ decodeEraUTxO sbe utxo1Json
txin1 <- H.noteShow =<< H.headM (Map.keys utxo1)

drepRegTxbodyFp <- H.note $ work </> "drep.registration.txbody"
Expand Down Expand Up @@ -182,7 +182,7 @@ hprop_ledger_events_propose_new_constitution = H.integrationWorkspace "propose-n
, "--testnet-magic", show @Int testnetMagic
, "--tx-file", drepRegTxSignedFp
]

void $ H.failMessage callStack "force"
-- Create constitution proposal

void $ H.execCli' execConfig
Expand All @@ -209,7 +209,7 @@ hprop_ledger_events_propose_new_constitution = H.integrationWorkspace "propose-n
]

utxo2Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-2.json"
UTxO utxo2 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo2Json
UTxO utxo2 <- H.noteShowM $ decodeEraUTxO sbe utxo2Json
txin2 <- H.noteShow =<< H.headM (Map.keys utxo2)

void $ H.execCli' execConfig
Expand Down Expand Up @@ -285,7 +285,7 @@ hprop_ledger_events_propose_new_constitution = H.integrationWorkspace "propose-n
]

utxo3Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-3.json"
UTxO utxo3 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo3Json
UTxO utxo3 <- H.noteShowM $ decodeEraUTxO sbe utxo3Json
txin3 <- H.noteShow =<< H.headM (Map.keys utxo3)

voteTxFp <- H.note $ work </> gov </> "vote.tx"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ hprop_transaction = H.integrationRetryWorkspace 0 "submit-api-babbage-transactio
]

utxo1Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-1.json"
UTxO utxo1 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo1Json
UTxO utxo1 <- H.noteShowM $ decodeEraUTxO sbe utxo1Json
txin1 <- H.noteShow =<< H.headM (Map.keys utxo1)

void $ execCli' execConfig
Expand Down Expand Up @@ -162,7 +162,7 @@ hprop_transaction = H.integrationRetryWorkspace 0 "submit-api-babbage-transactio
]

utxo2Json <- H.leftFailM . H.readJsonFile $ work </> "utxo-2.json"
UTxO utxo2 <- H.noteShowM $ H.noteShowM $ decodeEraUTxO sbe utxo2Json
UTxO utxo2 <- H.noteShowM $ decodeEraUTxO sbe utxo2Json
txouts2 <- H.noteShow $ L.unCoin . txOutValueLovelace . txOutValue . snd <$> Map.toList utxo2

H.assert $ 5_000_001 `List.elem` txouts2
Expand Down

0 comments on commit e655ba3

Please sign in to comment.