Merge pull request #20 from Liqwid-Labs/emiflake/add-plutus-extra

Add plutus-extra dependency
This commit is contained in:
Emily 2022-02-08 13:40:30 +01:00 committed by GitHub
commit 98a1ecb4b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 80 additions and 63 deletions

View file

@ -78,6 +78,7 @@ common deps
, serialise
, template-haskell
, text
, plutus-extra
common test-deps
build-depends:

66
flake.lock generated
View file

@ -187,17 +187,17 @@
"cardano-base": {
"flake": false,
"locked": {
"lastModified": 1633939430,
"narHash": "sha256-zbjq43Bnhv1/LhJCFlI8gdd61dGvVlkEa6wkCvLqEFg=",
"lastModified": 1633088283,
"narHash": "sha256-JKpOlruMX5sr9eaQ3AuOppCbBjQIRKwF4ny20tdPnUg=",
"owner": "input-output-hk",
"repo": "cardano-base",
"rev": "4ea7e2d927c9a7f78ddc69738409a5827ab66b98",
"rev": "654f5b7c76f7cc57900b4ddc664a82fc3b925fb0",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "cardano-base",
"rev": "4ea7e2d927c9a7f78ddc69738409a5827ab66b98",
"rev": "654f5b7c76f7cc57900b4ddc664a82fc3b925fb0",
"type": "github"
}
},
@ -220,17 +220,17 @@
"cardano-crypto": {
"flake": false,
"locked": {
"lastModified": 1621376239,
"narHash": "sha256-oxIOVlgm07FAEmgGRF1C2me9TXqVxQulEOcJ22zpTRs=",
"lastModified": 1604244485,
"narHash": "sha256-2Fipex/WjIRMrvx6F3hjJoAeMtFd2wGnZECT0kuIB9k=",
"owner": "input-output-hk",
"repo": "cardano-crypto",
"rev": "07397f0e50da97eaa0575d93bee7ac4b2b2576ec",
"rev": "f73079303f663e028288f9f4a9e08bcca39a923e",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "cardano-crypto",
"rev": "07397f0e50da97eaa0575d93bee7ac4b2b2576ec",
"rev": "f73079303f663e028288f9f4a9e08bcca39a923e",
"type": "github"
}
},
@ -386,17 +386,17 @@
"cardano-wallet": {
"flake": false,
"locked": {
"lastModified": 1635781445,
"narHash": "sha256-5IZuqlE/4aGH3TEuGYQsZwOpI/Q7DYzJ4q3stuqGpWc=",
"lastModified": 1639607349,
"narHash": "sha256-JuYH5pAF7gOsliES0Beo86PinoBmmKXWShXT3NqVlgQ=",
"owner": "j-mueller",
"repo": "cardano-wallet",
"rev": "6be73ab852c0592713dfe78218856d4a8a0ee69e",
"rev": "760140e238a5fbca61d1b286d7a80ece058dc729",
"type": "github"
},
"original": {
"owner": "j-mueller",
"repo": "cardano-wallet",
"rev": "6be73ab852c0592713dfe78218856d4a8a0ee69e",
"rev": "760140e238a5fbca61d1b286d7a80ece058dc729",
"type": "github"
}
},
@ -1353,17 +1353,17 @@
"ouroboros-network": {
"flake": false,
"locked": {
"lastModified": 1634917006,
"narHash": "sha256-lwTgyoZBQAaU6Sh7BouGJGUvK1tSVrWhJP63v7MpwKA=",
"lastModified": 1637082154,
"narHash": "sha256-FNYcUjoy0ZpletEXUIAMbag2Hwb9K3bDRl793NyNy1E=",
"owner": "input-output-hk",
"repo": "ouroboros-network",
"rev": "1f4973f36f689d6da75b5d351fb124d66ef1057d",
"rev": "d613de3d872ec8b4a5da0c98afb443f322dc4dab",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "ouroboros-network",
"rev": "1f4973f36f689d6da75b5d351fb124d66ef1057d",
"rev": "d613de3d872ec8b4a5da0c98afb443f322dc4dab",
"type": "github"
}
},
@ -1393,17 +1393,17 @@
"th-extras": "th-extras"
},
"locked": {
"lastModified": 1643303963,
"narHash": "sha256-Ta3PLyLX209Dj1LWljkp9ynlA+QPJyaI2g6oQgBeueM=",
"lastModified": 1643799364,
"narHash": "sha256-ud/YkMtBKcx0yrHOboA7uTPtGCt5LCOipF0m2W6LqxU=",
"owner": "Plutonomicon",
"repo": "plutarch",
"rev": "d753dc34dfc30b144e94d6493c837ebd0c99b588",
"rev": "1fd4db27152625184e559cfb465d225a0995a56b",
"type": "github"
},
"original": {
"owner": "Plutonomicon",
"repo": "plutarch",
"rev": "d753dc34dfc30b144e94d6493c837ebd0c99b588",
"rev": "1fd4db27152625184e559cfb465d225a0995a56b",
"type": "github"
}
},
@ -1438,17 +1438,34 @@
"plutus-apps": {
"flake": false,
"locked": {
"lastModified": 1636122782,
"narHash": "sha256-+T9TGzHEzyfixBysxLwy5VWVrL5xqKF5pcbRlHQr+wI=",
"lastModified": 1642502716,
"narHash": "sha256-UULYQppoNjj+EOcV75UT3DOwJF+d609FOYsZZFeAQcM=",
"owner": "input-output-hk",
"repo": "plutus-apps",
"rev": "404af7ac3e27ebcb218c05f79d9a70ca966407c9",
"rev": "34fe6eeff441166fee0cd0ceba68c1439f0e93d2",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "plutus-apps",
"rev": "404af7ac3e27ebcb218c05f79d9a70ca966407c9",
"rev": "34fe6eeff441166fee0cd0ceba68c1439f0e93d2",
"type": "github"
}
},
"plutus-extra": {
"flake": false,
"locked": {
"lastModified": 1643739251,
"narHash": "sha256-L7WSXvGWxfuqSP4ZNdbuT2AdW89mAJsE6+3mxO+1dx8=",
"owner": "Liqwid-Labs",
"repo": "plutus-extra",
"rev": "bfeb0d2bb1bc18f147e58c200db2022f5c75eb60",
"type": "github"
},
"original": {
"owner": "Liqwid-Labs",
"repo": "plutus-extra",
"rev": "bfeb0d2bb1bc18f147e58c200db2022f5c75eb60",
"type": "github"
}
},
@ -1585,6 +1602,7 @@
"plutarch": "plutarch",
"plutus": "plutus_2",
"plutus-apps": "plutus-apps",
"plutus-extra": "plutus-extra",
"purescript-bridge": "purescript-bridge",
"servant-purescript": "servant-purescript"
}

