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

Vasil HF PlutusV2 Tests #1079

Closed
catch-21 opened this issue May 10, 2022 · 0 comments
Closed

Vasil HF PlutusV2 Tests #1079

catch-21 opened this issue May 10, 2022 · 0 comments

Comments

@catch-21
Copy link
Contributor

catch-21 commented May 10, 2022

This is a checklist for testing for Vasil HF with a focus on Plutus V2 functionality. We can break these points out to automate regression tests.

Acceptance Criteria

Out of scope

  • Anything to do with testing hte HFC event is covered by SPOs and regression tests
  • serialiseData covered by Hydra Team
  • VRF covered by SPOs and regression tests
  • Anything to do with protocol update proposals should be covered by regression tests

CIP-0031 Reference Inputs

  • Plutus correctly observes everything available in an Alonzo txout (created pre-Vasil): value, tokens, datum hash.
  • Try referencing same input multiple times for single transaction (no duplicates should arise in TxInfo)
  • Try referencing spent outputs - raised [BUG] - vague cli error when spending reference input is not present in ledger state cardano-node#4012
  • Try referencing an output that is also a regular input of the same transaction (is there conflict and does cli option order affect the outcome). I expect no conflict and TxInfo should have the txo as both both a regular and reference input.
  • Confirm that the spending conditions on referenced outputs are not checked
  • Confirm that reference input cannot be at Byron address - error is ByronTxOutInContext
  • Byron addresses are not allowed to be in PlutusV2 ScriptContext
  • Large number of reference inputs can be seen in script context
  • transaction view shows correct reference input details
  • cli includes fee in calculation for additional reference inputs
  • (AC) Two different transactions can fetch the same reference input in the same block.

