Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Upgraded to a cardano-wallet compatible with node 1.35.3-rc1 (#657)
Browse files Browse the repository at this point in the history
* Reorganized dependencies based on cardano-wallet's cabal.project

* Added the new 'protocolParamUTxOCostPerByte' in 'Ledger.Params' which replaces 'protocolParamUTxOCostPerWord'

* Fixed the `Plutus.Contract.Wallet.mkMintingRedeemers` which triggered an error if the redeemers in the tx contained spending redeemers.
  • Loading branch information
koslambrou authored Aug 12, 2022
1 parent 566323c commit af566dd
Show file tree
Hide file tree
Showing 12 changed files with 234 additions and 218 deletions.
392 changes: 197 additions & 195 deletions cabal.project

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions nix/pkgs/haskell/sha256map.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"https://github.com/Quid2/flat"."ee59880f47ab835dbd73bea0847dab7869fc20d8" = "1lrzknw765pz2j97nvv9ip3l1mcpf2zr4n56hwlz0rk7wq7ls4cm";
"https://github.com/input-output-hk/ekg-forward"."297cd9db5074339a2fb2e5ae7d0780debb670c63" = "1zcwry3y5rmd9lgxy89wsb3k4kpffqji35dc7ghzbz603y1gy24g";
"https://github.com/input-output-hk/cardano-addresses"."b6f2f3cef01a399376064194fd96711a5bdba4a7" = "10yj47gay72kx6v564qlfiigggcpqfdzrg61ii8p25m5n8ijz045";
"https://github.com/input-output-hk/cardano-addresses"."b7273a5d3c21f1a003595ebf1e1f79c28cd72513" = "129r5kyiw10n2021bkdvnr270aiiwyq58h472d151ph0r7wpslgp";
"https://github.com/input-output-hk/cardano-base"."0f3a867493059e650cda69e20a5cbf1ace289a57" = "0p0az3sbkhb7njji8xxdrfb0yx2gc8fmrh872ffm8sfip1w29gg1";
"https://github.com/input-output-hk/cardano-config"."1646e9167fab36c0bff82317743b96efa2d3adaa" = "sha256-TNbpnR7llUgBN2WY7CryMxNVupBIUH01h1hRNHoxboY=";
"https://github.com/input-output-hk/cardano-crypto"."f73079303f663e028288f9f4a9e08bcca39a923e" = "1n87i15x54s0cjkh3nsxs4r1x016cdw1fypwmr68936n3xxsjn6q";
"https://github.com/input-output-hk/cardano-ledger"."c7c63dabdb215ebdaed8b63274965966f2bf408f" = "sha256-zTQbMOGPD1Oodv6VUsfF6NUiXkbN8SWI98W3Atv4wbI=";
"https://github.com/input-output-hk/cardano-node"."1.35.3-rc1" = "01a5qdrmsag18s2mlf8axfbrag59j2fp6xyc89pwmzgs7x77ldsr";
"https://github.com/input-output-hk/cardano-node"."1.35.3-rc1" = "020fwimsm24yblr1fmnwx240wj8r3x715p89cpjgnnd8axwf32p0";
"https://github.com/input-output-hk/cardano-prelude"."bb4ed71ba8e587f672d06edf9d2e376f4b055555" = "00h10l5mmiza9819p9v5q5749nb9pzgi20vpzpy1d34zmh6gf1cj";
"https://github.com/input-output-hk/cardano-wallet"."5c77b286a412fb3795bdf8755888d0c4236d648c" = "sha256-lxpPV7TG40ilCaQzKBc+DqXPABTjkHJGxAo+TCLmNLk=";
"https://github.com/input-output-hk/cardano-wallet"."18a931648550246695c790578d4a55ee2f10463e" = "0i40hp1mdbljjcj4pn3n6zahblkb2jmpm8l4wnb36bya1pzf66fx";
"https://github.com/input-output-hk/goblins"."cde90a2b27f79187ca8310b6549331e59595e7ba" = "17c88rbva3iw82yg9srlxjv2ia5wjb9cyqw44hik565f5v9svnyg";
"https://github.com/input-output-hk/hedgehog-extras"."967d79533c21e33387d0227a5f6cc185203fe658" = "0rbqb7a64aya1qizlr3im06hdydg9zr6sl3i8bvqqlf7kpa647sd";
"https://github.com/input-output-hk/hedgehog-extras"."714ee03a5a786a05fc57ac5d2f1c2edce4660d85" = "1qa4mm36xynaf17990ijmzww0ij8hjrc0vw5nas6d0zx6q9hb978";
"https://github.com/input-output-hk/iohk-monitoring-framework"."066f7002aac5a0efc20e49643fea45454f226caa" = "0s6x4in11k5ba7nl7la896g28sznf9185xlqg9c604jqz58vj9nj";
"https://github.com/input-output-hk/io-sim"."57e888b1894829056cb00b7b5785fdf6a74c3271" = "sha256-TviSvCBEYtlKEo9qJmE8pCE25nMjDi8HeIAFniunaM8=";
"https://github.com/input-output-hk/optparse-applicative"."7497a29cb998721a9068d5725d49461f2bba0e7a" = "1gvsrg925vynwgqwplgjmp53vj953qyh3wbdf34pw21c8r47w35r";
"https://github.com/input-output-hk/ouroboros-network"."cb9eba406ceb2df338d8384b35c8addfe2067201" = "066llskxzjgcs13lwlvklb28azb9kd9b77j61x8fvrj1rlf5njfw";
"https://github.com/input-output-hk/plutus"."a56c96598b4b25c9e28215214d25189331087244" = "sha256-coD/Kpl7tutwXb6ukQCH5XojBjquYkW7ob0BWZtdpok=";
"https://github.com/input-output-hk/purescript-bridge"."47a1f11825a0f9445e0f98792f79172efef66c00" = "0da1vn2l6iyfxcjk58qal1l4755v92zi6yppmjmqvxf1gacyf9px";
"https://github.com/input-output-hk/quickcheck-dynamic"."c272906361471d684440f76c297e29ab760f6a1e" = "sha256-TioJQASNrQX6B3n2Cv43X2olyT67//CFQqcpvNW7N60=";
"https://github.com/input-output-hk/servant-purescript"."44e7cacf109f84984cd99cd3faf185d161826963" = "10pb0yfp80jhb9ryn65a4rha2lxzsn2vlhcc6xphrrkf4x5lhzqc";
"https://github.com/input-output-hk/typed-protocols"."181601bc3d9e9d21a671ce01e0b481348b3ca104" = "sha256-5Wof5yTKb12EPY6B8LfapX18xNZZpF+rvhnQ88U6KdM=";
"https://github.com/input-output-hk/Win32-network"."3825d3abf75f83f406c1f7161883c438dac7277d" = "19wahfv726fa3mqajpqdqhnl9ica3xmf68i254q45iyjcpj1psqx";
"https://github.com/Quid2/flat"."ee59880f47ab835dbd73bea0847dab7869fc20d8" = "1lrzknw765pz2j97nvv9ip3l1mcpf2zr4n56hwlz0rk7wq7ls4cm";
"https://github.com/vshabanov/ekg-json"."00ebe7211c981686e65730b7144fbf5350462608" = "sha256-VT8Ur585TCn03P2TVi6t92v2Z6tl8vKijICjse6ocv8=";
"https://github.com/raduom/hysterical-screams"."4c523469e9efd3f0d10d17da3304923b7b0e0674" = "0w118v4vffrsjxfmwfv8qcn2qxmxpd1gxwcjnda91qz09jnpg0vp";
"https://github.com/input-output-hk/quickcheck-dynamic"."c272906361471d684440f76c297e29ab760f6a1e" = "sha256-TioJQASNrQX6B3n2Cv43X2olyT67//CFQqcpvNW7N60=";
"https://github.com/sevanspowell/hw-aeson"."b5ef03a7d7443fcd6217ed88c335f0c411a05408" = "1dwx90wqavdl4d0npbzbxyh2pzi9zs1qz7nvsrb3n1cm2xbv4i5z";
"https://github.com/vshabanov/ekg-json"."00ebe7211c981686e65730b7144fbf5350462608" = "sha256-VT8Ur585TCn03P2TVi6t92v2Z6tl8vKijICjse6ocv8=";
}
11 changes: 7 additions & 4 deletions plutus-contract/src/Plutus/Contract/Wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import Data.Aeson.Types (Parser, parseFail)
import Data.Bifunctor (first)
import Data.Map (Map)
import Data.Map qualified as Map
import Data.Maybe (mapMaybe)
import Data.Maybe (catMaybes, mapMaybe)
import Data.OpenApi qualified as OpenApi
import Data.Semigroup qualified as Semigroup
import Data.Set qualified as Set
Expand Down Expand Up @@ -288,9 +288,12 @@ mkSpendingRedeemers P.Tx{P.txInputs} = fmap join (traverse extract txInputs) whe
extract _ = pure []

