From a3078adce83f83cd167675016e67e3ced831d285 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Tue, 14 Feb 2023 16:25:17 +0100 Subject: [PATCH] Add succinct README to explain what's going on. --- .../script_context/.gitignore | 2 +- .../acceptance_tests/script_context/README.md | 18 +++++++++ .../ctx/basic/inputs.cbor.template | 1 + .../ctx/basic/outputs.cbor.template | 1 + .../script_context/ctx/basic/tx.cbor.template | 1 + .../script_context/ctx/basic/tx.diag.template | 32 +++++++++++++++ .../ctx/withdrawals/inputs.cbor.template | 1 + .../ctx/withdrawals/outputs.cbor.template | 1 + .../ctx/withdrawals/tx.cbor.template | 1 + .../ctx/withdrawals/tx.diag.template | 40 +++++++++++++++++++ 10 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 examples/acceptance_tests/script_context/README.md create mode 100644 examples/acceptance_tests/script_context/ctx/basic/inputs.cbor.template create mode 100644 examples/acceptance_tests/script_context/ctx/basic/outputs.cbor.template create mode 100644 examples/acceptance_tests/script_context/ctx/basic/tx.cbor.template create mode 100644 examples/acceptance_tests/script_context/ctx/basic/tx.diag.template create mode 100644 examples/acceptance_tests/script_context/ctx/withdrawals/inputs.cbor.template create mode 100644 examples/acceptance_tests/script_context/ctx/withdrawals/outputs.cbor.template create mode 100644 examples/acceptance_tests/script_context/ctx/withdrawals/tx.cbor.template create mode 100644 examples/acceptance_tests/script_context/ctx/withdrawals/tx.diag.template diff --git a/examples/acceptance_tests/script_context/.gitignore b/examples/acceptance_tests/script_context/.gitignore index f5d99950..f6631aa1 100644 --- a/examples/acceptance_tests/script_context/.gitignore +++ b/examples/acceptance_tests/script_context/.gitignore @@ -1 +1 @@ -data/**/*.cbor +ctx/**/*.cbor diff --git a/examples/acceptance_tests/script_context/README.md b/examples/acceptance_tests/script_context/README.md new file mode 100644 index 00000000..dc31ed3b --- /dev/null +++ b/examples/acceptance_tests/script_context/README.md @@ -0,0 +1,18 @@ +# Script Context Tests + +This project contains a few handcrafted 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] +``` diff --git a/examples/acceptance_tests/script_context/ctx/basic/inputs.cbor.template b/examples/acceptance_tests/script_context/ctx/basic/inputs.cbor.template new file mode 100644 index 00000000..e7f75b49 --- /dev/null +++ b/examples/acceptance_tests/script_context/ctx/basic/inputs.cbor.template @@ -0,0 +1 @@ +81825820000000000000000000000000000000000000000000000000000000000000000000 diff --git a/examples/acceptance_tests/script_context/ctx/basic/outputs.cbor.template b/examples/acceptance_tests/script_context/ctx/basic/outputs.cbor.template new file mode 100644 index 00000000..71a0de30 --- /dev/null +++ b/examples/acceptance_tests/script_context/ctx/basic/outputs.cbor.template @@ -0,0 +1 @@ +81A300581D70{{ VALIDATOR_HASH }}011A3B9ACA00028201D81843D87980 diff --git a/examples/acceptance_tests/script_context/ctx/basic/tx.cbor.template b/examples/acceptance_tests/script_context/ctx/basic/tx.cbor.template new file mode 100644 index 00000000..1b121c91 --- /dev/null +++ b/examples/acceptance_tests/script_context/ctx/basic/tx.cbor.template @@ -0,0 +1 @@ +84A70081825820000000000000000000000000000000000000000000000000000000000000000000018182581D60111111111111111111111111111111111111111111111111111111111A3B9ACA0002182A0B5820FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0D818258200000000000000000000000000000000000000000000000000000000000000000001082581D60000000000000000000000000000000000000000000000000000000001A3B9ACA001101A20581840000D87980821A000F42401A05F5E1000681{{ VALIDATOR }}F5F6 diff --git a/examples/acceptance_tests/script_context/ctx/basic/tx.diag.template b/examples/acceptance_tests/script_context/ctx/basic/tx.diag.template new file mode 100644 index 00000000..872528af --- /dev/null +++ b/examples/acceptance_tests/script_context/ctx/basic/tx.diag.template @@ -0,0 +1,32 @@ +[ + { 0: + [ [h'0000000000000000000000000000000000000000000000000000000000000000', 0] + ] + + , 1: + [ [h'6011111111111111111111111111111111111111111111111111111111', 1000000000] + ] + + , 2: 42 + + , 11: h'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' + + , 13: + [ [h'0000000000000000000000000000000000000000000000000000000000000000', 0] + ] + + , 16: + [ h'6000000000000000000000000000000000000000000000000000000000', 1000000000 + ] + + , 17: 1 + }, + + { 5: [[0, 0, 121([]), [1000000, 100000000]]] + + , 6: [h'VALIDATOR'] + + }, + true, + null +] diff --git a/examples/acceptance_tests/script_context/ctx/withdrawals/inputs.cbor.template b/examples/acceptance_tests/script_context/ctx/withdrawals/inputs.cbor.template new file mode 100644 index 00000000..e7f75b49 --- /dev/null +++ b/examples/acceptance_tests/script_context/ctx/withdrawals/inputs.cbor.template @@ -0,0 +1 @@ +81825820000000000000000000000000000000000000000000000000000000000000000000 diff --git a/examples/acceptance_tests/script_context/ctx/withdrawals/outputs.cbor.template b/examples/acceptance_tests/script_context/ctx/withdrawals/outputs.cbor.template new file mode 100644 index 00000000..71a0de30 --- /dev/null +++ b/examples/acceptance_tests/script_context/ctx/withdrawals/outputs.cbor.template @@ -0,0 +1 @@ +81A300581D70{{ VALIDATOR_HASH }}011A3B9ACA00028201D81843D87980 diff --git a/examples/acceptance_tests/script_context/ctx/withdrawals/tx.cbor.template b/examples/acceptance_tests/script_context/ctx/withdrawals/tx.cbor.template new file mode 100644 index 00000000..62f86104 --- /dev/null +++ b/examples/acceptance_tests/script_context/ctx/withdrawals/tx.cbor.template @@ -0,0 +1 @@ +84A80081825820000000000000000000000000000000000000000000000000000000000000000000018182581D60111111111111111111111111111111111111111111111111111111111A3B9ACA0002182A05A2581DE022222222222222222222222222222222222222222222222222222222182A581DF05E1E8FA84F2B557DDC362329413CAA3FD89A1BE26BFD24BE05CE0A020E0B5820FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0D818258200000000000000000000000000000000000000000000000000000000000000000001082581D60000000000000000000000000000000000000000000000000000000001A3B9ACA001101A20582840000D87980821A000F42401A05F5E100840301D87980821A000F42401A05F5E1000682{{ VALIDATOR }}58AF58AD0100003232322225333004323253330063372E646E64004DD7198009801002240009210D48656C6C6F2C20576F726C64210013233300100137586600460066600460060089000240206EB8CC008C00C019200022253335573E004294054CCC024CDC79BAE300A00200114A226660060066016004002294088C8CCC0040052000003222333300A3370E008004016466600800866E0000D2002300D001001235573C6EA8004526165734AE855D11F5F6 diff --git a/examples/acceptance_tests/script_context/ctx/withdrawals/tx.diag.template b/examples/acceptance_tests/script_context/ctx/withdrawals/tx.diag.template new file mode 100644 index 00000000..787cabbe --- /dev/null +++ b/examples/acceptance_tests/script_context/ctx/withdrawals/tx.diag.template @@ -0,0 +1,40 @@ +[ + { 0: + [ [h'0000000000000000000000000000000000000000000000000000000000000000', 0] + ] + + , 1: + [ [h'6011111111111111111111111111111111111111111111111111111111', 1000000000] + ] + + , 2: 42 + + , 5: + { h'e022222222222222222222222222222222222222222222222222222222': 42 + , h'f05e1e8fa84f2b557ddc362329413caa3fd89a1be26bfd24be05ce0a02': 14 + } + + , 11: h'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' + + , 13: + [ [h'0000000000000000000000000000000000000000000000000000000000000000', 0] + ] + + , 16: + [ h'6000000000000000000000000000000000000000000000000000000000', 1000000000 + ] + + , 17: 1 + }, + + { 5: + [ [0, 0, 121([]), [1000000, 100000000]] + , [3, 1, 121([]), [1000000, 100000000]] + ] + + , 6: [ h'58ad0100003232322225333004323253330063372e646e64004dd7198009801002240009210d48656c6c6f2c20576f726c64210013233300100137586600460066600460060089000240206eb8cc008c00c019200022253335573e004294054ccc024cdc79bae300a00200114a226660060066016004002294088c8ccc0040052000003222333300a3370e008004016466600800866e0000d2002300d001001235573c6ea8004526165734ae855d11' ] + + }, + true, + null +]