This is intense, as we still want to preserve the serializer for V1 &
V2, and I've tried as much as possible to avoid polluting the
application layer with many enum types such as:
```
pub enum TxOut {
V1(TransactionOutput),
V2(TransactionOutput),
V3(TransactionOutput),
}
```
Those types make working with the script context cumbersome, and are
only truly required to provide different serialisation strategies. So
instead, we keep one top-level `TxInfo V1/V2/V3` type, and we ensure
to pass serialization strategies as type wrappers.
This way, the strategy propagates through the structure up until it's
eliminated when it reaches the relevant types.
All-in-all, this strikes a correct balance between maintainability and
repetition; and it makes it possible to define _different but mostly
identical_ encoders for the various versions.
With it, I've been able to successfully encode a V3 script context and
match it against one produced using the Haskell libraries. More to
come.
|
||
|---|---|---|
| .. | ||
| ctx | ||
| validators | ||
| .gitignore | ||
| README.md | ||
| aiken.lock | ||
| aiken.toml | ||
| plutus.json | ||
| test.sh | ||
README.md
V2 Script Context Tests
This project contains a few handcrafted Plutus V2 validators and transactions
whose sole purpose is to test the interpretation of the ScriptContext from
within an Aiken's validators.
So validators are meant to work hand-in-hand with an associated context. Because we can't have fully static context (since they contain the validator and its hash), we define templates.
Everything is a bit clunky, but steps have been captured in a test.sh script
for convenience.
How to use
./test.sh [VALIDATOR_TITLE]
Test Coverage
-
Purpose
- spend
- mint
- withdraw
- publish
-
Transaction
- inputs
- reference inputs
- outputs
- address
- verification key
- script
- pointer
- value
- datum
- none
- hash
- inline
- script
- none
- reference
- address
- values
- pure ada
- native assets
- fee
- mint
- certificates
- withdrawals
- verification key
- script
- validity range
- extra signatories
- redeemers
- datums