Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Chainscore/tessera-test-suites

Repository files navigation

Tessera Test Suites

This repository contains heavy test harnesses, performance benchmarks, and external test vectors for validating the Tessera JAM client implementation.

⚠️ This repo is not a Python package. It is a test suite powered by pytest, intended to be run alongside the tessera repository via a local path dependency.


πŸ—‚οΈ Directory Structure

tessera-test-suites/
β”œβ”€β”€ ext/
β”‚ └── w3f/
β”‚ └── safrole/
β”‚ β”œβ”€β”€ tiny/
β”‚ β”‚ └── test-case-1.json
β”‚ β”œβ”€β”€ trie/
β”‚ └── shuffle/
β”‚ └── jamduna/
β”œβ”€β”€ harness/
β”‚ └── w3f/
β”‚ └── stf/
β”‚ β”œβ”€β”€ transform/
β”‚ β”‚ β”œβ”€β”€ safrole.py # Defines transform_block, transform_state, transition
β”‚ └── test_w3f_vectors.py
β”‚ β”œβ”€β”€ trie/
β”‚ └── shuffle/
β”œβ”€β”€ perf/ # Micro-benchmarks and perf tests
β”œβ”€β”€ scripts/ # Helper scripts (e.g., vector updater)
β”œβ”€β”€ vendor/ # External vector sets (added via git submodules)
β”œβ”€β”€ README.md # You are here
β”œβ”€β”€ pyproject.toml # Uses UV workspaces, inherits test deps from main project

πŸ§‘β€πŸ’» Setup

Package up Tessera and install it

git clone https://github.com/Chainscore/tessera.git
cd tessera
pip install -e .

YOu should see something like this:

Installing collected packages: tessera
 Attempting uninstall: tessera
 Found existing installation: tessera 0.1.0
 Uninstalling tessera-0.1.0:
 Successfully uninstalled tessera-0.1.0
Successfully installed tessera-0.1.0

πŸ§ͺ How to Test?

W3F STF Modules

To run tests for a specific STF module, such as safrole, use:

pytest -s -vv -q harness/w3f/stf --module safrole

This command:

  • Runs all vector tests for the safrole STF
  • Uses the default spec = tiny and pattern = *.json
  • Shows verbose output (-vv) and real-time print() logs (-s)
  • Strips pytest noise (-q)

We do:

  • Implement transform_block, transform_state, and transition in each transform/{module}.py.
  • Use to_json() or from_json() methods for serializing/deserializing custom objects.
  • Use DeepDiff to get readable diffs when test vectors fail.

πŸ”§ Command-Line Parameters

You can customize your test runs using the following CLI options (defined in conftest.py):

--module

Specifies which STF module to test. β€’ Must match the folder name in harness/w3f/stf/transform/ β€’ If omitted, runs all available modules

--module safrole
--module accumulate

--spec

Specifies the test vector spec directory to use (tiny, full, etc).

  • Path: ext/w3f/{module}/{spec}/
  • Default: tiny
--spec tiny
--spec full

--pattern

File pattern to match test vectors. β€’ Default: "*.json" β€’ Can be used to test only specific cases:

--pattern skip-*.json
--pattern test-42.json

🧭 Examples

Run all tests across all modules:

pytest -s -vv -q harness/w3f/stf

Run tests only for accumulate with full vectors:

pytest -s -vv -q harness/w3f/stf --module accumulate --spec full

Run just one test vector file in safrole:

pytest -s -vv -q harness/w3f/stf --module safrole --pattern publish-tickets*.json

PyTest Param

-s

Enable output from print() statements (useful for debugging).

-vv

Increase verbosity to show:

  • Test names
  • Param combinations (e.g., test_stf_vectors[accumulate-tiny-test42.json])

-q

Quiet modeβ€”removes test collection summary and extra logging.

Pull latest changes for all external vectors

To update all submodules in this repository to their latest remote commits, run:

git submodule update --init --recursive
git submodule foreach git fetch
git submodule foreach git checkout main # or the default branch for each submodule
git submodule foreach git pull

This will ensure all submodules are initialized, checked out to their main branch (or default), and updated to the latest remote changes. Adjust the branch name if your submodules use a different default branch.

About

Detailed Test Suite for JAM+Tessera

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /