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

Add initial PVM test vectors #3

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e285daa
Add initial PVM test vectors
koute Jun 24, 2024
19d2ad8
Pre-clobber the output reg in `inst_div_unsigned_with_overflow`
koute Jun 25, 2024
9ba4b5b
Replace underscores with hypens, because ASN.1 doesn't like underscores
koute Jun 25, 2024
e89f6b7
Add JSON Schema and ASN.1 schema
koute Jun 25, 2024
96025c7
Add comments to the ASN.1 schema, reference the paper, update README
koute Jun 25, 2024
1d43b7d
Add the instruction/program counter to the tests
koute Jun 25, 2024
9b35cf4
Correct the expected PC for when the program halts
koute Jun 25, 2024
f4c9f3f
Add tests involving memory
koute Jun 25, 2024
dbbfbd4
Remove accidental `OPTIONAL` from the ASN.1 schema
koute Jun 25, 2024
3e18a7f
Add gas
koute Jun 26, 2024
e267a75
Rename `code` -> `program`
koute Jun 26, 2024
5581280
Fix some typos in the ASN.1 schema
koute Jun 26, 2024
a2b1870
Align reg3 serialization with the GP and add extra testcases
koute Jun 28, 2024
0a4c99b
PVM tests v0.2: add 'invalid' to disassemblies to mark implicit traps
koute Oct 4, 2024
8659541
PVM tests v0.2: bitmask paddings are now filled with zeros
koute Oct 4, 2024
fb4de8a
PVM tests v0.2: `inst_rem_signed`: make output non-zero
koute Oct 4, 2024
fa6cf0a
PVM tests v0.2: `inst_rem_signed_with_overflow`: non-zero initial val…
koute Oct 4, 2024
83596b5
PVM tests v0.2: `inst_set_*`: non-zero initial value of output reg
koute Oct 4, 2024
51e134e
PVM tests v0.2: add more load/store tests
koute Oct 4, 2024
30ba85a
PVM tests v0.2: update README
koute Oct 4, 2024
a54d7cf
PVM tests v0.3: remove tests which expose gas precharging
koute Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions pvm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# PVM Test Vectors, version 0.3

## How to use this

The [`programs`](./programs) directory contains `.json` files, each containing a single test.

These are meant to test the PVM function Ψ from the Graypaper's Appendix A (equation 203 from v0.2.1 of the paper).

See [schema.asn](./schema.asn) for a human-readable schema of what each of the fields mean.

See [schema.json](./schema.json) for a JSON Schema.

See [TESTCASES.md](./TESTCASES.md) for a human-readable index of all of the test cases.

## TODO

* 100% instruction coverage
* Tests for abnormal skip values for each instruction type
* Tests for when the initial instruction counter (ı) starts somewhere else than 0
* Tests involving host calls
* Tests for invalid/malformed program blobs
* Add bigger integration-like tests
* More gas metering tests; proper gas cost model (current one is a placeholder)

## Changelog

### v0.3

* Removed tests which were testing gas behavior that is not yet described in the GP:
- `inst_load_u8_trap.json`,
- `inst_store_u8_trap_inaccessible`
- `inst_store_u8_trap_read_only`

### v0.2

* Bitmask paddings are now filled with zeros, in alignment with the GP.
* Disassemblies now end with an `invalid` instruction to signify places where
the execution traps when going out of bounds. This is a purely cosmetic change
to the reference disassemblies and doesn't affect the test vectors themselves.
* The `inst_rem_signed` test was changed to make the output value non-zero.
(The behavior is unchanged; the instruction still works the same as before.)
* Set the initial value of the output register to a non-zero for the following tests:
(The behavior is unchanged; the instructions still work the same as before.)
- `inst_rem_signed_with_overflow`
- `inst_set_greater_than_signed_imm_0`
- `inst_set_greater_than_unsigned_imm_0`,
- `inst_set_less_than_signed_0`
- `inst_set_less_than_signed_imm_0`
- `inst_set_less_than_unsigned_0`,
- `inst_set_less_than_unsigned_imm_0`
* Add new tests:
- `inst_load_i16`
- `inst_load_i8`
- `inst_load_imm_and_jump`
- `inst_load_indirect_i16_with_offset`
- `inst_load_indirect_i16_without_offset`
- `inst_load_indirect_i8_with_offset`
- `inst_load_indirect_i8_without_offset`
- `inst_load_indirect_u16_with_offset`
- `inst_load_indirect_u16_without_offset`
- `inst_load_indirect_u32_with_offset`
- `inst_load_indirect_u32_without_offset`
- `inst_load_indirect_u8_with_offset`
- `inst_load_indirect_u8_without_offset`
- `inst_load_u16`
- `inst_load_u32`
- `inst_store_imm_u16`
- `inst_store_imm_u32`
- `inst_store_imm_u8`

### v0.1

* Initial test vectors.
Loading