Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vasil features #157

Merged
merged 50 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
33b4efa
Vasil feature upgrade WIP
samuelWilliams99 Oct 26, 2022
0c76b90
Furhter BPI upgrade WIP
samuelWilliams99 Oct 26, 2022
d1119f7
Achieve compilation, support incomplete
samuelWilliams99 Oct 26, 2022
35029f4
Formatting
samuelWilliams99 Oct 26, 2022
19aa8f0
Implement features in the CLI, fix tests, WIP
samuelWilliams99 Nov 4, 2022
356e82a
Add notes
samuelWilliams99 Nov 4, 2022
21fc6a0
Change node queries to give TxOut
samuelWilliams99 Nov 4, 2022
a1c6a0d
Format
samuelWilliams99 Nov 4, 2022
3b13058
Implement new node effects
samuelWilliams99 Nov 4, 2022
7cc8613
Shift estimation context out to single location
samuelWilliams99 Nov 6, 2022
ff5f859
Fix tests, format
samuelWilliams99 Nov 6, 2022
bf988d7
Add inline datum cli support
samuelWilliams99 Nov 6, 2022
274b217
Format
samuelWilliams99 Nov 6, 2022
1b61aa9
Implement custom constraints
samuelWilliams99 Nov 7, 2022
f107c88
Update comments
samuelWilliams99 Nov 7, 2022
4dabec7
Fix make lint, run formatters/linters
samuelWilliams99 Nov 7, 2022
c86949e
The linter made the formatter fail
samuelWilliams99 Nov 7, 2022
20e5829
Exported BpiConstraints and used serialiseAddress differently
bladyjoker Nov 8, 2022
e2038f1
Upgraded to plutus-apps that has the networkId parameters fix
bladyjoker Nov 8, 2022
8bf3672
Merge branch 'master' into bladyjoker/sam/add-vasil-features
mikekeke Nov 8, 2022
3192cd5
Upgrade to latest plutus-apps and src compiles but tests are still br…
bladyjoker Nov 8, 2022
5c25348
Merge remote-tracking branch 'origin/bladyjoker/sam/add-vasil-feature…
bladyjoker Nov 8, 2022
c6afc3b
Merge pull request #158 from mlabs-haskell/bladyjoker/sam/add-vasil-f…
bladyjoker Nov 8, 2022
7fc08f1
fix utxo index creation during balancing
mikekeke Nov 9, 2022
6e420f0
Added reference inputs to budget estimation
bladyjoker Nov 9, 2022
7dbf853
Added datums from outputs in the list of all datum
bladyjoker Nov 9, 2022
3c2cbcf
FIx TxOutDatumNone handling
samuelWilliams99 Nov 11, 2022
e6c7984
Fix file writing for inline datums
samuelWilliams99 Nov 11, 2022
514556a
Format and lint
samuelWilliams99 Nov 11, 2022
734ca03
Implement partial signing, export getter function
samuelWilliams99 Nov 11, 2022
4814887
Fixed missing import
bladyjoker Nov 11, 2022
038e2d4
Made the tests compile, but definitely not passing
bladyjoker Nov 12, 2022
f0bc00f
Hacked together a fix for half-signing transactions
bladyjoker Nov 13, 2022
b898468
Fix partial signatures
samuelWilliams99 Nov 14, 2022
db56015
Only sign if able
samuelWilliams99 Nov 14, 2022
8c88442
Don't move signed files when signing didn't occur
bladyjoker Nov 14, 2022
936ee39
Add metadata support back
samuelWilliams99 Nov 15, 2022
b984a12
Fix nft example
samuelWilliams99 Nov 15, 2022
0672f5b
Fix tests
samuelWilliams99 Nov 15, 2022
14246d6
Format cabal files
samuelWilliams99 Nov 15, 2022
4ed6e0c
Add more CI checks
samuelWilliams99 Nov 15, 2022
f622fff
Fix lint check
samuelWilliams99 Nov 15, 2022
92c42bb
Small fixes, formatting
samuelWilliams99 Nov 15, 2022
ff9dd82
First review round
samuelWilliams99 Nov 17, 2022
78ff3ff
Final review changes
samuelWilliams99 Nov 17, 2022
6e850ed
Fix tests
samuelWilliams99 Nov 17, 2022
5a37868
Calculate slotlength over hardcode
samuelWilliams99 Nov 18, 2022
b402e0d
Address review comments
samuelWilliams99 Nov 24, 2022
946e8d1
Update comment about hack
samuelWilliams99 Nov 24, 2022
b337b85
Fix import
samuelWilliams99 Nov 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ nixpkgsfmt: requires_nix_shell
nixpkgsfmt_check: requires_nix_shell
nixpkgs-fmt --check $(NIX_SOURCES)

