diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index f01eb46d08e..a9d22c097a5 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -82,7 +82,7 @@ library -- IOG dependencies -------------------------- build-depends: - , cardano-api ^>=10.19 + , cardano-api ^>=10.20 , plutus-ledger-api ^>=1.53 , plutus-tx ^>=1.53 , plutus-tx-plugin ^>=1.53 diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 5beffe64a9d..cae0f4170cb 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -111,7 +111,7 @@ library , attoparsec-aeson , base16-bytestring , bytestring - , cardano-api ^>= 10.19 + , cardano-api ^>= 10.20 , cardano-binary , cardano-cli ^>= 10.13 , cardano-crypto-class diff --git a/cabal.project b/cabal.project index 3ef2447a9db..00fca5a93ec 100644 --- a/cabal.project +++ b/cabal.project @@ -72,3 +72,21 @@ if impl (ghc >= 9.12) -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. + + + +source-repository-package + type: git + location: https://github.com/IntersectMBO/cardano-api.git + tag: f6b3fdf064d626ca94a77883f4a5b8a0a0597608 + --sha256: sha256-Xmni6Kal8fE77ul7HjFB0bvJRZHr07bjiJ4zrkrcMVU= + subdir: cardano-api + + + +source-repository-package + type: git + location: https://github.com/IntersectMBO/cardano-cli.git + tag: e4e1025f163dbb197a9942416bdcde3807df8525 + --sha256: sha256-+uS6wo+lfYkfZLAz6A7QIFZCiLezMOkRqTEdTrUGMdM= + subdir: cardano-cli \ No newline at end of file diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index 8eac42d6384..f8c5f253987 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -138,7 +138,7 @@ library , async , base16-bytestring , bytestring - , cardano-api ^>= 10.19 + , cardano-api ^>= 10.20 , cardano-crypto-class ^>=2.2.3.2 , cardano-crypto-wrapper , cardano-git-rev ^>=0.2.2 diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index 9e9cc03aba1..e7c590794df 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -39,7 +39,7 @@ library , aeson , async , bytestring - , cardano-api ^>= 10.19 + , cardano-api ^>= 10.20 , cardano-binary , cardano-cli ^>= 10.13 , cardano-crypto-class ^>=2.2.3.2 diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index c7238d39b58..6a20206b928 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -41,7 +41,7 @@ library , annotated-exception , ansi-terminal , bytestring - , cardano-api ^>= 10.19 + , cardano-api ^>= 10.20 , cardano-cli:{cardano-cli, cardano-cli-test-lib} ^>= 10.13 , cardano-crypto-class ^>=2.2.3.2 , cardano-crypto-wrapper diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/CostCalculation.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/CostCalculation.hs index 27f8db29252..5df80f590ab 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/CostCalculation.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/CostCalculation.hs @@ -8,14 +8,13 @@ module Cardano.Testnet.Test.Cli.Plutus.CostCalculation , hprop_included_plutus_cost_calculation , hprop_included_simple_script_cost_calculation -- | Execute tests in this module with: - -- @DISABLE_RETRIES=1 cabal run cardano-testnet-test -- -p "/Spec.hs.Spec.Ledger Events.Plutus.Cost Calc/"@ + -- @DISABLE_RETRIES=1 cabal test cardano-testnet-test -- -p "/Spec.hs.Spec.Ledger Events.Plutus.Cost Calc/"@ ) where import Cardano.Api hiding (Value) import Cardano.Api.Experimental (Some (Some)) import Cardano.Api.Ledger (EpochInterval (..)) - import Cardano.Testnet import Prelude @@ -37,6 +36,7 @@ import qualified System.Info as SYS import Testnet.Components.Query (findLargestUtxoForPaymentKey, getEpochStateView, getTxIx, watchEpochStateUpdate) +import qualified Testnet.Defaults as Defaults import Testnet.Process.Cli.Transaction (TxOutAddress (..), mkSpendOutputsOnlyTx, retrieveTransactionId, signTx, submitTx) import Testnet.Process.Run (execCli', mkExecConfig) @@ -53,7 +53,7 @@ import qualified Hedgehog.Extras.Test.File as H import qualified Hedgehog.Extras.Test.Golden as H import qualified Hedgehog.Extras.Test.TestWatchdog as H --- @DISABLE_RETRIES=1 cabal run cardano-testnet-test -- -p "/Spec.hs.Spec.Ledger Events.Plutus.Cost Calc.Ref Script/"@ +-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Ref Script/"'@ hprop_ref_plutus_cost_calculation :: Property hprop_ref_plutus_cost_calculation = integrationRetryWorkspace 2 "ref-plutus-script" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do H.note_ SYS.os @@ -145,7 +145,16 @@ hprop_ref_plutus_cost_calculation = integrationRetryWorkspace 2 "ref-plutus-scri refScriptUnlock <- H.createDirectoryIfMissing $ work "ref-script-unlock" let unsignedUnlockTx = File $ refScriptUnlock "unsigned-tx.tx" largestUTxO <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 - + refScriptHash <- execCli' execConfig [ eraName, "transaction", "policyid", "--script-file", unFile plutusV3Script] + H.note_ $ "Reference script hash: " <> refScriptHash + + void $ execCli' execConfig + [ eraName, "query", "utxo" + , "--whole-utxo" + , "--cardano-mode" + , "--out-file", work "utxo-1.json" + ] + H.cat $ work "utxo-1.json" void $ execCli' execConfig @@ -201,7 +210,7 @@ hprop_ref_plutus_cost_calculation = integrationRetryWorkspace 2 "ref-plutus-scri H.diffVsGoldenFile output "test/cardano-testnet-test/files/calculatePlutusScriptCost.json" --- @DISABLE_RETRIES=1 cabal run cardano-testnet-test -- -p "/Spec.hs.Spec.Ledger Events.Plutus.Cost Calc.Normal Script/"@ +-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Spec.hs.Spec.Ledger Events.Plutus.Cost Calc.Normal Script/"'@ hprop_included_plutus_cost_calculation :: Property hprop_included_plutus_cost_calculation = integrationRetryWorkspace 2 "included-plutus-script" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do H.note_ SYS.os @@ -231,8 +240,12 @@ hprop_included_plutus_cost_calculation = integrationRetryWorkspace 2 "included-p epochStateView <- getEpochStateView configurationFile (nodeSocketPath poolNode1) includedScriptLockWork <- H.createDirectoryIfMissing $ work "included-script-lock" - plutusV3Script <- - File <$> liftIOAnnotated (makeAbsolute "test/cardano-testnet-test/files/plutus/v3/always-succeeds.plutus") + + plutusScriptFp <- H.note $ work "always-succeeds-script.plutusV3" + H.writeFile plutusScriptFp $ Text.unpack Defaults.plutusV3Script + + --_plutusV3Script <- + -- File <$> liftIOAnnotated (makeAbsolute "test/cardano-testnet-test/files/plutus/v3/always-succeeds.plutus") let includedScriptLockAmount = 10_000_000 enoughAmountForFees = 2_000_000 -- Needs to be more than min ada @@ -246,7 +259,7 @@ hprop_included_plutus_cost_calculation = integrationRetryWorkspace 2 "included-p includedScriptLockWork "tx-body" wallet0 - [(ScriptAddress plutusV3Script, includedScriptLockAmount, Nothing)] + [(ScriptAddress $ File plutusScriptFp, includedScriptLockAmount, Nothing)] signedTxIncludedScriptLock <- signTx execConfig @@ -270,7 +283,8 @@ hprop_included_plutus_cost_calculation = integrationRetryWorkspace 2 "included-p includedScriptUnlock <- H.createDirectoryIfMissing $ work "included-script-unlock" let unsignedIncludedScript = File $ includedScriptUnlock "unsigned-tx.tx" newLargestUTxO <- findLargestUtxoForPaymentKey epochStateView sbe wallet1 - + scriptHash <- execCli' execConfig [ eraName, "transaction", "policyid", "--script-file", plutusScriptFp] + H.note_ $ "Script hash: " <> scriptHash void $ execCli' execConfig @@ -278,7 +292,7 @@ hprop_included_plutus_cost_calculation = integrationRetryWorkspace 2 "included-p , "transaction", "build" , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet1 , "--tx-in", prettyShow (TxIn txIdIncludedScriptLock txIxIncludedScriptLock) - , "--tx-in-script-file", unFile plutusV3Script + , "--tx-in-script-file", plutusScriptFp , "--tx-in-redeemer-value", "42" , "--tx-in-collateral", prettyShow newLargestUTxO , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet1) <> "+" <> show (unCoin (includedScriptLockAmount - enoughAmountForFees)) @@ -311,7 +325,7 @@ hprop_included_plutus_cost_calculation = integrationRetryWorkspace 2 "included-p (unFile includedScriptCostOutput) "test/cardano-testnet-test/files/calculatePlutusScriptCost.json" --- @DISABLE_RETRIES=1 cabal run cardano-testnet-test -- -p "/Spec.hs.Spec.Ledger Events.Plutus.Cost Calc.Simple Script/"@ +-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Spec.hs.Spec.Ledger Events.Plutus.Cost Calc.Simple Script/"'@ hprop_included_simple_script_cost_calculation :: Property hprop_included_simple_script_cost_calculation = integrationRetryWorkspace 2 "included-simple-script" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do H.note_ SYS.os diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/Scripts.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/Scripts.hs index 04af096fb13..ee923d9bfe7 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/Scripts.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Plutus/Scripts.hs @@ -44,7 +44,7 @@ import qualified Hedgehog.Extras as H -- Voting NO -- Proposing NO -- Execute me with: --- @DISABLE_RETRIES=1 cabal run cardano-testnet-test -- -p "/Spec.hs.Spec.Ledger Events.Plutus.Scripts/"@ +-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test -- -p "/PlutusV3 purposes/"@ hprop_plutus_purposes_v3 :: Property hprop_plutus_purposes_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath' @@ -190,11 +190,12 @@ hprop_plutus_purposes_v3 = integrationWorkspace "all-plutus-script-purposes" $ \ ] H.success - +-- TODO: Left off here. The transaction has a v3 script but you are reading a v2 script! +-- The hash is also different inside the transaction! -- | -- Execute me with: --- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/PlutusV2 Create transaction with two script certs/"'@ +-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/PlutusV2 transaction with two script certs/"'@ hprop_tx_two_script_certs_v2 :: Property hprop_tx_two_script_certs_v2 = integrationWorkspace "tx-2-script-certs" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath' @@ -229,7 +230,7 @@ hprop_tx_two_script_certs_v2 = integrationWorkspace "tx-2-script-certs" $ \tempA txin <- T.unpack . renderTxIn <$> findLargestUtxoForPaymentKey epochStateView sbe wallet0 plutusScript <- H.note $ work "always-succeeds-script.plutusV2" - H.writeFile plutusScript $ T.unpack plutusV2StakeScript + H.writeFile plutusScript $ T.unpack plutusV3Script scriptStakeRegistrationCertificate <- H.note $ work "script-stake-registration-certificate" @@ -257,7 +258,9 @@ hprop_tx_two_script_certs_v2 = integrationWorkspace "tx-2-script-certs" $ \tempA let txbody = work "two-certs-tx-body" tx = work "two-certs-tx" txout = mconcat [ utxoAddr, "+", show @Int 2_000_000 ] - + + s <- execCli' execConfig [anyEraToString anyEra, "transaction", "policyid", "--script-file", plutusScript] + H.note_ $ "Script hash: " <> s let txBuildArgs = [ anyEraToString anyEra, "transaction", "build" , "--change-address", T.unpack $ paymentKeyInfoAddr wallet0 diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs index 6b7ed5028c2..2ee101ed924 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/CommitteeAddNew.hs @@ -131,6 +131,7 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co createStakeKeyRegistrationCertificate tempAbsPath (AnyShelleyBasedEra sbe) (verificationKey stakeKeys) keyDeposit stakeCertFp + stakeCertTxBodyFp <- H.note $ work "stake.registration.txbody" stakeCertTxSignedFp <- H.note $ work "stake.registration.tx" @@ -153,14 +154,20 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co , "--signing-key-file", signingKeyFp stakeKeys , "--out-file", stakeCertTxSignedFp ] + -- TODO: Left off here. No certificate was in transaction! + stakeCertTx <- execCli' execConfig + ["debug", "transaction" + , "view", "--output-json", "--tx-body-file", stakeCertTxBodyFp + ] + H.note_ $ "Stake registration transaction: " <> stakeCertTx void $ execCli' execConfig [ eraName, "transaction", "submit" , "--tx-file", stakeCertTxSignedFp ] -- make sure that stake registration cert gets into a block - _ <- waitForBlocks epochStateView 1 + _ <- waitForBlocks epochStateView 15 minGovActDeposit <- getMinGovActionDeposit epochStateView ceo @@ -187,6 +194,20 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co txbodyFp <- H.note $ work "tx.body" txin1' <- findLargestUtxoForPaymentKey epochStateView sbe wallet0 + + + void $ execCli' execConfig + [ eraName, "stake-address", "key-hash" + , "--stake-verification-key-file", verificationKeyFp stakeKeys + , "--out-file", gov "stake-hash.addr" + ] + + stakeKeyHash <- H.readFile $ gov "stake-hash.addr" + + H.note_ $ "Stake key hash:" <> stakeKeyHash + + + -- Create temporary HTTP server with files required by the call to `cardano-cli` -- In this case, the server emulates an IPFS gateway serveFilesWhile