-
Notifications
You must be signed in to change notification settings - Fork 935
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document SSZ testing, and test-suite running
- Loading branch information
1 parent
0f87f35
commit d7d2eea
Showing
6 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# SSZ, generic tests | ||
|
||
This set of test-suites provides general testing for SSZ: | ||
to instantiate any container/list/vector/other type from binary data. | ||
|
||
Since SSZ is in a development-phase, not the full suite of features is covered yet. | ||
Note that these tests are based on the older SSZ package. | ||
The tests are still relevant, but limited in scope: | ||
more complex object encodings have changed since the original SSZ testing. | ||
|
||
A minimal but useful series of tests covering `uint` encoding and decoding is provided. | ||
This is a direct port of the older SSZ `uint` tests (minus outdated test cases). | ||
|
||
[uint test format](./uint.md). | ||
|
||
Note: the current phase-0 spec does not use larger uints, and uses byte vectors (fixed length) instead to represent roots etc. | ||
The exact uint lengths to support may be redefined in the future. | ||
|
||
Extension of the SSZ tests collection is planned, with an update to the new spec-maintained `minimal_ssz.py`, | ||
see CI/testing issues for progress tracking. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SSZ, static tests | ||
|
||
This set of test-suites provides static testing for SSZ: | ||
to instantiate just the known ETH-2.0 SSZ types from binary data. | ||
|
||
This series of tests is based on the spec-maintained `minimal_ssz.py`, i.e. fully consistent with the SSZ spec. | ||
|
||
Test format documentation can be found here: [core test format](./core.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Test format: SSZ static types | ||
|
||
The goal of this type is to provide clients with a solid reference how the known SSZ objects should be encoded. | ||
Each object described in the Phase-0 spec is covered. | ||
This is important, as many of the clients aiming to serialize/deserialize objects directly into structs/classes | ||
do not support (or have alternatives for) generic SSZ encoding/decoding. | ||
This test-format ensures these direct serializations are covered. | ||
|
||
## Test case format | ||
|
||
```yaml | ||
type_name: string -- string, object name, formatted as in spec. E.g. "BeaconBlock" | ||
value: dynamic -- the YAML-encoded value, of the type specified by type_name. | ||
serialized: bytes -- string, SSZ-serialized data, hex encoded, with prefix 0x | ||
root: bytes32 -- string, hash-tree-root of the value, hex encoded, with prefix 0x | ||
``` | ||
|
||
## Condition | ||
|
||
A test-runner can implement the following assertions: | ||
- Serialization: After parsing the `value`, SSZ-serialize it: the output should match `serialized` | ||
- Hash-tree-root: After parsing the `value`, Hash-tree-root it: the output should match `root` | ||
- Deserialization: SSZ-deserialize the `serialized` value, and see if it matches the parsed `value` |