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

Provide 'MustSatisfyAnyOf' constructor for TxContraints. #3706

Merged
merged 2 commits into from
Aug 12, 2021

Conversation

KtorZ
Copy link
Contributor

@KtorZ KtorZ commented Aug 6, 2021

It is actually useful in some cases to be able to perform a disjunction of constraints, and while it is possible to resort to 'Bool' in some cases, when using internal libraries like e.g. the state-machine, we are stuck with the TxConstraints API and therefore, unable to express some useful conditions.

Pre-submit checklist:

  • Branch
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Relevant tickets are mentioned in commit messages
    • Formatting, materialized Nix files, PNG optimization, etc. are updated
  • PR
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

@KtorZ KtorZ self-assigned this Aug 6, 2021
@KtorZ KtorZ requested a review from j-mueller August 6, 2021 16:27
@KtorZ
Copy link
Contributor Author

KtorZ commented Aug 9, 2021

Hydra is failing building marlowe-playground-server but the error seems quite unrelated to this PR 🤔

(https://hydra.iohk.io/build/7200402/nixlog/1)

Building library for marlowe-playground-server-0.1.0.0..
[ 1 of 13] Compiling API              ( src/API.hs, dist/build/API.o, dist/build/API.dyn_o )
[ 2 of 13] Compiling ContractForDifferences ( contracts/ContractForDifferences.hs, dist/build/ContractForDifferences.o, dist/build/ContractForDifferences.dyn_o )
[ 3 of 13] Compiling ContractForDifferencesWithOracle ( contracts/ContractForDifferencesWithOracle.hs, dist/build/ContractForDifferencesWithOracle.o, dist/build/ContractForDifferencesWithOracle.dyn_o )
[ 4 of 13] Compiling CouponBondGuaranteed ( contracts/CouponBondGuaranteed.hs, dist/build/CouponBondGuaranteed.o, dist/build/CouponBondGuaranteed.dyn_o )
[ 5 of 13] Compiling Escrow           ( contracts/Escrow.hs, dist/build/Escrow.o, dist/build/Escrow.dyn_o )
[ 6 of 13] Compiling EscrowWithCollateral ( contracts/EscrowWithCollateral.hs, dist/build/EscrowWithCollateral.o, dist/build/EscrowWithCollateral.dyn_o )
[ 7 of 13] Compiling Example          ( contracts/Example.hs, dist/build/Example.o, dist/build/Example.dyn_o )
[ 8 of 13] Compiling Marlowe.Config   ( src/Marlowe/Config.hs, dist/build/Marlowe/Config.o, dist/build/Marlowe/Config.dyn_o )
[ 9 of 13] Compiling Marlowe.Contracts ( src/Marlowe/Contracts.hs, dist/build/Marlowe/Contracts.o, dist/build/Marlowe/Contracts.dyn_o )

<no location info>: error:
    <command line>: /nix/store/vm63fyjsjbqcmnw6kylrcz9ifp76xfbi-marlowe-lib-marlowe-0.1.0.0/lib/x86_64-linux-ghc-8.10.4.20210212/libHSmarlowe-0.1.0.0-1dEDJa0k8A4LsE0dVCOz0K-ghc8.10.4.20210212.so: undefined symbol: plutuszmtxzm0zi1zi0zi0zmDgtIhvifsQfC89lk90LbQY_PlutusTxziRatio_zdfFromJSONRatio1_closure
[10 of 13] Compiling Marlowe.Mermaid  ( src/Marlowe/Mermaid.hs, dist/build/Marlowe/Mermaid.o, dist/build/Marlowe/Mermaid.dyn_o )
[11 of 13] Compiling Server           ( src/Server.hs, dist/build/Server.o, dist/build/Server.dyn_o )
[12 of 13] Compiling Swap             ( contracts/Swap.hs, dist/build/Swap.o, dist/build/Swap.dyn_o )
[13 of 13] Compiling ZeroCouponBond   ( contracts/ZeroCouponBond.hs, dist/build/ZeroCouponBond.o, dist/build/ZeroCouponBond.dyn_o )
builder for '/nix/store/l03m2hdb1fr70jq5ji4yw5ilcpm154cw-marlowe-playground-server-lib-marlowe-playground-server-0.1.0.0.drv' failed with exit code 1

@michaelpj
Copy link
Contributor

Hydra has been doing that randomly 🤔

@michaelpj
Copy link
Contributor

You also need to update the plutus-use-cases test, since this changes the generated PIR.

cabal test plutus-use-cases-test --test-options=--accept

It'll take a while.

@KtorZ
Copy link
Contributor Author

KtorZ commented Aug 10, 2021

cabal test plutus-use-cases-test --test-options=--accept

Not exactly sure why now, but the linker fails for me on the plutus-playground-common...

>>> nix-shell
[nix-shell] $ cabal test plutus-use-cases-test --test-options=--accept
Resolving dependencies...
[...]
Configuring library for playground-common-0.1.0.0..
Preprocessing library for playground-common-0.1.0.0..
Building library for playground-common-0.1.0.0..
gcc: error: .../plutus/dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/playground-common-0.1.0.0/build/Auth.dyn_o: No such file or directory
gcc: error: .../plutus/dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/playground-common-0.1.0.0/build/Gist.dyn_o: No such file or directory
gcc: error: .../plutus/dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/playground-common-0.1.0.0/build/PSGenerator/Common.dyn_o: No such file or directory
gcc: error: .../plutus/dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/playground-common-0.1.0.0/build/Playground/API.dyn_o: No such file or directory
gcc: error: .../plutus/dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/playground-common-0.1.0.0/build/Playground/Contract.dyn_o: No such file or directory
gcc: error: .../plutus/dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/playground-common-0.1.0.0/build/Playground/Interpreter/Util.dyn_o: No such file or directory
gcc: error: .../plutus/dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/playground-common-0.1.0.0/build/Playground/Schema.dyn_o: No such file or directory
gcc: error: .../plutus/dist-newstyle/build/x86_64-linux/ghc-8.10.4.20210212/playground-common-0.1.0.0/build/Playground/Types.dyn_o: No such file or directory
`cc' failed in phase `Linker'. (Exit code: 1)
cabal: Failed to build playground-common-0.1.0.0 (which is required by
test:plutus-use-cases-test from plutus-use-cases-0.1.0.0).

I am using the nix-shell but maybe I shouldn't?

@j-mueller
Copy link
Contributor

Seems like a cabal issue, running the tests in nix-shell as you described normally works for me. Maybe run cabal clean and try again.

  It is actually useful in some cases to be able to perform a disjunction of constraints, and while it is possible to resort to 'Bool' in some cases, when using internal libraries like e.g. the state-machine, we are stuck with the TxConstraints API and therefore, unable to express some useful conditions.
@KtorZ
Copy link
Contributor Author

KtorZ commented Aug 12, 2021

Okay, should be fine now. cabal clean helped 🤷

@j-mueller j-mueller merged commit 0e75f03 into master Aug 12, 2021
@j-mueller j-mueller deleted the KtorZ/MustSatisfyAnyOf branch August 12, 2021 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants