From d4f34c7ccdce2d301fdcb6be52c0bcb55a53e8c1 Mon Sep 17 00:00:00 2001 From: Gregory Gerasev Date: Mon, 1 Jul 2024 16:00:16 +0700 Subject: [PATCH 1/7] Update catalyst_milestone_reports.md --- docs/catalyst_milestone_reports.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/catalyst_milestone_reports.md b/docs/catalyst_milestone_reports.md index 26d24f8..a1985a1 100644 --- a/docs/catalyst_milestone_reports.md +++ b/docs/catalyst_milestone_reports.md @@ -8,9 +8,11 @@ Changes: ([source](https://github.com/mlabs-haskell/cem-script/blob/master/src/Cardano/CEM/Monads/CLB.hs), usage examples are all unit tests) * Running Quickcheck Dynamic tests, including mutation support ([source](https://github.com/mlabs-haskell/cem-script/blob/master/src/Cardano/CEM/Testing/StateMachine.hs), - [usage example](https://github.com/mlabs-haskell/cem-script/blob/master/test/Dynamic.hs)) + [usage example](https://github.com/mlabs-haskell/cem-script/blob/master/test/Dynamic.hs), + [PR](https://github.com/mlabs-haskell/cem-script/pull/75) and [PR2](https://github.com/mlabs-haskell/cem-script/pull/89)) * Rendering CEMScript state graphs - ([source](https://github.com/mlabs-haskell/cem-script/blob/master/src/Cardano/CEM/Documentation.hs), rendered example below) + ([source](https://github.com/mlabs-haskell/cem-script/blob/master/src/Cardano/CEM/Documentation.hs), rendered example below, + [PR](https://github.com/mlabs-haskell/cem-script/pull/33)) ## State graph examples From bd40c8aa4a6f4091d16326ec51af41193b047670 Mon Sep 17 00:00:00 2001 From: Gregory Gerasev Date: Tue, 2 Jul 2024 01:08:47 +0700 Subject: [PATCH 2/7] Add profiling results for M4 --- docs/catalyst_milestone_reports.md | 107 +++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/docs/catalyst_milestone_reports.md b/docs/catalyst_milestone_reports.md index a1985a1..2dc6aa4 100644 --- a/docs/catalyst_milestone_reports.md +++ b/docs/catalyst_milestone_reports.md @@ -41,3 +41,110 @@ Catalyst Milestone Outputs: * Plutarch on-chain code generation and optimisation ([PR](https://github.com/mlabs-haskell/cem-script/pull/94)) * Profiling implementation ([PR](https://github.com/mlabs-haskell/cem-script/pull/95)) +* Profiling performed for old (using Plutus) and new (using Plutarch) code generator, + and showed andvantage of second one in all fees measured, in some cases in order of magntude. + +## Profiling results + +### Old (Plutus) backend ([implementation commit](https://github.com/mlabs-haskell/cem-script/tree/7e39ee5cbb8b512f873de05af3573bda1355d0aa)) + +Auction flow: + +``` + [ ( "BuyoutSpine" + , MkFees + { fee = Coin 1072912 + , usedMemory = 7642581 + , usedCpu = 2334110505 + } + ) + , ( "CloseSpine" + , MkFees + { fee = Coin 1240433 + , usedMemory = 9509189 + , usedCpu = 3008756651 + } + ) + , ( "CreateSpine" + , MkFees { fee = Coin 198369 , usedMemory = 0 , usedCpu = 0 } + ) + , ( "MakeBidSpine" + , MkFees + { fee = Coin 1240548 + , usedMemory = 9489565 + , usedCpu = 3001647940 + } + ) + , ( "StartSpine" + , MkFees + { fee = Coin 1182093 + , usedMemory = 8782473 + , usedCpu = 2783614841 + } + ) + ] +``` + +Voting flow (fails exceeding Tx limits on second vote): + +``` + [ ( "CreateSpine" + , MkFees { fee = Coin 190141 , usedMemory = 0 , usedCpu = 0 } + ) + , ( "StartSpine" + , MkFees + { fee = Coin 724655 , usedMemory = 2961157 , usedCpu = 943387589 } + ) + , ( "VoteSpine" + , MkFees + { fee = Coin 1164933 + , usedMemory = 8369793 + , usedCpu = 2680589904 + } + ) + ] +``` + +### New (Plutarch with user-defined Plutus logic pieces) backend + +Auction: + +``` + [ ( "BuyoutSpine" + , MkFees + { fee = Coin 586779 , usedMemory = 625199 , usedCpu = 234106047 } + ) + , ( "CloseSpine" + , MkFees + { fee = Coin 667350 , usedMemory = 1358848 , usedCpu = 611301346 } + ) + , ( "CreateSpine" + , MkFees { fee = Coin 198237 , usedMemory = 0 , usedCpu = 0 } + ) + , ( "MakeBidSpine" + , MkFees + { fee = Coin 669571 , usedMemory = 1364475 , usedCpu = 613191159 } + ) + , ( "StartSpine" + , MkFees + { fee = Coin 747648 , usedMemory = 2231662 , usedCpu = 1028952087 } + ) + ] +``` + +Voting Plutarch backend: + +``` + [ ( "CreateSpine" + , MkFees { fee = Coin 190009 , usedMemory = 0 , usedCpu = 0 } + ) + , ( "StartSpine" + , MkFees + { fee = Coin 495528 , usedMemory = 181513 , usedCpu = 72358787 } + ) + , ( "VoteSpine" + , MkFees + { fee = Coin 646247 , usedMemory = 1882546 , usedCpu = 760595491 } + ) + ] +``` From fd20f52895f5d10cc51a10a5beebf7faa7a087a7 Mon Sep 17 00:00:00 2001 From: Gregory Gerasev Date: Tue, 2 Jul 2024 02:00:12 +0700 Subject: [PATCH 3/7] Update catalyst_milestone_reports.md --- docs/catalyst_milestone_reports.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/catalyst_milestone_reports.md b/docs/catalyst_milestone_reports.md index 2dc6aa4..9ecf1a0 100644 --- a/docs/catalyst_milestone_reports.md +++ b/docs/catalyst_milestone_reports.md @@ -41,8 +41,8 @@ Catalyst Milestone Outputs: * Plutarch on-chain code generation and optimisation ([PR](https://github.com/mlabs-haskell/cem-script/pull/94)) * Profiling implementation ([PR](https://github.com/mlabs-haskell/cem-script/pull/95)) -* Profiling performed for old (using Plutus) and new (using Plutarch) code generator, - and showed andvantage of second one in all fees measured, in some cases in order of magntude. +* Profiling performed for old (using Plutus) and new (using Plutarch) code generator. + New one showed advantage over first one in all fees measured, and in some cases in order of magntude. ## Profiling results From ce531e57e58d9331739a44f8ac6dab42b843ef87 Mon Sep 17 00:00:00 2001 From: Renegatto Date: Mon, 22 Jul 2024 19:25:31 +0300 Subject: [PATCH 4/7] Pinpoint devx version --- .envrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.envrc b/.envrc index 37d02de..f36155f 100644 --- a/.envrc +++ b/.envrc @@ -3,4 +3,4 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" fi # https://github.com/input-output-hk/devx Slightly opinionated shared GitHub Action for Cardano-Haskell projects -use flake "github:input-output-hk/devx#ghc964-iog" +use flake "github:input-output-hk/devx?rev=6ee20d669c3a3823c5add1e1528818ccff1eb2b9#ghc96-iog" From 6e557ae2f63e36f01086f3d56a221ae9f8a0a404 Mon Sep 17 00:00:00 2001 From: Renegatto Date: Mon, 22 Jul 2024 19:26:14 +0300 Subject: [PATCH 5/7] Make sure VSCode doesn't use ghcup's HLS --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a2d7a6f..e9801d1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,6 @@ "Fracada", "POCRE", "Serialised" - ] + ], + "haskell.manageHLS": "PATH" } From 27bd3a46207550d5d3d6c35d3cb29ce904bdfa43 Mon Sep 17 00:00:00 2001 From: Renegatto Date: Mon, 22 Jul 2024 19:27:41 +0300 Subject: [PATCH 6/7] Highlight in the README that 'cabal update' is necessary --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index bf18c06..b8b32c2 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ Arch Linux has `libblst` in AUR, nix are exemplified by IOHK, and manual installation is described here: https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/getting-started/install.md#installing-blst +Make sure to `cabal update` before building. + +The project uses `github:input-output-hk/devx` to make the development shell. See `.envrc` for details. + ## Running tests Tests are runned in emulated environment by default. From d82da22b69f872dabc7758d81ad85dc88e1f4f55 Mon Sep 17 00:00:00 2001 From: somthn0somthn <41335589+somthn0somthn@users.noreply.github.com> Date: Tue, 27 Aug 2024 17:15:23 +0900 Subject: [PATCH 7/7] Update catalyst_milestone_reports.md Adding clarifications to m3 report per reviewer request --- docs/catalyst_milestone_reports.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/catalyst_milestone_reports.md b/docs/catalyst_milestone_reports.md index 9ecf1a0..f9ada94 100644 --- a/docs/catalyst_milestone_reports.md +++ b/docs/catalyst_milestone_reports.md @@ -33,6 +33,20 @@ Winner -> "Void Out" [label="Buyout (stage Closed)"]; } ``` +## Clarifications on M3 Deliverables + +### Running an Emulated Environment by CLB + +The CLB monad is designed to interact seamlessly with a Cardano mockchain environment. It can read from a shared environment, query blockchain parameters such as the current slot, and retrieve UTXO information, among other functions. This module facilitates simulation and testing, making it essential for unit tests and other testing scenarios where a controlled blockchain environment is needed. Using this emulated environment, developers can test and validate their Cardano applications in a reliable and repeatable manner. + +### Running QuickCheck Dynamic Tests, Including Mutation Support + +QuickCheck is a powerful Haskell library for property-based testing, which helps ensure that programs behave correctly for a wide range of inputs. The quickcheck-dynamic library extends this tool to stateful systems, making it particularly suitable for testing blockchain applications. Our testing framework uses a state machine model to simulate real-world scenarios, incorporating support for mutation testing. This approach helps verify that the system maintains correct behavior under various conditions, including edge cases and unexpected changes, thereby enhancing the robustness of the application. + +### Rendering CEMScript State Graphs + +Understanding state transitions and the overall system flow is critical for ensuring blockchain applications do not enter invalid states. To aid developers, we have implemented automated rendering of state graphs through our documentation module. This module generates DOT graph representations of CEMScript state transitions, providing an easy-to-understand visual model of how a DApp functions in real-world scenarios. This visualization tool increases developer confidence by highlighting the system's behavior and identifying potential shortcomings. + # Milestone 4 ## Summary