# Check with hlint, currently I couldn't get --refactor to work
# Check with hlint
lint: requires_nix_shell
echo "$(FORMAT_SOURCES)" | xargs -n 1 -t hlint --refactor --refactor-options="--inplace"

lint_check: requires_nix_shell
hlint $(FORMAT_SOURCES)

readme_contents:
Expand Down
10 changes: 10 additions & 0 deletions bot-plutus-interface.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ library
BotPlutusInterface.CoinSelection
BotPlutusInterface.Collateral
BotPlutusInterface.Config
BotPlutusInterface.Constraints
BotPlutusInterface.Contract
BotPlutusInterface.Effects
BotPlutusInterface.ExBudget
BotPlutusInterface.Files
BotPlutusInterface.Helpers
BotPlutusInterface.Metadata
BotPlutusInterface.Server
BotPlutusInterface.TimeSlot
BotPlutusInterface.Types
Expand All @@ -105,15 +107,20 @@ library
build-depends:
, aeson
, attoparsec >=0.13.2.2
, base16
, basement
, bytestring ^>=0.10.12.0
, cardano-api
, cardano-crypto
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-ledger-alonzo
, cardano-ledger-babbage
, cardano-ledger-core
, cardano-ledger-shelley
, cardano-prelude
, cardano-slotting
, cborg
, config-schema
, config-value
, containers
Expand Down Expand Up @@ -200,6 +207,8 @@ test-suite bot-plutus-interface-test
, bytestring ^>=0.10.12.0
, cardano-api
, cardano-crypto-class
, cardano-prelude
, cardano-slotting
, containers
, data-default
, data-default-class
Expand Down Expand Up @@ -241,6 +250,7 @@ test-suite bot-plutus-interface-test
, tasty-quickcheck
, temporary
, text ^>=1.2.4.0
, transformers-either
, utf8-string
, uuid
, vector
Expand Down
1 change: 1 addition & 0 deletions examples/plutus-nft/plutus-nft.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ library
, aeson
, attoparsec >=0.13.2.2
, base16-bytestring
, bot-plutus-interface
, bytestring ^>=0.10.12.0
, cardano-api
, cardano-crypto
Expand Down
14 changes: 9 additions & 5 deletions examples/plutus-nft/src/Cardano/PlutusExample/NFT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

module Cardano.PlutusExample.NFT where

import Cardano.Api.Shelley (PlutusScript (..), PlutusScriptV1)
import BotPlutusInterface.Constraints (mustIncludeMetadata, submitBpiTxConstraintsWith)
import BotPlutusInterface.Metadata (NftMetadata (NftMetadata), NftMetadataToken (NftMetadataToken), TxMetadata (TxMetadata))
import Cardano.Api.Shelley (PlutusScript (PlutusScriptSerialised), PlutusScriptV1)
import Codec.Serialise (serialise)
import Control.Monad (void)
import Data.Aeson.TH (defaultOptions, deriveJSON)
Expand Down Expand Up @@ -31,7 +33,7 @@ import Ledger.Constraints as Constraints
import Ledger.Scripts qualified as Scripts
import Ledger.Typed.Scripts qualified as TypedScripts
import Ledger.Value (flattenValue, singleton)
import Plutus.Contract (Contract, Endpoint, submitTxConstraintsWith, tell, utxosAt)
import Plutus.Contract (Contract, Endpoint, tell, utxosAt)
import Plutus.Contract qualified as Contract
import Plutus.Script.Utils.V1.Scripts qualified as ScriptUtils
import PlutusTx qualified
Expand Down Expand Up @@ -100,8 +102,6 @@ mintNft MintParams {..} = do
tell $ Last $ Just $ "Using oref:" Hask.<> Text.pack (Hask.show oref)
let cs = curSymbol oref mpTokenName
val = singleton cs mpTokenName 1
-- TODO: Add metadata in the tx.
-- Currently this is not possible, as metadata is not supported.
lookups =
Hask.mconcat
[ Constraints.plutusV1MintingPolicy (policy oref mpTokenName)
Expand All @@ -113,6 +113,10 @@ mintNft MintParams {..} = do
, Constraints.mustSpendPubKeyOutput oref
, Constraints.mustPayToPubKeyAddress mpPubKeyHash mpStakeHash val
]
void $ submitTxConstraintsWith @Void lookups tx
tokenMetadata = NftMetadataToken mpName mpImage (Just "image/jpeg") mpDescription Hask.mempty Hask.mempty
txMetadata = TxMetadata (Just $ NftMetadata $ Map.singleton cs $ Map.singleton mpTokenName tokenMetadata) Hask.mempty
bpiConstraints = mustIncludeMetadata txMetadata