mkMintingRedeemers :: P.Tx -> Either CardanoAPI.ToCardanoError [ExportTxRedeemer]
mkMintingRedeemers P.Tx{P.txRedeemers, P.txMintScripts} = traverse extract $ Map.toList txRedeemers where
mkMintingRedeemers P.Tx{P.txRedeemers, P.txMintScripts} =
catMaybes <$> traverse extract (Map.toList txRedeemers)
where
indexedMintScriptHashes = Map.fromList $ zip [0..] $ Map.keys txMintScripts
extract (PV1.RedeemerPtr PV1.Mint idx, redeemer) = do
redeemerPolicyId <- maybe (Left CardanoAPI.MissingMintingPolicy) Right (Map.lookup idx indexedMintScriptHashes)
pure MintingRedeemer{redeemer, redeemerPolicyId}
extract (PV1.RedeemerPtr tag _, _) = Left (CardanoAPI.ScriptPurposeNotSupported tag)
pure $ Just MintingRedeemer{redeemer, redeemerPolicyId}
-- Some other redeemer (like a spending redeemer) which is ignored
extract (PV1.RedeemerPtr _ _, _) = pure Nothing
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Hedgehog.Extras.Test.Process qualified as H
import System.Info qualified as SYS
import Test.Base qualified as H
import Test.Process qualified as H
import Test.Runtime qualified as H
import Testnet.Cardano (TestnetOptions (..), TestnetRuntime (..), defaultTestnetOptions, testnet)
import Testnet.Cardano qualified as TC
import Testnet.Conf qualified as H
Expand Down Expand Up @@ -77,7 +78,7 @@ hprop_plutus_certifying_withdrawing = H.integration . H.runFinallies . H.workspa

