Skip to content

Commit

Permalink
Update calls to cardano-cli due to recently removed commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 authored and crocodile-dentist committed Oct 3, 2024
1 parent 0d89be3 commit de80b7a
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 52 deletions.
5 changes: 3 additions & 2 deletions cardano-testnet/src/Testnet/Process/Cli/Keys.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ cliNodeKeyGenKes :: ()
-> m ()
cliNodeKeyGenKes = GHC.withFrozenCallStack $ shelleyKeyGen "node" "key-gen-KES"

-- | NB this automatically selects the latest era.
shelleyKeyGen :: ()
=> (MonadTest m, MonadCatch m, MonadIO m, HasCallStack)
=> String -- ^ command
Expand All @@ -67,7 +68,7 @@ shelleyKeyGen :: ()
shelleyKeyGen command subCommand keyPair =
GHC.withFrozenCallStack $
execCli_
[ command, subCommand
[ "latest", command, subCommand
, "--verification-key-file", verificationKeyFp keyPair
, "--signing-key-file", signingKeyFp keyPair
]
Expand All @@ -79,7 +80,7 @@ cliNodeKeyGen
-> m ()
cliNodeKeyGen keyPair (File counterPath) =
execCli_
[ "node", "key-gen"
[ "latest", "node", "key-gen"
, "--cold-verification-key-file", verificationKeyFp keyPair
, "--cold-signing-key-file", signingKeyFp keyPair
, "--operational-certificate-issue-counter-file", counterPath
Expand Down
16 changes: 8 additions & 8 deletions cardano-testnet/src/Testnet/Process/Cli/SPO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ checkStakePoolRegistered tempAbsP execConfig poolColdVkeyFp outputFp =
oFpAbs = tempAbsPath' </> outputFp

stakePoolId' <- filter ( /= '\n') <$>
execCli [ "stake-pool", "id"
execCli [ "latest", "stake-pool", "id"
, "--cold-verification-key-file", poolColdVkeyFp
]

-- Check to see if stake pool was registered
void $ execCli' execConfig
[ "query", "stake-pools"
[ "latest", "query", "stake-pools"
, "--out-file", oFpAbs
]

Expand Down Expand Up @@ -113,7 +113,7 @@ checkStakeKeyRegistered tempAbsP nodeConfigFile sPath terminationEpoch execConfi
Right (_, dag) -> return dag
Left e -> do
void $ execCli' execConfig
[ "query", "stake-address-info"
[ "latest", "query", "stake-address-info"
, "--address", stakeAddr
, "--out-file", oFpAbs
]
Expand Down Expand Up @@ -284,7 +284,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF

poolownerstakeaddr <- filter (/= '\n')
<$> execCli
[ "stake-address", "build"
[ "latest", "stake-address", "build"
, "--stake-verification-key-file", poolOwnerstakeVkeyFp
, "--testnet-magic", show @Int testnetMag
]
Expand All @@ -296,7 +296,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF
$ KeyPair (File poolOwnerPaymentVkeyFp) (File poolOwnerPaymentSkeyFp)

poolowneraddresswstakecred <-
execCli [ "address", "build"
execCli [ "latest", "address", "build"
, "--payment-verification-key-file", poolOwnerPaymentVkeyFp
, "--stake-verification-key-file", poolOwnerstakeVkeyFp
, "--testnet-magic", show @Int testnetMag
Expand All @@ -307,7 +307,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF
poolColdSkeyFp = spoReqDir </> "pool-cold.skey"

execCli_
[ "node", "key-gen"
[ "latest", "node", "key-gen"
, "--cold-verification-key-file", poolColdVkeyFp
, "--cold-signing-key-file", poolColdSkeyFp
, "--operational-certificate-issue-counter-file", spoReqDir </> "operator.counter"
Expand Down Expand Up @@ -362,7 +362,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF
let pledgeAndPoolRegistrationTx = workDir </> "pledger-and-pool-registration-cert.tx"

void $ execCli
[ "transaction", "sign"
[ "latest", "transaction", "sign"
, "--tx-body-file", workDir </> "pledge-registration-cert.txbody"
, "--testnet-magic", show @Int testnetMag
, "--signing-key-file", fundingSigninKey
Expand All @@ -374,7 +374,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF
H.note_ "Submitting pool owner/pledger stake registration cert and funding stake pool owner address..."

void $ execCli' execConfig
[ "transaction", "submit"
[ "latest", "transaction", "submit"
, "--tx-file", pledgeAndPoolRegistrationTx
]

Expand Down
2 changes: 1 addition & 1 deletion cardano-testnet/src/Testnet/Process/Cli/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ retrieveTransactionId
-> m String
retrieveTransactionId execConfig signedTxBody = do
txidOutput <- execCli' execConfig
[ "transaction", "txid"
[ "latest", "transaction", "txid"
, "--tx-file", unFile signedTxBody
]
return $ mconcat $ lines txidOutput
Expand Down
2 changes: 1 addition & 1 deletion cardano-testnet/src/Testnet/Property/Assert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ assertExpectedSposInLedgerState
-> m ()
assertExpectedSposInLedgerState output (NumPools numExpectedPools) execConfig = withFrozenCallStack $ do
void $ execCli' execConfig
[ "query", "stake-pools"
[ "latest", "query", "stake-pools"
, "--out-file", output
]

Expand Down
4 changes: 2 additions & 2 deletions cardano-testnet/src/Testnet/Start/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ cardanoTestnet
let paymentAddrFile = tmpAbsPath </> "utxo-keys" </> "utxo" <> show idx </> "utxo.addr"

execCli_
[ "address", "build"
[ "latest", "address", "build"
, "--payment-verification-key-file", makeUTxOVKeyFp idx
, "--testnet-magic", show testnetMagic
, "--out-file", paymentAddrFile
Expand Down Expand Up @@ -381,7 +381,7 @@ cardanoTestnet
H.cat . verificationKeyFp $ paymentKeyInfoPair wallet

utxos <- execCli' execConfig
[ "query", "utxo"
[ "latest", "query", "utxo"
, "--address", Text.unpack $ paymentKeyInfoAddr wallet
, "--cardano-mode"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa

plutusSpendingScriptAddr <-
execCli' execConfig
[ "address", "build"
[ "latest", "address", "build"
, "--payment-script-file", plutusScript
]

Expand All @@ -99,7 +99,7 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa

scriptdatumhash <- filter (/= '\n') <$>
execCli' execConfig
[ "transaction", "hash-script-data"
[ "latest", "transaction", "hash-script-data"
, "--script-data-value", "0"
]

Expand Down Expand Up @@ -127,14 +127,14 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa

let sendAdaToScriptAddressTx = work </> "send-ada-to-script-address-tx"
void $ execCli' execConfig
[ "transaction", "sign"
[ "latest", "transaction", "sign"
, "--tx-body-file", sendAdaToScriptAddressTxBody
, "--signing-key-file", utxoSKeyFile
, "--out-file", sendAdaToScriptAddressTx
]

void $ execCli' execConfig
[ "transaction", "submit"
[ "latest", "transaction", "submit"
, "--tx-file", sendAdaToScriptAddressTx
]

Expand Down Expand Up @@ -169,14 +169,14 @@ hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBa
]

void $ execCli' execConfig
[ "transaction", "sign"
[ "latest", "transaction", "sign"
, "--tx-body-file", spendScriptUTxOTxBody
, "--signing-key-file", utxoSKeyFile2
, "--out-file", spendScriptUTxOTx
]

void $ execCli' execConfig
[ "transaction", "submit"
[ "latest", "transaction", "submit"
, "--tx-file", spendScriptUTxOTx
]
H.success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ hprop_stakeSnapshot = integrationRetryWorkspace 2 "conway-stake-snapshot" $ \tem
(Api.File $ IO.sprocketSystemName poolSprocket1) (EpochNo 3)


json <- execCliStdoutToJson execConfig [ "query", "stake-snapshot", "--all-stake-pools" ]
json <- execCliStdoutToJson execConfig [ "latest", "query", "stake-snapshot", "--all-stake-pools" ]

-- There are three stake pools so check that "pools" has three entries
case json of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs

-- NB: We must include the stake credential
testDelegatorPaymentAddr <- execCli
[ "address", "build"
[ "latest", "address", "build"
, "--testnet-magic", show @Int testnetMagic
, "--payment-verification-key-file", testDelegatorPaymentVKeyFp
, "--stake-verification-key-file", testDelegatorVkeyFp
]
testDelegatorStakeAddress
<- filter (/= '\n')
<$> execCli
[ "stake-address", "build"
[ "latest", "stake-address", "build"
, "--stake-verification-key-file", testDelegatorVkeyFp
, "--testnet-magic", show @Int testnetMagic
]
Expand Down Expand Up @@ -183,7 +183,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs

let delegRegTestDelegatorTxFp = work </> "deleg-register-test-delegator.tx"
void $ execCli
[ "transaction", "sign"
[ "latest", "transaction", "sign"
, "--tx-body-file", delegRegTestDelegatorTxBodyFp
, "--testnet-magic", show @Int testnetMagic
, "--signing-key-file", utxoSKeyFile
Expand All @@ -194,7 +194,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
H.note_ "Submitting test delegator registration and delegation certificates..."

void $ execCli' execConfig
[ "transaction", "submit"
[ "latest", "transaction", "submit"
, "--tx-file", delegRegTestDelegatorTxFp
]

Expand Down Expand Up @@ -231,15 +231,15 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
let testSpoOperationalCertFp = testSpoDir </> "node-operational.cert"

void $ execCli' execConfig
[ "node", "new-counter"
[ "latest", "node", "new-counter"
, "--cold-verification-key-file", stakePoolColdVKey
, "--counter-value", "0"
, "--operational-certificate-issue-counter-file", testSpoOperationalCertFp
]


void $ execCli' execConfig
[ "node", "issue-op-cert"
[ "latest", "node", "issue-op-cert"
, "--kes-period", "0"
, "--kes-verification-key-file", testSpoKesVKey
, "--cold-signing-key-file", stakePoolColdSigningKey
Expand All @@ -265,20 +265,20 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
threadDelay 5_000_000

stakeSnapshot1 <- execCli' execConfig
[ "query", "stake-snapshot"
[ "latest", "query", "stake-snapshot"
, "--all-stake-pools"
]
H.writeFile (work </> "stake-snapshot-1.json") stakeSnapshot1

ledgerStateJson <- execCli' execConfig
[ "query", "ledger-state"
[ "latest", "query", "ledger-state"
, "--cardano-mode"
]
H.writeFile (work </> "ledger-state-1.json") ledgerStateJson

let kesPeriodInfoOutput = testSpoDir </> "kes-period-info-expected-success.json"
void $ execCli' execConfig
[ "query", "kes-period-info"
[ "latest", "query", "kes-period-info"
, "--op-cert-file", testSpoOperationalCertFp
, "--out-file", kesPeriodInfoOutput
]
Expand All @@ -294,7 +294,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
]

void $ execCli' execConfig
[ "query", "tip"
[ "latest", "query", "tip"
, "--out-file", work </> "current-tip.json"
]

Expand Down Expand Up @@ -322,7 +322,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs


void $ execCli' execConfig
[ "query", "tip"
[ "latest", "query", "tip"
, "--out-file", work </> "current-tip-2.json"
]

Expand All @@ -342,15 +342,15 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
, " certificate is valid"
]
stakeSnapshot2 <- execCli' execConfig
[ "query", "stake-snapshot"
[ "latest", "query", "stake-snapshot"
, "--all-stake-pools"
]

-- TODO: Create a check here that confirms there are four stake pools and each has stake!
H.writeFile (work </> "stake-snapshot-2.json") stakeSnapshot2

ledgerStateJson2 <- execCli' execConfig
[ "query", "ledger-state"
[ "latest", "query", "ledger-state"
, "--cardano-mode"
]
H.writeFile (work </> "ledger-state-2.json") ledgerStateJson2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \

-- NB: We must include the stake credential
testDelegatorPaymentAddr <- execCli
[ "address", "build"
[ "latest", "address", "build"
, "--testnet-magic", show @Int testnetMagic
, "--payment-verification-key-file", testDelegatorPaymentVKeyFp
, "--stake-verification-key-file", testDelegatorVkeyFp
]
testDelegatorStakeAddress
<- filter (/= '\n')
<$> execCli
[ "stake-address", "build"
[ "latest", "stake-address", "build"
, "--stake-verification-key-file", testDelegatorVkeyFp
, "--testnet-magic", show @Int testnetMagic
]
Expand All @@ -153,7 +153,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \
H.note_ "Get updated UTxO"

void $ execCli' execConfig
[ "query", "utxo"
[ "latest", "query", "utxo"
, "--address", utxoAddr
, "--cardano-mode"
, "--out-file", work </> "utxo-2.json"
Expand Down Expand Up @@ -181,7 +181,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \

let delegRegTestDelegatorTxFp = work </> "deleg-register-test-delegator.tx"
void $ execCli
[ "transaction", "sign"
[ "latest", "transaction", "sign"
, "--tx-body-file", delegRegTestDelegatorTxBodyFp
, "--testnet-magic", show @Int testnetMagic
, "--signing-key-file", utxoSKeyFile
Expand All @@ -192,7 +192,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \
H.note_ "Submitting test delegator registration and delegation certificates..."

void $ execCli' execConfig
[ "transaction", "submit"
[ "latest", "transaction", "submit"
, "--tx-file", delegRegTestDelegatorTxFp
]

Expand Down Expand Up @@ -226,15 +226,15 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \
let testSpoOperationalCertFp = testSpoDir </> "node-operational.cert"

void $ execCli' execConfig
[ "node", "new-counter"
[ "latest", "node", "new-counter"
, "--cold-verification-key-file", stakePoolColdVKey
, "--counter-value", "0"
, "--operational-certificate-issue-counter-file", testSpoOperationalCertFp
]


void $ execCli' execConfig
[ "node", "issue-op-cert"
[ "latest", "node", "issue-op-cert"
, "--kes-period", "0"
, "--kes-verification-key-file", testSpoKesVKey
, "--cold-signing-key-file", stakePoolColdSigningKey
Expand Down Expand Up @@ -266,7 +266,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \
currentLeaderShipScheduleFile <- H.noteTempFile work "current-schedule.log"

void $ execCli' execConfig
[ "query", "leadership-schedule"
[ "latest", "query", "leadership-schedule"
, "--genesis", shelleyGenesisFile tr
, "--stake-pool-id", stakePoolIdNewSpo
, "--vrf-signing-key-file", vrfSkey
Expand Down Expand Up @@ -319,7 +319,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \
H.byDeadlineM 5 leadershipScheduleDeadline "Failed to query for leadership schedule" $ do
void $ execCli' execConfig
[ "query", "leadership-schedule"
[ "latest", "query", "leadership-schedule"
, "--genesis", shelleyGenesisFile tr
, "--stake-pool-id", stakePoolIdNewSpo
, "--vrf-signing-key-file", vrfSkey
Expand Down
Loading

0 comments on commit de80b7a

Please sign in to comment.