void $ submitBpiTxConstraintsWith @Void lookups tx bpiConstraints
Contract.logInfo @Hask.String $ printf "forged %s" (Hask.show val)
tell $ Last $ Just "Finished"
52 changes: 17 additions & 35 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 46 additions & 40 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@
url = "github:input-output-hk/hedgehog-extras/714ee03a5a786a05fc57ac5d2f1c2edce4660d85";
flake = false;
};
hysterical-screams = {
url = "github:raduom/hysterical-screams/4c523469e9efd3f0d10d17da3304923b7b0e0674";
flake = false;
};
hw-aeson = {
url = "github:haskell-works/hw-aeson/b5ef03a7d7443fcd6217ed88c335f0c411a05408";
flake = false;
Expand All @@ -105,14 +101,14 @@
"github:input-output-hk/ouroboros-network/cb9eba406ceb2df338d8384b35c8addfe2067201";
flake = false;
};
plutus = {
plutus-core = {
url =
"github:input-output-hk/plutus/a56c96598b4b25c9e28215214d25189331087244";
flake = false;
};
plutus-apps = {
url =
"github:mlabs-haskell/plutus-apps/31bfd4c7fff5158c9f2618b76b68dbbae410221d";
"github:input-output-hk/plutus-apps/a2045141fc0b4f14470ebf4679c6abe40aac4db7";
flake = false;
};
purescript-bridge = {
Expand Down Expand Up @@ -290,10 +286,6 @@
src = inputs.hedgehog-extras;
subdirs = [ "." ];
}
{
src = inputs.hysterical-screams;
subdirs = [ "." ];
}
{
src = inputs.hw-aeson;
subdirs = [ "." ];
Expand Down Expand Up @@ -339,7 +331,7 @@
];
}
{
src = inputs.plutus;
src = inputs.plutus-core;
subdirs = [
"plutus-core"
"plutus-ledger-api"
Expand All @@ -353,22 +345,27 @@
{
src = inputs.plutus-apps;
subdirs = [
"cardano-streaming"
"doc"
"freer-extras"
"marconi"
"marconi-mamba"
"playground-common"
"pab-blockfrost"
"plutus-chain-index"
"plutus-chain-index-core"
"plutus-hysterical-screams"
"plutus-contract"
"plutus-contract-certification"
"plutus-example"
"plutus-ledger"
"plutus-ledger-constraints"
"plutus-pab"
"plutus-pab-executables"
"plutus-playground-server"
"plutus-script-utils"
"plutus-streaming"
"plutus-tx-constraints"
"plutus-use-cases"
"rewindable-index"
"web-ghc"
];
}
Expand Down Expand Up @@ -402,33 +399,36 @@
let
pkgs = nixpkgsFor system;
pkgs' = nixpkgsFor' system;
in
pkgs.haskell-nix.cabalProject' {
src = ./.;
inherit cabalProjectLocal extraSources;
name = "bot-plutus-interface";
compiler-nix-name = "ghc8107";
shell = {
additional = ps: [
ps.plutus-pab
];
withHoogle = true;
tools.haskell-language-server = { };
exactDeps = true;
nativeBuildInputs = with pkgs'; [
cabal-install
haskellPackages.cabal-fmt
haskellPackages.implicit-hie
haskellPackages.fourmolu
hlint
jq
websocat
fd
nixpkgs-fmt
];
project = pkgs.haskell-nix.cabalProject' {
src = ./.;
inherit cabalProjectLocal extraSources;
name = "bot-plutus-interface";
compiler-nix-name = "ghc8107";
shell = {
additional = ps: [
ps.plutus-pab
];
withHoogle = true;
tools.haskell-language-server = { };
exactDeps = true;
nativeBuildInputs = with pkgs'; [
cabal-install
haskellPackages.cabal-fmt
haskellPackages.implicit-hie
haskellPackages.fourmolu
haskellPackages.apply-refact
hlint
jq
websocat
fd
nixpkgs-fmt
project.hsPkgs.cardano-cli.components.exes.cardano-cli
];
};
modules = haskellModules;
};
modules = haskellModules;
};
in
project;

formatCheckFor = system:
let
Expand All @@ -441,7 +441,7 @@
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export IN_NIX_SHELL='pure'
make format_check cabalfmt_check nixpkgsfmt_check lint
make format_check cabalfmt_check nixpkgsfmt_check lint_check
mkdir $out
'';

Expand Down Expand Up @@ -475,5 +475,11 @@
checks = perSystem (system: self.flake.${system}.checks // {
formatCheck = formatCheckFor system;
});

hydraJobs = {
checks = { inherit (self.checks) x86_64-linux; };
packages = { inherit (self.packages) x86_64-linux; };
devShells = { inherit (self.devShells) x86_64-linux; };
};
};
}
Loading