flake: bump plutarch-extra fork

This commit is contained in:
Emily Martins 2022-04-19 17:42:39 +02:00
parent e77140e863
commit 8f7f543438
9 changed files with 85 additions and 136 deletions

View file

@ -21,7 +21,6 @@ module Agora.Governor (
) where
import Agora.Proposal (ProposalId, ProposalThresholds)
import Plutarch (popaque)
import Plutarch.Api.V1 (PMintingPolicy, PValidator)
import PlutusTx qualified

View file

@ -24,6 +24,7 @@ import Plutarch.DataRepr (
PIsDataReprInstances (PIsDataReprInstances),
)
import Plutarch.Lift (
PConstantDecl,
PLifted,
PUnsafeLiftDecl,
)
@ -73,7 +74,7 @@ newtype PMultiSig (s :: S) = PMultiSig
via (PIsDataReprInstances PMultiSig)
instance PUnsafeLiftDecl PMultiSig where type PLifted PMultiSig = MultiSig
deriving via (DerivePConstantViaData MultiSig PMultiSig) instance (PConstant MultiSig)
deriving via (DerivePConstantViaData MultiSig PMultiSig) instance (PConstantDecl MultiSig)
--------------------------------------------------------------------------------

View file

@ -62,10 +62,9 @@ import PlutusTx.AssocMap qualified as AssocMap
import Agora.SafeMoney (GTTag)
import Agora.Utils (passert, pnotNull, psymbolValueOf, ptokenSpent, pvalueSpent)
import Control.Arrow (first)
import Plutarch (popaque)
import Plutarch.Api.V1.Extra (passetClass, passetClassValueOf)
import Plutarch.Builtin (PBuiltinMap)
import Plutarch.Lift (DerivePConstantViaNewtype (..), PUnsafeLiftDecl (..))
import Plutarch.Lift (DerivePConstantViaNewtype (..), PConstantDecl, PUnsafeLiftDecl (..))
import Plutarch.Monadic qualified as P
import Plutarch.SafeMoney (PDiscrete, Tagged)
import Plutarch.TryFrom (PTryFrom (PTryFromExcess, ptryFrom'))
@ -257,7 +256,7 @@ instance PUnsafeLiftDecl PResultTag where type PLifted PResultTag = ResultTag
deriving via
(DerivePConstantViaNewtype ResultTag PResultTag PInteger)
instance
(PConstant ResultTag)
(PConstantDecl ResultTag)
-- FIXME: This instance and the one below, for 'PProposalId', should be derived.
-- Soon this will be possible through 'DerivePNewtype'.
@ -287,7 +286,7 @@ instance PUnsafeLiftDecl PProposalId where type PLifted PProposalId = ProposalId
deriving via
(DerivePConstantViaNewtype ProposalId PProposalId PInteger)
instance
(PConstant ProposalId)
(PConstantDecl ProposalId)
-- | Plutarch-level version of 'ProposalStatus'.
data PProposalStatus (s :: S)
@ -304,7 +303,7 @@ data PProposalStatus (s :: S)
via PIsDataReprInstances PProposalStatus
instance PUnsafeLiftDecl PProposalStatus where type PLifted PProposalStatus = ProposalStatus
deriving via (DerivePConstantViaData ProposalStatus PProposalStatus) instance (PConstant ProposalStatus)
deriving via (DerivePConstantViaData ProposalStatus PProposalStatus) instance (PConstantDecl ProposalStatus)
-- | Plutarch-level version of 'ProposalThresholds'.
newtype PProposalThresholds (s :: S) = PProposalThresholds
@ -326,7 +325,7 @@ newtype PProposalThresholds (s :: S) = PProposalThresholds
via (PIsDataReprInstances PProposalThresholds)
instance PUnsafeLiftDecl PProposalThresholds where type PLifted PProposalThresholds = ProposalThresholds
deriving via (DerivePConstantViaData ProposalThresholds PProposalThresholds) instance (PConstant ProposalThresholds)
deriving via (DerivePConstantViaData ProposalThresholds PProposalThresholds) instance (PConstantDecl ProposalThresholds)
-- | Plutarch-level version of 'ProposalVotes'.
newtype PProposalVotes (s :: S)
@ -337,7 +336,7 @@ instance PUnsafeLiftDecl PProposalVotes where type PLifted PProposalVotes = Prop
deriving via
(DerivePConstantViaNewtype ProposalVotes PProposalVotes (PMap PResultTag PInteger))
instance
(PConstant ProposalVotes)
(PConstantDecl ProposalVotes)
-- | Plutarch-level version of 'ProposalDatum'.
newtype PProposalDatum (s :: S) = PProposalDatum
@ -362,7 +361,7 @@ newtype PProposalDatum (s :: S) = PProposalDatum
via (PIsDataReprInstances PProposalDatum)
instance PUnsafeLiftDecl PProposalDatum where type PLifted PProposalDatum = ProposalDatum
deriving via (DerivePConstantViaData ProposalDatum PProposalDatum) instance (PConstant ProposalDatum)
deriving via (DerivePConstantViaData ProposalDatum PProposalDatum) instance (PConstantDecl ProposalDatum)
-- | Haskell-level redeemer for Proposal scripts.
data PProposalRedeemer (s :: S)
@ -384,7 +383,7 @@ data PProposalRedeemer (s :: S)
-- PTryFrom PData (PAsData PProposalRedeemer)
instance PUnsafeLiftDecl PProposalRedeemer where type PLifted PProposalRedeemer = ProposalRedeemer
deriving via (DerivePConstantViaData ProposalRedeemer PProposalRedeemer) instance (PConstant ProposalRedeemer)
deriving via (DerivePConstantViaData ProposalRedeemer PProposalRedeemer) instance (PConstantDecl ProposalRedeemer)
--------------------------------------------------------------------------------

View file

@ -33,7 +33,6 @@ import PlutusTx qualified
--------------------------------------------------------------------------------
import Plutarch (popaque)
import Plutarch.Api.V1 (
PCredential (PPubKeyCredential, PScriptCredential),
PMintingPolicy,
@ -50,7 +49,7 @@ import Plutarch.DataRepr (
PIsDataReprInstances (PIsDataReprInstances),
)
import Plutarch.Internal (punsafeCoerce)
import Plutarch.Lift (PUnsafeLiftDecl (..))
import Plutarch.Lift (PConstantDecl, PUnsafeLiftDecl (..))
import Plutarch.Monadic qualified as P
import Plutus.V1.Ledger.Value (AssetClass (AssetClass))
@ -197,7 +196,7 @@ newtype PStakeDatum (s :: S) = PStakeDatum
via (PIsDataReprInstances PStakeDatum)
instance PUnsafeLiftDecl PStakeDatum where type PLifted PStakeDatum = StakeDatum
deriving via (DerivePConstantViaData StakeDatum PStakeDatum) instance (PConstant StakeDatum)
deriving via (DerivePConstantViaData StakeDatum PStakeDatum) instance (PConstantDecl StakeDatum)
-- | Plutarch-level redeemer for Stake scripts.
data PStakeRedeemer (s :: S)
@ -220,7 +219,7 @@ deriving via
PTryFrom PData (PAsData PStakeRedeemer)
instance PUnsafeLiftDecl PStakeRedeemer where type PLifted PStakeRedeemer = StakeRedeemer
deriving via (DerivePConstantViaData StakeRedeemer PStakeRedeemer) instance (PConstant StakeRedeemer)
deriving via (DerivePConstantViaData StakeRedeemer PStakeRedeemer) instance (PConstantDecl StakeRedeemer)
newtype PProposalLock (s :: S) = PProposalLock
{ getProposalLock ::
@ -245,7 +244,7 @@ deriving via
PTryFrom PData (PAsData PProposalLock)
instance PUnsafeLiftDecl PProposalLock where type PLifted PProposalLock = ProposalLock
deriving via (DerivePConstantViaData ProposalLock PProposalLock) instance (PConstant ProposalLock)
deriving via (DerivePConstantViaData ProposalLock PProposalLock) instance (PConstantDecl ProposalLock)
--------------------------------------------------------------------------------
{- What this Policy does

View file

@ -23,7 +23,6 @@ import Plutus.V1.Ledger.Value (CurrencySymbol)
import Agora.AuthorityToken (singleAuthorityTokenBurned)
import Agora.Utils (passert)
import Plutarch (popaque)
import Plutarch.Api.V1 (PValidator)
import Plutarch.Unsafe (punsafeCoerce)

View file

@ -80,7 +80,7 @@ pfindDatum :: Term s (PDatumHash :--> PTxInfo :--> PMaybe PDatum)
pfindDatum = phoistAcyclic $
plam $ \datumHash txInfo'' -> P.do
PTxInfo txInfo' <- pmatch txInfo''
plookupTuple # datumHash #$ pfield @"data" # txInfo'
plookupTuple # datumHash #$ pfield @"datums" # txInfo'
{- | Find a datum with the given hash.
NOTE: this is unsafe in the sense that, if the data layout is wrong, this is UB.

View file

@ -11,8 +11,7 @@ module PPrelude (
module Plutarch,
) where
-- NOTE: These are not exported by Plutarch.Prelude, for some reason.
-- Maybe we can 'fix' this upstream?
import Plutarch (ClosedTerm, POpaque, compile)
-- 'compile' is not exported by Plutarch.Prelude.
import Plutarch (compile)
import Plutarch.Prelude
import Prelude

178
flake.lock generated
View file

@ -117,23 +117,6 @@
"type": "github"
}
},
"autodocodec": {
"flake": false,
"locked": {
"lastModified": 1644358110,
"narHash": "sha256-X1TNZlmO2qDFk3OL4Z1v/gzvd3ouoACAiMweutsYek4=",
"owner": "srid",
"repo": "autodocodec",
"rev": "42b42a7407f33c6c74fa4e8c84906aebfed28daf",
"type": "github"
},
"original": {
"owner": "srid",
"ref": "ghc921",
"repo": "autodocodec",
"type": "github"
}
},
"cabal-32": {
"flake": false,
"locked": {
@ -463,21 +446,6 @@
"type": "github"
}
},
"flake-compat-ci_3": {
"locked": {
"lastModified": 1641672839,
"narHash": "sha256-Bdwv+DKeEMlRNPDpZxSz0sSrqQBvdKO5fZ8LmvrgCOU=",
"owner": "hercules-ci",
"repo": "flake-compat-ci",
"rev": "e832114bc18376c0f3fa13c19bf5ff253cc6570a",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-compat-ci",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
@ -495,22 +463,6 @@
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1641205782,
"narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1606424373,
@ -527,7 +479,7 @@
"type": "github"
}
},
"flake-compat_5": {
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1606424373,
@ -981,7 +933,7 @@
},
"hercules-ci-agent": {
"inputs": {
"flake-compat": "flake-compat_5",
"flake-compat": "flake-compat_4",
"nix-darwin": "nix-darwin",
"nixos-20_09": "nixos-20_09",
"nixos-unstable": "nixos-unstable",
@ -1004,7 +956,7 @@
},
"hercules-ci-effects": {
"inputs": {
"flake-compat": "flake-compat_4",
"flake-compat": "flake-compat_3",
"hercules-ci-agent": "hercules-ci-agent",
"nixpkgs": "nixpkgs_3",
"nixpkgs-nixops": "nixpkgs-nixops"
@ -1088,6 +1040,55 @@
"type": "github"
}
},
"hspec": {
"flake": false,
"locked": {
"lastModified": 1649095108,
"narHash": "sha256-cPmt4hvmdh727VT6UAL8yFArmm4FAWeg3K5Qi3XtU4g=",
"owner": "srid",
"repo": "hspec",
"rev": "44f2a143e10c93df237af428457d0e4b74ae270a",
"type": "github"
},
"original": {
"owner": "srid",
"ref": "askAncestors",
"repo": "hspec",
"type": "github"
}
},
"hspec-golden": {
"flake": false,
"locked": {
"lastModified": 1648755064,
"narHash": "sha256-5a6BksZx00o2iL0Ei/L1Kkou2BsnsIagN+tTmqYyKfs=",
"owner": "stackbuilders",
"repo": "hspec-golden",
"rev": "4b0ad56b2de0254a7b1e0feda917656f78a5bcda",
"type": "github"
},
"original": {
"owner": "stackbuilders",
"repo": "hspec-golden",
"type": "github"
}
},
"hspec-hedgehog": {
"flake": false,
"locked": {
"lastModified": 1602603478,
"narHash": "sha256-XnS3zjQ7eh3iBOWq+Z/YcwrfWI55hV6k8LsZ8qm/qOc=",
"owner": "parsonsmatt",
"repo": "hspec-hedgehog",
"rev": "eb617d854542510f0129acdea4bf52e50b13042e",
"type": "github"
},
"original": {
"owner": "parsonsmatt",
"repo": "hspec-hedgehog",
"type": "github"
}
},
"iohk-nix": {
"flake": false,
"locked": {
@ -1592,19 +1593,24 @@
"plutarch": {
"inputs": {
"Shrinker": "Shrinker",
"autodocodec": "autodocodec",
"cardano-base": "cardano-base",
"cardano-crypto": "cardano-crypto",
"cardano-prelude": "cardano-prelude",
"cryptonite": "cryptonite",
"flake-compat": "flake-compat_3",
"flake-compat-ci": "flake-compat-ci_3",
"emanote": [
"plutarch",
"haskell-nix",
"nixpkgs-unstable"
],
"flat": "flat",
"foundation": "foundation",
"haskell-language-server": "haskell-language-server_2",
"haskell-nix": "haskell-nix_4",
"hercules-ci-effects": "hercules-ci-effects",
"hs-memory": "hs-memory",
"hspec": "hspec",
"hspec-golden": "hspec-golden",
"hspec-hedgehog": "hspec-hedgehog",
"iohk-nix": "iohk-nix_2",
"nixpkgs": [
"plutarch",
@ -1614,24 +1620,21 @@
"nixpkgs-2111": "nixpkgs-2111_5",
"plutus": "plutus_2",
"protolude": "protolude",
"safe-coloured-text": "safe-coloured-text",
"sized-functors": "sized-functors",
"sydtest": "sydtest",
"th-extras": "th-extras",
"validity": "validity"
"th-extras": "th-extras"
},
"locked": {
"lastModified": 1650025193,
"narHash": "sha256-SXfkWYse308SdnWO34cMVjKliDvyYYx++Y5uiuUmGXE=",
"lastModified": 1650382454,
"narHash": "sha256-b31DK+E/0MtR45+Z+F5U1E8jjcewvZ42UmFLZlXDAYM=",
"owner": "peter-mlabs",
"repo": "plutarch",
"rev": "18e787d420912ed765fc5653c3558f20ab5e638a",
"rev": "6ef18aacd02050fc07398e399cff5e8734c1045e",
"type": "github"
},
"original": {
"owner": "peter-mlabs",
"repo": "plutarch",
"rev": "18e787d420912ed765fc5653c3558f20ab5e638a",
"rev": "6ef18aacd02050fc07398e399cff5e8734c1045e",
"type": "github"
}
},
@ -1771,23 +1774,6 @@
"plutarch": "plutarch"
}
},
"safe-coloured-text": {
"flake": false,
"locked": {
"lastModified": 1644357337,
"narHash": "sha256-sXSKw8m6O9K/H2BBiYqO5e4sJIo+9UP+UvEukRn28d8=",
"owner": "srid",
"repo": "safe-coloured-text",
"rev": "034f3612525568b422e0c62b52417d77b7cf31c2",
"type": "github"
},
"original": {
"owner": "srid",
"ref": "ghc921",
"repo": "safe-coloured-text",
"type": "github"
}
},
"sized-functors": {
"flake": false,
"locked": {
@ -1917,23 +1903,6 @@
"type": "github"
}
},
"sydtest": {
"flake": false,
"locked": {
"lastModified": 1645114028,
"narHash": "sha256-P6ZwwfFeN8fpi3fziz9yERTn7BfxdE/j/OofUu+4GdA=",
"owner": "srid",
"repo": "sydtest",
"rev": "9c6c7678f7aabe22e075aab810a6a2e304591d24",
"type": "github"
},
"original": {
"owner": "srid",
"ref": "ghc921",
"repo": "sydtest",
"type": "github"
}
},
"th-extras": {
"flake": false,
"locked": {
@ -1950,23 +1919,6 @@
"rev": "787ed752c1e5d41b5903b74e171ed087de38bffa",
"type": "github"
}
},
"validity": {
"flake": false,
"locked": {
"lastModified": 1644358698,
"narHash": "sha256-dpMIu08qXMzy8Kilk/2VWpuwIsfqFtpg/3mkwt5pdjA=",
"owner": "srid",
"repo": "validity",
"rev": "f7982549b95d0ab727950dc876ca06b1862135ba",
"type": "github"
},
"original": {
"owner": "srid",
"ref": "ghc921",
"repo": "validity",
"type": "github"
}
}
},
"root": "root",

View file

@ -7,9 +7,10 @@
# see https://github.com/NixOS/nix/issues/6013
inputs.nixpkgs-2111 = { url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin"; };
# Rev is this PR https://github.com/peter-mlabs/plutarch/pull/5.
inputs.plutarch.url =
"github:peter-mlabs/plutarch?rev=18e787d420912ed765fc5653c3558f20ab5e638a";
"github:peter-mlabs/plutarch?rev=6ef18aacd02050fc07398e399cff5e8734c1045e";
inputs.plutarch.inputs.emanote.follows =
"plutarch/haskell-nix/nixpkgs-unstable";
inputs.plutarch.inputs.nixpkgs.follows =
"plutarch/haskell-nix/nixpkgs-unstable";