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

SCP-3073: emulated ledger #336

Merged
merged 25 commits into from
Mar 9, 2022
Merged

SCP-3073: emulated ledger #336

merged 25 commits into from
Mar 9, 2022

Conversation

sjoerdvisscher
Copy link
Contributor

@sjoerdvisscher sjoerdvisscher commented Mar 1, 2022

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • 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

@sjoerdvisscher sjoerdvisscher force-pushed the SCP-3073-emulated-ledger branch 2 times, most recently from 600eefe to f25ae01 Compare March 4, 2022 15:52
# Conflicts:
#	plutus-contract/src/Plutus/Contract/Wallet.hs
#	plutus-contract/src/Wallet/Emulator/Wallet.hs
#	plutus-contract/test/Spec/Emulator.hs
#	plutus-contract/test/Spec/golden/traceOutput - pubKeyTransactions.txt
#	plutus-contract/test/Spec/golden/traceOutput - pubKeyTransactions2.txt
#	plutus-contract/test/Spec/golden/traceOutput - wait1.txt
#	plutus-ledger/src/Ledger/Tx/CardanoAPI.hs
#	plutus-pab/src/Cardano/Node/Types.hs
#	plutus-pab/src/Cardano/Wallet/Mock/Handlers.hs
#	plutus-pab/src/Cardano/Wallet/Mock/Server.hs
#	plutus-pab/src/Plutus/PAB/Run/Cli.hs
#	plutus-use-cases/test/Spec/crowdfundingEmulatorTestOutput.txt
@sjoerdvisscher sjoerdvisscher marked this pull request as ready for review March 5, 2022 19:37
plutus-ledger/src/Ledger/Tx.hs Show resolved Hide resolved
plutus-contract/src/Wallet/Emulator/Chain.hs Show resolved Hide resolved
let requiredSigners = Map.keys (U.unBalancedTxRequiredSignatories utx)
theFee <- either (throwError . WAPI.ToCardanoError) pure $ evaluateTransactionFee requiredSigners tx
tx' <- handleBalanceTx utxo (utx & U.tx . Ledger.fee .~ theFee)
cTx <- either (throwError . WAPI.ToCardanoError) pure $ fromPlutusTx requiredSigners tx'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to convert to CardanoApi's tx?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only place where this is possible since we have the required signers here.
I have added an explanation in the note that explains why we have the Both constructor.

plutus-ledger/src/Ledger/Validation.hs Outdated Show resolved Hide resolved
@sjoerdvisscher
Copy link
Contributor Author

@koslambrou Thanks, this was one of those times where I ran out of stamina and forgot about the documentation.

@koslambrou
Copy link
Contributor

LGTM! Thanks for the clarification @sjoerdvisscher :)

@koslambrou koslambrou merged commit 2bfeae0 into main Mar 9, 2022
@koslambrou koslambrou deleted the SCP-3073-emulated-ledger branch March 9, 2022 15:23
bwbush pushed a commit that referenced this pull request Mar 11, 2022
…o-ledger (#336)

* Detect validation errors with cardano-ledger-specs

* Calculate (almost) correct fees

* Include hashScriptIntegrity in TxBody

* Change CardanoTx from Either to These, and adopt it further

* Validate validityrange

* Make ledger validation errors fail the emulator validation

* Ada-only outputs for collateral

* Better fee calc, separate out CardanoTx signing

* Fix all use-cases tests (except 1 which is now disabled)

Co-authored-by: Jann Müller <j-mueller@users.noreply.github.com>
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