From e572516918a1d05111220dd81cb4c52126b9a9e2 Mon Sep 17 00:00:00 2001 From: Emily Martins Date: Tue, 30 Aug 2022 13:42:54 +0200 Subject: [PATCH] allow disabling tracing in script export --- CHANGELOG.md | 7 +++++++ agora-scripts/Main.hs | 29 +++++++++++------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e94e628..a421cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ This format is based on [Keep A Changelog](https://keepachangelog.com/en/1.0.0). ### Modified +- `tracing` flag in `ScriptParams` of `agora-scripts` to enable/disable tracing in exported scripts. + + NOTE: This changes the representation of `ScriptParams`. In order to preserve old behavior, the flag + must be set to `True`. + + Included by [#167](https://github.com/Liqwid-Labs/agora/pull/167). + - `effects` of `Proposaldatum` is now required to be sorted in ascending order. The uniqueness of result tags is also guaranteed. `ProposalVotes` should be sorted the same way as a result. diff --git a/agora-scripts/Main.hs b/agora-scripts/Main.hs index 0ab8b6f..b87ca6e 100644 --- a/agora-scripts/Main.hs +++ b/agora-scripts/Main.hs @@ -20,7 +20,7 @@ import Data.Tagged (Tagged) import Data.Text (Text) import Development.GitRev (gitBranch, gitHash) import GHC.Generics qualified as GHC -import Plutarch (Config (Config, tracingMode), TracingMode (DoTracing)) +import Plutarch (Config (Config, tracingMode), TracingMode (DoTracing, NoTracing)) import PlutusLedgerApi.V1 ( MintingPolicy (getMintingPolicy), TxOutRef, @@ -97,17 +97,19 @@ agoraScripts params = scripts = Bootstrap.agoraScripts plutarchConfig governor + plutarchConfig :: Config + plutarchConfig = Config {tracingMode = if params.tracing then DoTracing else NoTracing} + {- | Params required for creating script export. - @since 0.2.0 + @since 1.0.0 -} -data ScriptParams where - ScriptParams :: - { governorInitialSpend :: TxOutRef - , gtClassRef :: Tagged GTTag AssetClass - , maximumCosigners :: Integer - } -> - ScriptParams +data ScriptParams = ScriptParams + { governorInitialSpend :: TxOutRef + , gtClassRef :: Tagged GTTag AssetClass + , maximumCosigners :: Integer + , tracing :: Bool + } deriving anyclass (Aeson.ToJSON, Aeson.FromJSON) deriving stock (Show, Eq, GHC.Generic, Ord) @@ -140,15 +142,6 @@ data AgoraScripts = AgoraScripts GHC.Generic ) -{- | Default plutarch configuration for compiling scripts. - - TODO: we should have an option to control this. - - @since 0.2.0 --} -plutarchConfig :: Config -plutarchConfig = Config {tracingMode = DoTracing} - {- | Turn a precompiled minting policy to a 'ScriptInfo'. @since 0.2.0