Merge pull request #167 from Liqwid-Labs/emiflake/expose-tracing-options

Expose trace options in `agora-scripts` executable.
This commit is contained in:
emiflake 2022-08-30 20:12:39 +02:00 committed by GitHub
commit 46bd23aff3
2 changed files with 18 additions and 18 deletions

View file

@ -6,6 +6,13 @@ This format is based on [Keep A Changelog](https://keepachangelog.com/en/1.0.0).
### Modified ### 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. - `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. `ProposalVotes` should be sorted the same way as a result.

View file

@ -20,7 +20,7 @@ import Data.Tagged (Tagged)
import Data.Text (Text) import Data.Text (Text)
import Development.GitRev (gitBranch, gitHash) import Development.GitRev (gitBranch, gitHash)
import GHC.Generics qualified as GHC import GHC.Generics qualified as GHC
import Plutarch (Config (Config, tracingMode), TracingMode (DoTracing)) import Plutarch (Config (Config, tracingMode), TracingMode (DoTracing, NoTracing))
import PlutusLedgerApi.V1 ( import PlutusLedgerApi.V1 (
MintingPolicy (getMintingPolicy), MintingPolicy (getMintingPolicy),
TxOutRef, TxOutRef,
@ -97,17 +97,19 @@ agoraScripts params =
scripts = Bootstrap.agoraScripts plutarchConfig governor scripts = Bootstrap.agoraScripts plutarchConfig governor
plutarchConfig :: Config
plutarchConfig = Config {tracingMode = if params.tracing then DoTracing else NoTracing}
{- | Params required for creating script export. {- | Params required for creating script export.
@since 0.2.0 @since 1.0.0
-} -}
data ScriptParams where data ScriptParams = ScriptParams
ScriptParams :: { governorInitialSpend :: TxOutRef
{ governorInitialSpend :: TxOutRef , gtClassRef :: Tagged GTTag AssetClass
, gtClassRef :: Tagged GTTag AssetClass , maximumCosigners :: Integer
, maximumCosigners :: Integer , tracing :: Bool
} -> }
ScriptParams
deriving anyclass (Aeson.ToJSON, Aeson.FromJSON) deriving anyclass (Aeson.ToJSON, Aeson.FromJSON)
deriving stock (Show, Eq, GHC.Generic, Ord) deriving stock (Show, Eq, GHC.Generic, Ord)
@ -140,15 +142,6 @@ data AgoraScripts = AgoraScripts
GHC.Generic 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'. {- | Turn a precompiled minting policy to a 'ScriptInfo'.
@since 0.2.0 @since 0.2.0