CIP-0032 Inline datums (quotes are from cip spec)

  • Can spend output with inline datum attached and this removes it from ledger state
  • Is invalid to include datum as both witness and input (ledger error is NonOutputSupplimentaryDatums)
    • Also try as embedded/optional datum (shouldn't be invalid to combine with inline datum)
  • Try attaching datum that is not valid or well-formed script data
  • Try referencing two outputs that both hold the exact same datum (TxInfo should behave correctly)
  • Is there a way to break CLI displaying large attached datum (try multiple utxos with large or deeply nested json) - Doesn't seem to break but things start looking funky!
  • Confirm that attached BS datum and datum hash are distinctly different enough to not fool a cli output parser
  • Prove that "Scripts with old versions cannot be spent in transactions that include inline datums, attempting to do so will be a phase 1 transaction validation failure."
  • Datum witnessing requirements cannot be satisfied with reference inputs. Outputs with hashes must have datum included in transaction body as witness. We should prove that:
    • "when an output with an inline datum is spent, the spending transaction does not need to provide the datum itself."
    • a reference input with datum requires no witness, and so it should only be visible in TxOut and not txInfoData map.
  • Plutus can see regular inline datum in txInfoInputs
  • Plutus can see referenced inline datum in txInfoReferenceInputs
  • Large inline datums - cli correctly complains if exceeding tx size limit but it hangs on submit if the datum is overly large
  • Can be spent from vkey address
    • When no scripts are being executed
    • When some script is being executed (e.g. minting policy)
  • transaction view shows correct inline datum details
  • cli includes fee in calculation

CIP-0033 Reference Scripts

  • Spending script with datum hash
  • Spending script with inline datum - raised [BUG] - Cli prevents spending from script with inline datum at same utxo cardano-node#3917
  • Minting scripts
    • Simple script (minting policy)
      • The same policy referenced twice ?
      • in combination with PlutusV2
    • PlutusV2 script, in combination with:
      • Reference PlutusV2 spending script
      • Reference PlutusV2 minting script
      • Attached PlutusV1 script - see error ReferenceInputsNotSupported
      • Attached PlutusV2 minting script
      • The same policy referenced twice - cli doesn't allow it (only uses last occurrence)
      • Consume reference input at same time as using its script for minting
    • Can spend output with minting script from spending script address
    • Can spend output with minting script from vkey address - Blocked by [BUG] - Not possible to spend output with plutus reference script attached from vkey address cardano-node#4057
    • Burn
      • Can't have negative value of an asset - Error: Negative quantity (-1) in transaction output
  • Staking cert script - covered by https://github.com/input-output-hk/cardano-node/blob/master/scripts/babbage/staking-example/register-and-deglegate-script-staking-address.sh
  • Withdrawal script - covered by https://github.com/input-output-hk/cardano-node/blob/master/scripts/babbage/staking-example/claim-script-staking-rewards.sh
  • Can spend output with reference script at script address
    • Simple script
    • Reference script
  • Can spend output with reference script at vkey address - raised [BUG] - Not possible to spend output with plutus reference script attached from vkey address cardano-node#4057
    • Simple script
    • Reference script
    • Shelley address
    • Byron address
  • Plutus can see regular input script hash txInfoInputs
  • Plutus can see reference input script hash txInfoReferenceInputs
  • Reference and execute multiple of the same spending script in the same transaction - (AC) uses multiple inline datums
  • Reference and execute multiple different spending script in the same transaction
  • Reference wrong spending script when spending from script address - Correctly fails, error is RdmrPtr Spend 1 points to a Plutus script that does not exist.
  • Reference scripts are not run when not needed (e.g. referenced but transaction is not spending from its script address)
    • When spending a key-locked output and also referencing a script that doesn't need to run (don't provide collateral or pparams)
      • PlutusV1 script (V1 should work is not being executed)
      • PlutusV2 spending script
      • PlutusV2 minting script
      • Simple script
    • When running a spending script and also referencing a script that doesn't need to run
      • PlutusV1 script (V1 should work is not being executed)
      • PlutusV2 spending script
      • PlutusV2 minting script
      • Simple script
    • When minting and also referencing a script that doesn't need to run
      • Minting with attached PlutusV2 script
      • Minting with reference PlutusV2 script
      • Minting with attached simple script
      • Minting with reference simple script
  • Inspect or read a script stored onchain using node-cli - used query cmd to produce output file
  • Produce a valid transaction with both a reference script and datum at same utxo input
  • Prove that calculated fee and collateral are cheaper when using a reference script
  • Collateral is correctly taken for failing reference script
  • Mix of attached and reference scripts in a single valid transaction
  • Try attaching the same script that is being referenced - Correctly errors ExtraneousScriptWitnessesUTXOW
    • PlutusV2 spending script
    • PlutusV2 minting script
  • Try referencing and attaching different scripts in a single transaction and prove correct output if only one fails or if both pass
  • Try attaching and referencing a pre-Vasil (V1) script - should fail phase1 validation only when script executes - Command failed: transaction build Error: Error translating the transaction context: ReferenceInputsNotSupported
  • Try attaching and referencing something that is not a script or is not well-formed
    • Simple script
    • PlutusV1 script
    • PlutusV2 script
  • Change type from Simple to Plutus before attaching and referencing, and vice versa
  • Change type from PlutusV1 to PlutusV2 before attaching and referencing,, and vice versa
  • Correctly runs referenced simple script (aka native, aka phase1)
    • Timelock
    • Multisig
  • Collateral input cannot be from a script address
  • transaction view shows correct reference script details
  • cli includes fee in calculation

Return Collateral

  • Is always optional to include in transaction, even when script is invoked
  • Ada-only collateral has been dropped when collateral return is provided
  • Ada-only for collateral input remains when collateral return is omitted
  • Behaves as expected when combining referenced scripts, scripts embedded in the transaction, inline datum, tokens.
  • When collateral return is included and input collateral equals total collateral then the minUtxo constraint shouldn't fail like [BUG] - transaction build attempts to create UTxO with 0 lovelace as change cardano-node#3041.
  • Returned output has index of number of txouts
  • --tx-total-collateral --tx-out-return-collateral don't prevent a successful non-plutus transaction
  • In combination with reference spending script
  • In combination with reference minting script
  • (AC) Cli automatically calculates return collateral - raised [FR] - CLI build cmd to calculate return collateral value cardano-node#3939
  • Cannot using collateral at script address
  • cli includes fee in calculation

Redeemers in TxInfo

  • Ensure redeemers for a mix of script purposes in transaction are visible in txInfoRedeemers (proved with multiple spending and a minting script in single transaction)
  • In combination with reference spending PlutusV2 script
  • In combination with reference minting PlutusV2 script

SECP256k1

  • Work with MLabs to test the 2 builtin functions - MLabs have demonstrated successful verification of both on vasil-testnet
  • Work with MLabs to automate the 2 builtin functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants