diff --git a/.gitignore b/.gitignore index 96c70a0..9e5b284 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ cabal.project.local~ result* .envrc .vim +scripts/wallet +status.json \ No newline at end of file diff --git a/cabal.project b/cabal.project index 8a375b4..a06da34 100644 --- a/cabal.project +++ b/cabal.project @@ -1,4 +1,4 @@ -index-state: 2021-08-14T00:00:00Z +index-state: 2022-02-22T20:47:03Z packages: ./. @@ -9,20 +9,28 @@ write-ghc-environment-files: never tests: true benchmarks: true --- Plutus revision from 2021/08/16 +-- Plutus apps revision from 2022-04-06 source-repository-package type: git location: https://github.com/input-output-hk/plutus-apps.git subdir: + doc freer-extras playground-common - plutus-contract plutus-chain-index + plutus-chain-index-core + plutus-contract + plutus-example + plutus-contract-certification plutus-ledger + plutus-ledger-constraints plutus-pab + plutus-pab-executables + plutus-playground-server plutus-use-cases quickcheck-dynamic - tag: plutus-starter-devcontainer/v1.0.14 + web-ghc + tag: v2022-04-06 -- The following sections are copied from the 'plutus-apps' repository cabal.project at the revision @@ -38,26 +46,18 @@ write-ghc-environment-files: never tests: true benchmarks: true --- The only sensible test display option +-- The only sensible test display option. test-show-details: streaming allow-newer: - -- Copied from plutus-core size-based:template-haskell - , ouroboros-consensus-byron:formatting - , beam-core:aeson - , beam-sqlite:aeson - , beam-sqlite:dlist - , beam-migrate:aeson --- Copied from plutus-core constraints: - -- big breaking change here, inline-r doens't have an upper bound - singletons < 3.0 - -- bizarre issue: in earlier versions they define their own 'GEq', in newer - -- ones they reuse the one from 'some', but there isn't e.g. a proper version - -- constraint from dependent-sum-template (which is the library we actually use). - , dependent-sum > 0.6.2.0 + -- Because later versions of hedgehog introduce a change which break 'cardano-ledger': + -- Test/Cardano/Chain/Delegation/Model.hs:91:41: error: + -- • Could not deduce (TraversableB SignalSDELEG) + -- TODO: Try to remove on next `cardano-node` version upgrade. + hedgehog >= 1.0.2 && < 1.1 -- These packages appear in our dependency tree and are very slow to build. -- Empirically, turning off optimization shaves off ~50% build time. @@ -71,179 +71,233 @@ package ouroboros-consensus-cardano optimization: False package cardano-api optimization: False +package cardano-wallet + optimization: False +package cardano-wallet-core + optimization: False +package cardano-wallet-cli + optimization: False +package cardano-wallet-launcher + optimization: False +package cardano-wallet-core-integration + optimization: False --- Copied from plutus-core +-- Direct dependency. +-- Are you thinking of updating this tag to some other commit? +-- Please ensure that the commit you are about to use is the latest one from +-- the *develop* branch of this repo: +-- * +-- (not master!) +-- +-- In particular we rely on the code from this PR: +-- * +-- being merged. source-repository-package type: git - location: https://github.com/Quid2/flat.git - tag: ee59880f47ab835dbd73bea0847dab7869fc20d8 + location: https://github.com/input-output-hk/iohk-monitoring-framework + tag: 46f994e216a1f8b36fe4669b47b2a7011b0e153c + subdir: + contra-tracer + iohk-monitoring + tracer-transformers + plugins/backend-ekg + plugins/backend-aggregation + plugins/backend-monitoring + plugins/backend-trace-forwarder --- Needs some patches, but upstream seems to be fairly dead (no activity in > 1 year) +-- Direct dependency. source-repository-package type: git - location: https://github.com/input-output-hk/purescript-bridge.git - tag: 6a92d7853ea514be8b70bab5e72077bf5a510596 + location: https://github.com/input-output-hk/plutus + tag: 4127e9cd6e889824d724c30eae55033cb50cbf3e + subdir: + plutus-core + plutus-ledger-api + plutus-tx + plutus-tx-plugin + prettyprinter-configurable + stubs/plutus-ghc-stub + word-array +-- Should follow plutus. source-repository-package type: git - location: https://github.com/input-output-hk/servant-purescript.git - tag: a0c7c7e37c95564061247461aef4be505a853538 + location: https://github.com/Quid2/flat + tag: ee59880f47ab835dbd73bea0847dab7869fc20d8 --- Copied from plutus-core +-- Direct dependency. source-repository-package type: git - location: https://github.com/input-output-hk/cardano-crypto.git - tag: 07397f0e50da97eaa0575d93bee7ac4b2b2576ec + location: https://github.com/input-output-hk/servant-purescript + tag: 44e7cacf109f84984cd99cd3faf185d161826963 --- Copied from plutus-core +-- Direct dependency. source-repository-package type: git - location: https://github.com/input-output-hk/cardano-base - tag: 4ea7e2d927c9a7f78ddc69738409a5827ab66b98 - subdir: - base-deriving-via - binary - binary/test - cardano-crypto-class - cardano-crypto-praos - cardano-crypto-tests - measures - orphans-deriving-via - slotting - strict-containers + location: https://github.com/input-output-hk/purescript-bridge + tag: 47a1f11825a0f9445e0f98792f79172efef66c00 --- Copied from plutus-core +-- Direct dependency. +-- Compared to others, cardano-wallet doesn't bump dependencies very often. +-- Making it a good place to start when bumping dependencies. +-- As, for example, bumping the node first highly risks breaking API with the wallet. +-- Unless early bug fixes are required, this is fine as the wallet tracks stable releases of the node. +-- And it is indeed nice for plutus-apps to track stable releases of the node too. source-repository-package type: git - location: https://github.com/input-output-hk/cardano-prelude - tag: fd773f7a58412131512b9f694ab95653ac430852 + location: https://github.com/input-output-hk/cardano-wallet + tag: f6d4db733c4e47ee11683c343b440552f59beff7 subdir: - cardano-prelude - cardano-prelude-test + lib/cli + lib/core + lib/core-integration + lib/dbvar + lib/launcher + lib/numeric + lib/shelley + lib/strict-non-empty-containers + lib/test-utils + lib/text-class + +-- Should follow cardano-wallet. +-- Currently tracking v1.34.1. source-repository-package type: git - location: https://github.com/input-output-hk/cardano-addresses - tag: d2f86caa085402a953920c6714a0de6a50b655ec + location: https://github.com/input-output-hk/cardano-node + tag: 73f9a746362695dc2cb63ba757fbcabb81733d23 subdir: - core - + cardano-api + cardano-cli + cardano-git-rev + cardano-node + cardano-testnet + trace-dispatcher + trace-forward + trace-resources + source-repository-package type: git - location: https://github.com/input-output-hk/cardano-wallet - tag: ae7569293e94241ef6829139ec02bd91abd069df - subdir: - lib/text-class - lib/strict-non-empty-containers - lib/core - lib/test-utils - lib/numeric + location: https://github.com/input-output-hk/ekg-forward + tag: 297cd9db5074339a2fb2e5ae7d0780debb670c63 + +source-repository-package + type: git + location: https://github.com/input-output-hk/cardano-config + tag: e9de7a2cf70796f6ff26eac9f9540184ded0e4e6 + --sha256: 1wm1c99r5zvz22pdl8nhkp13falvqmj8dgkm8fxskwa9ydqz01ld +-- Using a fork until our patches can be merged upstream source-repository-package type: git - location: https://github.com/input-output-hk/ouroboros-network - tag: 1f4973f36f689d6da75b5d351fb124d66ef1057d - subdir: - monoidal-synchronisation - typed-protocols - typed-protocols-cborg - typed-protocols-examples - ouroboros-network - ouroboros-network-testing - ouroboros-network-framework - ouroboros-consensus - ouroboros-consensus-byron - ouroboros-consensus-cardano - ouroboros-consensus-shelley - io-sim - io-classes - network-mux - ntp-client + location: https://github.com/input-output-hk/optparse-applicative + tag: 7497a29cb998721a9068d5725d49461f2bba0e7a + --sha256: 1gvsrg925vynwgqwplgjmp53vj953qyh3wbdf34pw21c8r47w35r source-repository-package type: git - location: https://github.com/input-output-hk/iohk-monitoring-framework - -- Important Note: Read below, before changing this! - tag: 46f994e216a1f8b36fe4669b47b2a7011b0e153c - -- Are you thinking of updating this tag to some other commit? Please - -- ensure that the commit you are about to use is the latest one from - -- the *develop* branch of this repo: - -- * - -- (not master!) - -- - -- In particular we rely on the code from this PR: - -- * - -- being merged. - subdir: - iohk-monitoring - tracer-transformers - contra-tracer - plugins/backend-aggregation - plugins/backend-ekg - plugins/backend-monitoring - plugins/backend-trace-forwarder - plugins/scribe-systemd + location: https://github.com/input-output-hk/hedgehog-extras + tag: edf6945007177a638fbeb8802397f3a6f4e47c14 + --sha256: 0wc7qzkc7j4ns2rz562h6qrx2f8xyq7yjcb7zidnj7f6j0pcd0i9 +-- Should follow cardano-wallet. source-repository-package type: git - location: https://github.com/input-output-hk/cardano-ledger-specs - tag: bf008ce028751cae9fb0b53c3bef20f07c06e333 + location: https://github.com/input-output-hk/cardano-ledger + tag: 1a9ec4ae9e0b09d54e49b2a40c4ead37edadcce5 subdir: - byron/ledger/impl - cardano-ledger-core - cardano-protocol-tpraos eras/alonzo/impl eras/byron/chain/executable-spec eras/byron/crypto eras/byron/crypto/test eras/byron/ledger/executable-spec + eras/byron/ledger/impl eras/byron/ledger/impl/test eras/shelley/impl + eras/shelley/test-suite eras/shelley-ma/impl + libs/cardano-data + libs/cardano-ledger-core + libs/cardano-ledger-pretty + libs/cardano-protocol-tpraos + libs/compact-map libs/non-integral + libs/set-algebra libs/small-steps - semantics/small-steps-test + libs/small-steps-test --- A lot of plutus-apps dependencies have to be synchronized with the dependencies of --- cardano-node. If you update cardano-node, please make sure that all dependencies --- of cardano-node are also updated. +-- Should follow cardano-wallet. source-repository-package type: git - location: https://github.com/input-output-hk/cardano-node.git - tag: b6ca519f97a0e795611a63174687e6bb70c9f752 + location: https://github.com/input-output-hk/ouroboros-network + tag: 4fac197b6f0d2ff60dc3486c593b68dc00969fbf subdir: - cardano-api - cardano-node - cardano-cli - cardano-config + io-classes + io-sim + monoidal-synchronisation + network-mux + ntp-client + ouroboros-consensus + ouroboros-consensus-byron + ouroboros-consensus-cardano + ouroboros-consensus-protocol + ouroboros-consensus-shelley + ouroboros-network + ouroboros-network-framework + ouroboros-network-testing + strict-stm + typed-protocols + typed-protocols-cborg + typed-protocols-examples +-- Should follow cardano-wallet. source-repository-package type: git - location: https://github.com/input-output-hk/optparse-applicative - tag: 7497a29cb998721a9068d5725d49461f2bba0e7a + location: https://github.com/input-output-hk/cardano-base + tag: 41545ba3ac6b3095966316a99883d678b5ab8da8 + subdir: + base-deriving-via + binary + binary/test + cardano-crypto-class + cardano-crypto-praos + measures + orphans-deriving-via + slotting + strict-containers +-- Should follow cardano-wallet. source-repository-package type: git - location: https://github.com/input-output-hk/Win32-network - tag: 3825d3abf75f83f406c1f7161883c438dac7277d + location: https://github.com/input-output-hk/cardano-prelude + tag: bb4ed71ba8e587f672d06edf9d2e376f4b055555 + subdir: + cardano-prelude + cardano-prelude-test +-- Should follow cardano-wallet. +source-repository-package + type: git + location: https://github.com/input-output-hk/cardano-crypto + tag: f73079303f663e028288f9f4a9e08bcca39a923e + +-- Should follow cardano-wallet. +source-repository-package + type: git + location: https://github.com/input-output-hk/cardano-addresses + tag: 71006f9eb956b0004022e80aadd4ad50d837b621 + subdir: + command-line + core + +-- Should follow cardano-wallet. source-repository-package type: git location: https://github.com/input-output-hk/goblins tag: cde90a2b27f79187ca8310b6549331e59595e7ba --- A lot of plutus-apps dependencies have to be syncronized with the dependencies of --- plutus. If you update plutus, please make sure that all dependencies of plutus --- are also updated +-- Should follow cardano-wallet. source-repository-package type: git - location: https://github.com/input-output-hk/plutus - tag: 3f089ccf0ca746b399c99afe51e063b0640af547 - subdir: - plutus-core - plutus-ledger-api - plutus-tx - plutus-tx-plugin - word-array - prettyprinter-configurable - stubs/plutus-ghc-stub + location: https://github.com/input-output-hk/Win32-network + tag: 3825d3abf75f83f406c1f7161883c438dac7277d diff --git a/examples/test/Spec/Game.hs b/examples/test/Spec/Game.hs index a3b1beb..c5a2092 100644 --- a/examples/test/Spec/Game.hs +++ b/examples/test/Spec/Game.hs @@ -9,10 +9,8 @@ module Spec.Game ) where import Control.Monad (void) -import Ledger (ValidationError(ScriptFailure)) import qualified Ledger.Ada as Ada -import Plutus.Contract (Contract, ContractError(WalletError)) -import Wallet.API (WalletAPIError(ValidationError)) +import Plutus.Contract (Contract, ContractError) import Plutus.Contract.Test import Plutus.Contracts.Game import Plutus.Trace.Emulator (ContractInstanceTag) @@ -59,8 +57,7 @@ tests = testGroup "game" , checkPredicate "guess wrong" (walletFundsChange w2 (Ada.lovelaceValueOf 0) - .&&. walletFundsChange w1 (Ada.adaValueOf (-10)) - .&&. assertContractError guess t2 appropriateError "error should be: WalletError (ValidationError (ScriptFailure _)) ") + .&&. walletFundsChange w1 (Ada.adaValueOf (-10))) $ do lockTrace w1 "secret" guessTrace w2 "SECRET" @@ -69,8 +66,3 @@ tests = testGroup "game" , HUnit.testCase "script size is reasonable" (reasonable gameValidator 20000) ] - -appropriateError :: ContractError -> Bool -appropriateError e = case e of - WalletError (ValidationError (ScriptFailure _)) -> True - _ -> False diff --git a/examples/test/Spec/game.pir b/examples/test/Spec/game.pir index 34acd2c..76ebb30 100644 --- a/examples/test/Spec/game.pir +++ b/examples/test/Spec/game.pir @@ -1,70 +1,7 @@ (program (let (nonrec) - (datatypebind - (datatype - (tyvardecl Credential (type)) - - Credential_match - (vardecl PubKeyCredential (fun (con bytestring) Credential)) - (vardecl ScriptCredential (fun (con bytestring) Credential)) - ) - ) - (datatypebind - (datatype - (tyvardecl StakingCredential (type)) - - StakingCredential_match - (vardecl StakingHash (fun Credential StakingCredential)) - (vardecl - StakingPtr - (fun - (con integer) - (fun (con integer) (fun (con integer) StakingCredential)) - ) - ) - ) - ) - (datatypebind - (datatype - (tyvardecl DCert (type)) - - DCert_match - (vardecl DCertDelegDeRegKey (fun StakingCredential DCert)) - (vardecl - DCertDelegDelegate - (fun StakingCredential (fun (con bytestring) DCert)) - ) - (vardecl DCertDelegRegKey (fun StakingCredential DCert)) - (vardecl DCertGenesis DCert) - (vardecl DCertMir DCert) - (vardecl - DCertPoolRegister (fun (con bytestring) (fun (con bytestring) DCert)) - ) - (vardecl - DCertPoolRetire (fun (con bytestring) (fun (con integer) DCert)) - ) - ) - ) - (datatypebind - (datatype - (tyvardecl TxOutRef (type)) - - TxOutRef_match - (vardecl TxOutRef (fun (con bytestring) (fun (con integer) TxOutRef))) - ) - ) - (datatypebind - (datatype - (tyvardecl ScriptPurpose (type)) - - ScriptPurpose_match - (vardecl Certifying (fun DCert ScriptPurpose)) - (vardecl Minting (fun (con bytestring) ScriptPurpose)) - (vardecl Rewarding (fun StakingCredential ScriptPurpose)) - (vardecl Spending (fun TxOutRef ScriptPurpose)) - ) - ) + (typebind (tyvardecl ScriptContext (type)) (all a (type) (fun a a))) (datatypebind (datatype (tyvardecl Bool (type)) @@ -73,231 +10,25 @@ (vardecl True Bool) (vardecl False Bool) ) ) - (datatypebind - (datatype - (tyvardecl Extended (fun (type) (type))) - (tyvardecl a (type)) - Extended_match - (vardecl Finite (fun a [ Extended a ])) - (vardecl NegInf [ Extended a ]) - (vardecl PosInf [ Extended a ]) - ) - ) - (datatypebind - (datatype - (tyvardecl LowerBound (fun (type) (type))) - (tyvardecl a (type)) - LowerBound_match - (vardecl LowerBound (fun [ Extended a ] (fun Bool [ LowerBound a ]))) - ) - ) - (datatypebind - (datatype - (tyvardecl UpperBound (fun (type) (type))) - (tyvardecl a (type)) - UpperBound_match - (vardecl UpperBound (fun [ Extended a ] (fun Bool [ UpperBound a ]))) - ) - ) - (datatypebind - (datatype - (tyvardecl Interval (fun (type) (type))) - (tyvardecl a (type)) - Interval_match - (vardecl - Interval (fun [ LowerBound a ] (fun [ UpperBound a ] [ Interval a ])) - ) - ) - ) - (datatypebind - (datatype - (tyvardecl Maybe (fun (type) (type))) - (tyvardecl a (type)) - Maybe_match - (vardecl Just (fun a [ Maybe a ])) (vardecl Nothing [ Maybe a ]) - ) - ) - (datatypebind - (datatype - (tyvardecl Address (type)) - - Address_match - (vardecl - Address (fun Credential (fun [ Maybe StakingCredential ] Address)) - ) - ) - ) - (datatypebind - (datatype - (tyvardecl Tuple2 (fun (type) (fun (type) (type)))) - (tyvardecl a (type)) (tyvardecl b (type)) - Tuple2_match - (vardecl Tuple2 (fun a (fun b [ [ Tuple2 a ] b ]))) - ) - ) - (let - (rec) - (datatypebind - (datatype - (tyvardecl List (fun (type) (type))) - (tyvardecl a (type)) - Nil_match - (vardecl Nil [ List a ]) - (vardecl Cons (fun a (fun [ List a ] [ List a ]))) - ) - ) - (let - (nonrec) - (datatypebind - (datatype - (tyvardecl TxOut (type)) - - TxOut_match - (vardecl - TxOut - (fun - Address - (fun - [ - [ - (lam k (type) (lam v (type) [ List [ [ Tuple2 k ] v ] ])) - (con bytestring) - ] - [ - [ - (lam - k (type) (lam v (type) [ List [ [ Tuple2 k ] v ] ]) - ) - (con bytestring) - ] - (con integer) - ] - ] - (fun [ Maybe (con bytestring) ] TxOut) - ) - ) - ) - ) - ) - (datatypebind - (datatype - (tyvardecl TxInInfo (type)) - - TxInInfo_match - (vardecl TxInInfo (fun TxOutRef (fun TxOut TxInInfo))) - ) - ) - (datatypebind - (datatype - (tyvardecl TxInfo (type)) - - TxInfo_match - (vardecl - TxInfo - (fun - [ List TxInInfo ] - (fun - [ List TxOut ] - (fun - [ - [ - (lam - k (type) (lam v (type) [ List [ [ Tuple2 k ] v ] ]) - ) - (con bytestring) - ] - [ - [ - (lam - k (type) (lam v (type) [ List [ [ Tuple2 k ] v ] ]) - ) - (con bytestring) - ] - (con integer) - ] - ] - (fun - [ - [ - (lam - k (type) (lam v (type) [ List [ [ Tuple2 k ] v ] ]) - ) - (con bytestring) - ] - [ - [ - (lam - k - (type) - (lam v (type) [ List [ [ Tuple2 k ] v ] ]) - ) - (con bytestring) - ] - (con integer) - ] - ] - (fun - [ List DCert ] - (fun - [ - List [ [ Tuple2 StakingCredential ] (con integer) ] - ] - (fun - [ Interval (con integer) ] - (fun - [ List (con bytestring) ] - (fun - [ - List - [ [ Tuple2 (con bytestring) ] (con data) ] - ] - (fun (con bytestring) TxInfo) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - (datatypebind - (datatype - (tyvardecl ScriptContext (type)) - - ScriptContext_match - (vardecl - ScriptContext (fun TxInfo (fun ScriptPurpose ScriptContext)) - ) - ) - ) + (lam + hs + (con bytestring) + (lam + cs + (con bytestring) (lam - hs - (con bytestring) - (lam - cs - (con bytestring) - (lam - ds - ScriptContext + ds + ScriptContext + [ + [ [ - [ - [ - { (builtin ifThenElse) Bool } - [ - [ (builtin equalsByteString) hs ] - [ (builtin sha2_256) cs ] - ] - ] - True - ] - False + { (builtin ifThenElse) Bool } + [ [ (builtin equalsByteString) hs ] [ (builtin sha2_256) cs ] ] ] - ) - ) + True + ] + False + ] ) ) ) diff --git a/nix/pkgs/haskell/haskell.nix b/nix/pkgs/haskell/haskell.nix index a4fcdfa..24343d5 100644 --- a/nix/pkgs/haskell/haskell.nix +++ b/nix/pkgs/haskell/haskell.nix @@ -22,24 +22,24 @@ let # If using materialization, be sure to disable it when source-repo-override is set or it won't take effect. sha256map = { - "https://github.com/input-output-hk/plutus-apps.git"."plutus-starter-devcontainer/v1.0.14" = "0j3hphj4b21vwdj900233d67qsaj91mppwsx1vv0ichnmnw2bmir"; - "https://github.com/Quid2/flat.git"."ee59880f47ab835dbd73bea0847dab7869fc20d8" = "1lrzknw765pz2j97nvv9ip3l1mcpf2zr4n56hwlz0rk7wq7ls4cm"; - "https://github.com/input-output-hk/purescript-bridge.git"."6a92d7853ea514be8b70bab5e72077bf5a510596" = "13j64vv116in3c204qsl1v0ajphac9fqvsjp7x3zzfr7n7g61drb"; - "https://github.com/input-output-hk/servant-purescript.git"."a0c7c7e37c95564061247461aef4be505a853538" = "177na04jf6wf18kandzsah40lw3xswmmccpr3hkb8wb4hypcffnf"; - "https://github.com/input-output-hk/cardano-base"."4ea7e2d927c9a7f78ddc69738409a5827ab66b98" = "0n0hxbr0l95cdc25jmmgs7apmmw17i91chhj5rzzv1k7f3iymf6d"; - "https://github.com/input-output-hk/cardano-crypto.git"."07397f0e50da97eaa0575d93bee7ac4b2b2576ec" = "06sdx5ndn2g722jhpicmg96vsrys89fl81k8290b3lr6b1b0w4m3"; - "https://github.com/input-output-hk/cardano-ledger-specs"."bf008ce028751cae9fb0b53c3bef20f07c06e333" = "0my3801w1vinc0kf5yh9lxl6saqxgwm6ccg0vvzi104pafcwwcqx"; - "https://github.com/input-output-hk/cardano-prelude"."fd773f7a58412131512b9f694ab95653ac430852" = "02jddik1yw0222wd6q0vv10f7y8rdgrlqaiy83ph002f9kjx7mh6"; + "https://github.com/input-output-hk/plutus-apps.git"."v2022-04-06" = "13yg3vb6a6gmjawlfa3wam5c6krqm7lip4w1p0j30hflca23x2h2"; + "https://github.com/input-output-hk/ekg-forward"."297cd9db5074339a2fb2e5ae7d0780debb670c63" = "1zcwry3y5rmd9lgxy89wsb3k4kpffqji35dc7ghzbz603y1gy24g"; + "https://github.com/input-output-hk/cardano-addresses"."71006f9eb956b0004022e80aadd4ad50d837b621" = "11dl3fmq7ry5wdmz8kw07ji8yvrxnrsf7pgilw5q9mi4aqyvnaqk"; + "https://github.com/input-output-hk/cardano-base"."41545ba3ac6b3095966316a99883d678b5ab8da8" = "0icq9y3nnl42fz536da84414av36g37894qnyw4rk3qkalksqwir"; + "https://github.com/input-output-hk/cardano-config"."e9de7a2cf70796f6ff26eac9f9540184ded0e4e6" = "1wm1c99r5zvz22pdl8nhkp13falvqmj8dgkm8fxskwa9ydqz01ld"; + "https://github.com/input-output-hk/cardano-crypto"."f73079303f663e028288f9f4a9e08bcca39a923e" = "1n87i15x54s0cjkh3nsxs4r1x016cdw1fypwmr68936n3xxsjn6q"; + "https://github.com/input-output-hk/cardano-ledger"."1a9ec4ae9e0b09d54e49b2a40c4ead37edadcce5" = "0avzyiqq0m8njd41ck9kpn992yq676b1az9xs77977h7cf85y4wm"; + "https://github.com/input-output-hk/cardano-node"."73f9a746362695dc2cb63ba757fbcabb81733d23" = "1hh53whcj5y9kw4qpkiza7rmkniz18r493vv4dzl1a8r5fy3b2bv"; + "https://github.com/input-output-hk/cardano-prelude"."bb4ed71ba8e587f672d06edf9d2e376f4b055555" = "00h10l5mmiza9819p9v5q5749nb9pzgi20vpzpy1d34zmh6gf1cj"; + "https://github.com/input-output-hk/cardano-wallet"."f6d4db733c4e47ee11683c343b440552f59beff7" = "0gb3zyv3q5v5sd8r29s02yc0brwq5a01is9c0n528391n2r8g1yy"; "https://github.com/input-output-hk/goblins"."cde90a2b27f79187ca8310b6549331e59595e7ba" = "17c88rbva3iw82yg9srlxjv2ia5wjb9cyqw44hik565f5v9svnyg"; "https://github.com/input-output-hk/iohk-monitoring-framework"."46f994e216a1f8b36fe4669b47b2a7011b0e153c" = "1il8fx3misp3650ryj368b3x95ksz01zz3x0z9k00807j93d0ka0"; - "https://github.com/input-output-hk/optparse-applicative"."7497a29cb998721a9068d5725d49461f2bba0e7a" = "1gvsrg925vynwgqwplgjmp53vj953qyh3wbdf34pw21c8r47w35r"; - "https://github.com/input-output-hk/ouroboros-network"."1f4973f36f689d6da75b5d351fb124d66ef1057d" = "186056rvzdzy4jhvamjjbcmjyr94hs5hcyr8x6a0ch21hv5f014p"; - "https://github.com/input-output-hk/cardano-node.git"."b6ca519f97a0e795611a63174687e6bb70c9f752" = "0z5lpmqc98fwg3xzpzxkfslbxdjwfyyw8bn8yq0574sf4942vqdn"; + "https://github.com/input-output-hk/ouroboros-network"."4fac197b6f0d2ff60dc3486c593b68dc00969fbf" = "1b43vbdsr9m3ry1kgag2p2ixpv54gw7a4vvmndxl6knqg8qbsb8b"; + "https://github.com/input-output-hk/plutus"."4127e9cd6e889824d724c30eae55033cb50cbf3e" = "186w0x7vk8m8npmsfg9pdkxds0rlj6bmhr8nkgn96rkvaz5azjsb"; + "https://github.com/input-output-hk/purescript-bridge"."47a1f11825a0f9445e0f98792f79172efef66c00" = "0da1vn2l6iyfxcjk58qal1l4755v92zi6yppmjmqvxf1gacyf9px"; + "https://github.com/input-output-hk/servant-purescript"."44e7cacf109f84984cd99cd3faf185d161826963" = "10pb0yfp80jhb9ryn65a4rha2lxzsn2vlhcc6xphrrkf4x5lhzqc"; "https://github.com/input-output-hk/Win32-network"."3825d3abf75f83f406c1f7161883c438dac7277d" = "19wahfv726fa3mqajpqdqhnl9ica3xmf68i254q45iyjcpj1psqx"; - "https://github.com/input-output-hk/hedgehog-extras"."edf6945007177a638fbeb8802397f3a6f4e47c14" = "0wc7qzkc7j4ns2rz562h6qrx2f8xyq7yjcb7zidnj7f6j0pcd0i9"; - "https://github.com/input-output-hk/cardano-wallet"."ae7569293e94241ef6829139ec02bd91abd069df" = "1mv1dhpkdj9ridm1fvq6jc85qs6zvbp172228rq72gyawjwrgvi6"; - "https://github.com/input-output-hk/cardano-addresses"."d2f86caa085402a953920c6714a0de6a50b655ec" = "0p6jbnd7ky2yf7bwb1350k8880py8dgqg39k49q02a6ij4ld01ay"; - "https://github.com/input-output-hk/plutus"."3f089ccf0ca746b399c99afe51e063b0640af547" = "1nx8xmdgwmnsla4qg4k67f5md8vm3p1p9i25ndalrqdg40z90486"; + "https://github.com/Quid2/flat"."ee59880f47ab835dbd73bea0847dab7869fc20d8" = "1lrzknw765pz2j97nvv9ip3l1mcpf2zr4n56hwlz0rk7wq7ls4cm"; }; modules = [ @@ -59,4 +59,4 @@ let inherit source-repo-override; }; in - project + project \ No newline at end of file diff --git a/nix/sources.json b/nix/sources.json index 77cd2ac..cd345ef 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,14 +1,14 @@ { "plutus-apps": { - "branch": "plutus-starter-devcontainer-1.0.14-maintenance", + "branch": "v2022-04-06", "description": "The Plutus application platform", "homepage": "", "owner": "input-output-hk", "repo": "plutus-apps", - "rev": "f2b8ae49f7e27b648b7ab34b1e53d1dd0d707e68", - "sha256": "1yjf0ll3bcmcs72q7hfq0kz3iv8hb4kspy9mf2178p5r036arwxv", + "rev": "e4062bca213f233cdf9822833b07aa69dff6d22a", + "sha256": "13yg3vb6a6gmjawlfa3wam5c6krqm7lip4w1p0j30hflca23x2h2", "type": "tarball", - "url": "https://github.com/input-output-hk/plutus-apps/archive/f2b8ae49f7e27b648b7ab34b1e53d1dd0d707e68.tar.gz", + "url": "https://github.com/input-output-hk/plutus-apps/archive/e4062bca213f233cdf9822833b07aa69dff6d22a.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/pab/Main.hs b/pab/Main.hs index c699734..a733c8a 100644 --- a/pab/Main.hs +++ b/pab/Main.hs @@ -18,7 +18,6 @@ import Data.Aeson (FromJSON (..), ToJSON (..) , defaultOptions, Options(..)) import Data.Default (def) import qualified Data.OpenApi as OpenApi -import Data.Text.Prettyprint.Doc (Pretty (..), viaShow) import GHC.Generics (Generic) import Plutus.Contract (ContractError) import Plutus.PAB.Effects.Contract.Builtin (Builtin, SomeBuiltin (..), BuiltinHandler(contractHandler)) @@ -28,12 +27,20 @@ import qualified Plutus.PAB.Simulator as Simulator import qualified Plutus.PAB.Webserver.Server as PAB.Server import Plutus.Contracts.Game as Game import Plutus.Trace.Emulator.Extract (writeScriptsTo, ScriptsConfig (..), Command (..)) +import Prettyprinter (Pretty (..), viaShow) import Ledger.Index (ValidatorMode(..)) +import qualified Wallet.Emulator.Wallet as Wallet main :: IO () main = void $ Simulator.runSimulationWith handlers $ do - Simulator.logString @(Builtin StarterContracts) "Starting plutus-starter PAB webserver on port 8080. Press enter to exit." + Simulator.logString @(Builtin StarterContracts) "Starting plutus-starter PAB webserver on port 9080. Press enter to exit." + + (wallet, _paymentPubKeyHash) <- Simulator.addWallet + Simulator.waitNSlots 1 + liftIO $ writeFile "scripts/wallet" (show $ Wallet.getWalletId wallet) + shutdown <- PAB.Server.startServerDebug + -- Example of spinning up a game instance on startup -- void $ Simulator.activateContract (Wallet 1) GameContract -- You can add simulator actions here: @@ -95,7 +102,6 @@ instance Builtin.HasDefinitions StarterContracts where handlers :: SimulatorEffectHandlers (Builtin StarterContracts) handlers = - Simulator.mkSimulatorHandlers def def + Simulator.mkSimulatorHandlers def $ interpret (contractHandler Builtin.handleBuiltin) - diff --git a/plutus-starter.cabal b/plutus-starter.cabal index e303d32..f3d70ae 100644 --- a/plutus-starter.cabal +++ b/plutus-starter.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.4 +cabal-version: 3.0 name: plutus-starter version: 0.1.0.0 @@ -45,15 +45,19 @@ library Plutus.Contracts.Game build-depends: base >= 4.9 && < 5, - aeson, - bytestring, - containers, - freer-extras, - playground-common, - plutus-contract, - plutus-tx-plugin, - plutus-tx, - plutus-ledger, + aeson -any, + bytestring -any, + containers -any, + freer-extras -any, + playground-common -any, + plutus-contract -any, + plutus-ledger -any, + plutus-ledger-api -any, + plutus-ledger-constraints -any, + plutus-tx -any, + plutus-tx-plugin -any, + text -any, + lens -any, hs-source-dirs: src examples/src test-suite plutus-example-projects-test @@ -67,13 +71,16 @@ test-suite plutus-example-projects-test plutus-tx -any, plutus-tx-plugin, plutus-contract -any, + plutus-pab -any, plutus-ledger -any, plutus-starter -any build-depends: base >=4.9 && <5, tasty -any, tasty-hunit -any, + text -any, tasty-hedgehog >=0.2.0.0 + executable plutus-starter-pab import: lang @@ -93,4 +100,3 @@ executable plutus-starter-pab freer-extras -any, plutus-ledger -any, openapi3 -any, - diff --git a/scripts/test b/scripts/test index 3639a4f..228e3ec 100755 --- a/scripts/test +++ b/scripts/test @@ -49,9 +49,7 @@ play() { secret="$1" guess="$2" - WALLET_ID=$(curl --silent --fail --data '' http://localhost:9080/wallet/create | jq -r '.wiWallet.getWalletId') - wait_with_backoff '[[ $(curl --fail --silent http://localhost:9080/wallet/$WALLET_ID/total-funds | jq '\''.getValue|length'\'') != "0" ]]' "Wallet not populated" - + WALLET_ID=$(cat scripts/wallet) CONTRACT_ID=$(curl --fail --silent \ --header "Content-Type: application/json" \ --data '{"caID": "GameContract", "caWallet":{"getWalletId": "'$WALLET_ID'"}}' \ @@ -66,7 +64,7 @@ play() { wait_for_contract curl --fail --silent --header "Content-Type: application/json" \ - --data '{"amount":{"getValue":[[{"unCurrencySymbol":""},[[{"unTokenName":""},90]]]]},"secretWord":"'"$secret"'"}' \ + --data '{"amount":{"getValue":[[{"unCurrencySymbol":""},[[{"unTokenName":""},2000000]]]]},"secretWord":"'"$secret"'"}' \ http://localhost:9080/api/contract/instance/$CONTRACT_ID/endpoint/lock wait_for_contract