View file

@ -10,18 +10,22 @@
"github:input-output-hk/plutus?rev=65bad0fd53e432974c3c203b1b1999161b6c2dce";
inputs.plutarch.url =
"github:Plutonomicon/plutarch?rev=d753dc34dfc30b144e94d6493c837ebd0c99b588";
"github:Plutonomicon/plutarch?rev=1fd4db27152625184e559cfb465d225a0995a56b";
inputs.goblins.url =
"github:input-output-hk/goblins?rev=cde90a2b27f79187ca8310b6549331e59595e7ba";
inputs.goblins.flake = false;
inputs.plutus-extra.url =
"github:Liqwid-Labs/plutus-extra?rev=bfeb0d2bb1bc18f147e58c200db2022f5c75eb60";
inputs.plutus-extra.flake = false; # Could we set this to true?
inputs.cardano-node.url =
"github:input-output-hk/cardano-node?rev=b6ca519f97a0e795611a63174687e6bb70c9f752";
inputs.cardano-node.flake = false;
inputs.cardano-wallet.url =
"github:j-mueller/cardano-wallet?rev=6be73ab852c0592713dfe78218856d4a8a0ee69e";
"github:j-mueller/cardano-wallet?rev=760140e238a5fbca61d1b286d7a80ece058dc729";
inputs.cardano-wallet.flake = false;
inputs.purescript-bridge.url =
@ -33,7 +37,7 @@
inputs.servant-purescript.flake = false;
inputs.plutus-apps.url =
"github:input-output-hk/plutus-apps?rev=404af7ac3e27ebcb218c05f79d9a70ca966407c9";
"github:input-output-hk/plutus-apps?rev=34fe6eeff441166fee0cd0ceba68c1439f0e93d2";
inputs.plutus-apps.flake = false;
inputs.cardano-addresses.url =
@ -45,7 +49,7 @@
inputs.optparse-applicative.flake = false;
inputs.ouroboros-network.url =
"github:input-output-hk/ouroboros-network?rev=1f4973f36f689d6da75b5d351fb124d66ef1057d";
"github:input-output-hk/ouroboros-network?rev=d613de3d872ec8b4a5da0c98afb443f322dc4dab";
inputs.ouroboros-network.flake = false;
inputs.cardano-ledger-specs.url =
@ -61,11 +65,11 @@
inputs.cardano-prelude.flake = false;
inputs.cardano-base.url =
"github:input-output-hk/cardano-base?rev=4ea7e2d927c9a7f78ddc69738409a5827ab66b98";
"github:input-output-hk/cardano-base?rev=654f5b7c76f7cc57900b4ddc664a82fc3b925fb0";
inputs.cardano-base.flake = false;
inputs.cardano-crypto.url =
"github:input-output-hk/cardano-crypto?rev=07397f0e50da97eaa0575d93bee7ac4b2b2576ec";
"github:input-output-hk/cardano-crypto?rev=f73079303f663e028288f9f4a9e08bcca39a923e";
inputs.cardano-crypto.flake = false;
inputs.flat.url =
@ -91,6 +95,7 @@
};
deferPluginErrors = true;
plutarch-development = true;
projectFor = system:
let pkgs = nixpkgsFor system;
@ -224,6 +229,7 @@
"lib/launcher"
"lib/core-integration"
"lib/cli"
"lib/dbvar"
"lib/shelley"
];
}
@ -238,6 +244,7 @@
"plutus-chain-index-core"
"plutus-contract"
"plutus-ledger"
"plutus-ledger-constraints"
"plutus-pab"
"plutus-playground-server"
"plutus-use-cases"
@ -250,6 +257,19 @@
subdirs =
[ "cardano-api" "cardano-node" "cardano-cli" "cardano-config" ];
}
{
src = inputs.plutus-extra;
subdirs = [
"tasty-plutus"
"plutus-pretty"
"plutus-numeric"
"plutus-extra"
"plutus-golden"
"plutus-laws"
"quickcheck-plutus-instances"
];
}
{
src = inputs.plutus;
subdirs = [
@ -268,7 +288,12 @@
];
modules = [{
packages = {
plutarch.flags.development = plutarch-development;
marlowe.flags.defer-plugin-errors = deferPluginErrors;
plutus-use-cases.flags.defer-plugin-errors = deferPluginErrors;
plutus-ledger.flags.defer-plugin-errors = deferPluginErrors;
plutus-contract.flags.defer-plugin-errors = deferPluginErrors;
cardano-crypto-praos.components.library.pkgconfig =
nixpkgs.lib.mkForce
[ [ (import plutus { inherit system; }).pkgs.libsodium-vrf ] ];
@ -296,7 +321,12 @@
graphviz
];
additional = ps: [ ps.plutarch ps.plutus-ledger ];
additional = ps: [
ps.plutarch
ps.plutus-ledger
ps.plutus-extra
];
};
};
in {

View file

@ -1,6 +0,0 @@
# This file is no longer useful for normal nix-shell, as it has
# been superseded by flake.nix However, this is still useful for
# lorri to use automatically.
{ system ? builtins.currentSystem }:
(builtins.getFlake (toString ./.)).devShell.${system}

View file

@ -1,7 +1,6 @@
module Agora.AuthorityToken (
authorityTokenPolicy,
AuthorityToken (..),
serialisedScriptSize,
) where
--------------------------------------------------------------------------------
@ -9,20 +8,6 @@ module Agora.AuthorityToken (
import Prelude
--------------------------------------------------------------------------------
import Codec.Serialise (serialise)
import Data.ByteString qualified as BSS
import Data.ByteString.Lazy qualified as BS
import Data.ByteString.Short qualified as SBS
--------------------------------------------------------------------------------
import Cardano.Api.Shelley (
PlutusScript (PlutusScriptSerialised),
PlutusScriptV1,
serialiseToCBOR,
)
import Plutus.V1.Ledger.Scripts (Script)
import Plutus.V1.Ledger.Value (AssetClass (..))
--------------------------------------------------------------------------------
@ -86,17 +71,6 @@ passetClassValueOf =
PNothing -> 0
PJust v -> pfromData v
-- TODO: We should rely on plutus-extra instead of rolling our own,
-- this is just quick and hacky.
serialisedScriptSize :: Script -> Int
serialisedScriptSize =
BSS.length
. serialiseToCBOR
. PlutusScriptSerialised @PlutusScriptV1
. SBS.toShort
. BS.toStrict
. serialise
authorityTokenPolicy ::
AuthorityToken ->
Term s (PData :--> PData :--> PScriptContext :--> PUnit)