importblocks CLI Tool
Overview
importblocks
is a command-line tool designed to test JAM implementations by generating and sending a stream of blocks (both valid and invalid) to a team-specified HTTP or QUIC endpoint. The importblocks
is part of a larger test suite to help teams verify their block validation logic by sending a variety of block scenarios in different modes and checking if an implementation is correctly able to validate blocks. Implementations should determine if the blocks are valid and subsequently advance their chain based on this validation, updating the state trie if valid and outputting key value pairs with a state root. A genesis state/configuration may be supplied.
The specific goal for importblocks
to support JAM implementation teams to reach M1 Import Blocks + M2 Author milestones at present. We envision it can support mature JAM implementations beyond this use case as part of a larger advanced JAM Supercomputing Test Suite.
Important: As of December 2024, this is in concept stage only and is a community-generated effort, not from W3F or Parity. Any implementation of importblocks
should be considered unofficial and any success metrics, while aiming to be 100% diagnostic, have nothing to do technically for JAM Prize milestone achievements. A more official version of this can be expected to be supplied by W3F (see this issue).
importblocks
supports the following modes:
- fallback: Generates extrinsic-less blocks.
- safrole: Generates blocks with tickets extrinsics only.
- assurances: Generates blocks with extrinsics of guarantees, assurances, and preimages in addition to tickets
Additional modes are planned, as documented below.
Features
- HTTP and QUIC Communication: Choose between HTTP or QUIC to deliver blocks to a team’s validation endpoint.
- Block Generation: Programmatically generates blocks based on different modes, producing valid and invalid cases for testing.
- Randomized Validity: Each block generated by
importblocks
can be valid or invalid, challenging teams to determine the block’s correctness. - Detailed Grading: When enabled, the
--verbose
flag dumps the correct answer (expected key-value pairs and state root) for comparison with the team’s response.
Installation
(PLANNED/UNDER DEVELOPMENT by JAM Duna team (colorful notion), but any team can build this with their own JAM implementation.)
Prerequisites
- Docker: Ensure Docker is installed and running on your system.
Running with Docker
- Pull the
importblocks
Docker image from the GCP container registry:
docker pull gcr.io/jamduna-org/importblocks:latest
- Run the
importblocks
container with the required flags:
docker run --rm \
gcr.io/jamduna-org/importblocks:latest \
--mode=fallback --http=http://yourcorejam.network/validate --verbose
Usage
Command Syntax
docker run --rm \
gcr.io/jamduna-org/importblocks:latest \
--mode=<mode> [--http=<url> | --quic=<ip:port>] [options]
Modes
fallback
: Generates extrinsic-less blocks (