execConfig <- H.noteShow H.ExecConfig
{ H.execConfigEnv = Last $ Just $
[ ("CARDANO_NODE_SOCKET_PATH", IO.sprocketArgumentName $ head $ TC.bftSprockets tr)
[ ("CARDANO_NODE_SOCKET_PATH", IO.sprocketArgumentName $ head $ H.bftSprockets tr)
]
-- The environment must be passed onto child process on Windows in order to
-- successfully start that process.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import Hedgehog.Extras.Test.Process qualified as H
import System.Directory qualified as IO
import Test.Base qualified as H
import Test.Process qualified as H
import Testnet.Cardano (TestnetRuntime (..), bftSprockets, defaultTestnetOptions, testnet)
import Test.Runtime qualified as H
import Testnet.Cardano (TestnetRuntime (..), defaultTestnetOptions, testnet)
import Testnet.Conf qualified as H

{- HLINT ignore "Redundant <&>" -}
Expand Down Expand Up @@ -69,7 +70,7 @@ hprop_plutus_script_context_equality = H.integration . H.runFinallies . H.worksp

execConfig <- H.noteShow H.ExecConfig
{ H.execConfigEnv = Last $ Just $
[ ("CARDANO_NODE_SOCKET_PATH", IO.sprocketArgumentName $ head $ bftSprockets tr)
[ ("CARDANO_NODE_SOCKET_PATH", IO.sprocketArgumentName $ head $ H.bftSprockets tr)
]
-- The environment must be passed onto child process on Windows in order to
-- successfully start that process.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import System.FilePath ((</>))
import Test.Base qualified as H
import Test.Process (execCreateScriptContext, execCreateScriptContext')
import Test.Process qualified as H
import Testnet.Cardano (bftSprockets, defaultTestnetOptions, testnet)
import Test.Runtime qualified as H
import Testnet.Cardano (defaultTestnetOptions, testnet)
import Testnet.Cardano qualified as TC
import Testnet.Conf qualified as H

Expand All @@ -59,7 +60,7 @@ hprop_plutus_script_context_mint_equality = H.integration . H.runFinallies . H.w

execConfig <- H.noteShow H.ExecConfig
{ H.execConfigEnv = Last $ Just $
[ ("CARDANO_NODE_SOCKET_PATH", IO.sprocketArgumentName $ head $ bftSprockets tr)
[ ("CARDANO_NODE_SOCKET_PATH", IO.sprocketArgumentName $ head $ H.bftSprockets tr)
]
-- The environment must be passed onto child process on Windows in order to
-- successfully start that process.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import System.Directory qualified as IO
import System.Environment qualified as IO
import Test.Base qualified as H
import Test.Process qualified as H
import Test.Runtime qualified as H
import Testnet.Cardano qualified as H
import Testnet.Conf qualified as H

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import System.Directory qualified as IO
import System.Environment qualified as IO
import Test.Base qualified as H
import Test.Process qualified as H
import Test.Runtime qualified as H
import Testnet.Cardano qualified as H
import Testnet.Conf qualified as H

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import System.Environment qualified as IO
import Test.Base qualified as Test
import Test.Process qualified as H
import Test.Process qualified as Test
import Test.Runtime qualified as H
import Testnet.Cardano qualified as TN
import Testnet.Conf qualified as TN
import Testnet.SubmitApi qualified as TN
Expand Down Expand Up @@ -73,7 +74,7 @@ prop_submit_api_spending_plutus_script = Test.integration . HE.runFinallies . HE

execConfig <- H.noteShow H.ExecConfig
{ H.execConfigEnv = Last $ Just $
[ ("CARDANO_NODE_SOCKET_PATH", IO.sprocketArgumentName $ head $ TN.bftSprockets tr)
[ ("CARDANO_NODE_SOCKET_PATH", IO.sprocketArgumentName $ head $ H.bftSprockets tr)
]
-- The environment must be passed onto child process on Windows in order to
-- successfully start that process.
Expand All @@ -96,7 +97,7 @@ prop_submit_api_spending_plutus_script = Test.integration . HE.runFinallies . HE
{ TN.tempBaseAbsPath
, TN.base
, TN.configFile = submitApiConfigFile
, TN.sprocket = head $ TN.bftSprockets tr
, TN.sprocket = head $ H.bftSprockets tr
, TN.testnetMagic
, TN.stdoutFile = submitApiStdoutFile
, TN.stderrFile = submitApiStderrFile
Expand Down
6 changes: 5 additions & 1 deletion plutus-ledger/src/Ledger/Params.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Cardano.Api.Shelley (AnyPlutusScriptVersion (..), CostModel (..), EpochNo
PlutusScriptVersion (..), ProtocolParameters (..), shelleyGenesisDefaults)
import Cardano.Ledger.Babbage (BabbageEra)
import Cardano.Ledger.Babbage.PParams (retractPP)
import Cardano.Ledger.Babbage.Translation (coinsPerUTxOWordToCoinsPerUTxOByte)
import Cardano.Ledger.BaseTypes (boundRational)
import Cardano.Ledger.Core (PParams)
import Cardano.Ledger.Crypto (StandardCrypto)
Expand Down Expand Up @@ -91,7 +92,7 @@ instance Default ProtocolParameters where
, protocolParamPoolPledgeInfluence = 3 % 10
, protocolParamMonetaryExpansion = 3 % 1000
, protocolParamTreasuryCut = 1 % 5
, protocolParamUTxOCostPerWord = Just (Lovelace 34482)
, protocolParamUTxOCostPerWord = Nothing -- Obsolete from babbage onwards
, protocolParamCostModels = fromList
[ (AnyPlutusScriptVersion PlutusScriptV1, CostModel $ fromMaybe (error "Ledger.Params: defaultCostModelParams is broken") defaultCostModelParams)
, (AnyPlutusScriptVersion PlutusScriptV2, CostModel $ fromMaybe (error "Ledger.Params: defaultCostModelParams is broken") defaultCostModelParams) ]
Expand All @@ -101,6 +102,9 @@ instance Default ProtocolParameters where
, protocolParamMaxValueSize = Just 5000
, protocolParamCollateralPercent = Just 150
, protocolParamMaxCollateralInputs = Just 3
, protocolParamUTxOCostPerByte =
let (Coin coinsPerUTxOByte) = coinsPerUTxOWordToCoinsPerUTxOByte $ Coin 34482
in Just $ Lovelace coinsPerUTxOByte
}


Expand Down
3 changes: 1 addition & 2 deletions plutus-pab/src/Plutus/PAB/LocalCluster/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,12 @@ runWith userContractHandler = withLocalClusterSetup $ \dir lo@LogOutputs{loClust
<$> getEKGURL

void $ serveWallet
(NodeSource socketPath vData)
(NodeSource socketPath vData (SyncTolerance 10))
gp
tunedForMainnetPipeliningStrategy
(SomeNetworkDiscriminant $ Proxy @'Mainnet)
poolCertificates
tracers
(SyncTolerance 10)
(Just db)
Nothing
(fromString walletHost)
Expand Down
5 changes: 3 additions & 2 deletions plutus-use-cases/scripts/protocol-parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"txFeePerByte": 44,
"minUTxOValue": null,
"stakePoolDeposit": 500000000,
"utxoCostPerWord": 1,
"utxoCostPerWord": null,
"utxoCostPerByte": 4311,
"decentralization": 0.6,
"poolRetireMaxEpoch": 18,
"extraPraosEntropy": null,
Expand Down Expand Up @@ -205,4 +206,4 @@
"denominator": 1
}
}
}
}

0 comments on commit af566dd

Please sign in to comment.