WASCII is a novel framework for aligning WebAssembly (WASM) specifications with runtime implementations and validating their correctness. It translates specifications into a structured four-layer checking tree, performs tentative alignment with runtime code, and uses execution-based validation to generate targeted test cases. These tests are consolidated into a conformance suite for differential testing across multiple WASM runtimes, uncovering specification-related inconsistencies.
Using Docker is recommended for a consistent build environment.
-
Build Docker Image:
docker build -t wascii -f env/Dockerfile . -
Run Docker Container: Mount the current directory to
/workspacefor file access.# Basic run docker run -it -v $(pwd):/workspace -w /workspace wascii /bin/bash # Run with debugging capabilities (required for GDB/ptrace) docker run -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \ -v $(pwd):/workspace -w /workspace wascii /bin/bash
Convert WASM specifications into a structured checking tree using both pattern-based and LLM-based methods, then merge the results.
-
Download Specifications:
./preprocess/download_spec.sh [--eval]
Output:
Eval/specsource/ -
Generate Pattern-Based Tree:
python3 preprocess/merge_valid_check_trees.py [--output xxx.yaml]
Output:
Eval/check_tree/spec/constraint_tree_valid.yaml -
Generate LLM-Based Tree:
python3 preprocess/extract_paragraphs.py python3 -m check_tree.traverse_spec_to_ir
Outputs:
Eval/check_tree/spec/extracted_paragraphs.json,Eval/check_tree/spec/constraint_tree_paragraphs.yaml -
Merge Trees:
python3 preprocess/merge_check_trees.py Eval/check_tree/spec/constraint_tree_valid.yaml Eval/check_tree/spec/constraint_tree_paragraphs.yaml -o Eval/check_tree/spec/merged_tmp.yaml python3 preprocess/process_duplicate_keywords.py Eval/check_tree/spec/merged_tmp.yaml Eval/check_tree/spec/merged.yaml
Output:
Eval/check_tree/spec/merged.yaml
Prepare the runtime source code, build a CodeQL database, and generate a check tree using LLMs.
-
Download Source Code: For evaluation, use the
--evalflag to fetch the specific version.python3 ./preprocess/create_databases.py --source-dir /workspace/Eval/source --download-only [--eval]
-
Build CodeQL Database:
python3 ./preprocess/create_databases.py --source-dir /workspace/Eval/source --databases-dir /workspace/Eval/qldatabase --codeql-path /opt/codeql/codeql --build-only [--eval]
-
Parse Units: Extract units entry functions, retaining units that appear at least twice.
python3 preprocess/parse_unit.py
-
Build Call Graph and Extract Statements: Generate control flow graphs (CFG) and cache results (one-time effort).
python3 -m cfg.init_databases --mode statements-cg --process-level 2 --log-level ERROR
-
Generate Code-Based Tree: Use LLMs to convert code into a checking tree.
python3 -m check_tree.traverse_code_to_ir
Run the full validation pipeline to align trees, generate test cases, and perform differential testing across runtimes.
Sample Generation:
python3 -m verifier.entry_point --all [--runtime runtime_name] [--max-iteration 8] [--jobs 32]Differential Testing:
python3 -m verifier.differential_testing --allBefore running, configure the following files in the config/ directory:
-
config/llm_config.json: Set your LLM API credentials.{ "api_key": "YOUR_API_KEY_HERE", "openrouter_api_key": "YOUR_OPENROUTER_API_KEY_HERE", ... } -
config/env.json: Set your Docker container ID (if running inside a container).{ "docker_container_id": "YOUR_CONTAINER_ID_HERE" } -
Runtime configurations:
config/*.yamlfiles contain settings for different WASM runtimes (V8, WebKit, WAMR, WasmEdge, Wasm3, WABT, Gecko).
WASCII/
├── preprocess/ # Specification and code preprocessing
├── check_tree/ # Check tree generation and traversal
├── cfg/ # Control flow graph building
├── verifier/ # Validation and differential testing
├── config/ # Configuration files
├── env/ # Docker environment
├── util/ # Utility functions
├── BaseMachine/ # Base state machine implementation
└── Data/ # Benchmark and auxiliary data