|
| 1 | +# Bitcoin Kernel Binding Conformance Tests |
| 2 | + |
| 3 | +This directory contains a language-agnostic conformance testing framework for Bitcoin Kernel bindings. |
| 4 | + |
| 5 | +## ⚠️ Work in Progress |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +The framework ensures that all language bindings (Go, Python, Rust, etc.) behave identically by: |
| 10 | +- Defining a standard JSON protocol for testing |
| 11 | +- Providing shared test cases that work across all bindings |
| 12 | +- Enforcing consistent error handling and categorization |
| 13 | + |
| 14 | +## Architecture |
| 15 | + |
| 16 | +``` |
| 17 | +┌─────────────┐ ┌──────────────────┐ |
| 18 | +│ Orchestrator│────────▶│ Handler Binary │ |
| 19 | +│ (Go Test │ stdin │ (Go/Rust/etc) │ |
| 20 | +│ Runner) │◀────────│ │ |
| 21 | +└─────────────┘ stdout └──────────────────┘ |
| 22 | + │ │ |
| 23 | + │ │ |
| 24 | + ▼ ▼ |
| 25 | + ┌─────────┐ ┌────────────────┐ |
| 26 | + │ Test │ │ Binding API │ |
| 27 | + │ Cases │ └────────────────┘ |
| 28 | + │ (JSON) │ |
| 29 | + └─────────┘ |
| 30 | +``` |
| 31 | + |
| 32 | +1. [**Orchestrator**](./orchestrator): Spawns handler binary, sends test requests, validates responses |
| 33 | +2. **Handler Binary**: Implements protocol, calls binding API, returns results |
| 34 | + - [Go handler](./go-handler) for the [Go binding](https://github.com/stringintech/go-bitcoinkernel) |
| 35 | + - [Rust handler](./rust-handler) for the [Rust binding](https://github.com/TheCharlatan/rust-bitcoinkernel) |
| 36 | +3. [**Test Cases**](./testdata): JSON files defining requests and expected responses |
| 37 | + |
| 38 | +## Getting Started |
| 39 | + |
| 40 | +### Cloning |
| 41 | + |
| 42 | +Clone the repository with submodules: |
| 43 | + |
| 44 | +```bash |
| 45 | +git clone --recurse-submodules https://github.com/stringintech/kernel-bindings-spec.git |
| 46 | +``` |
| 47 | +**Note:** go-handler currently depends on go-bitcoinkernel via a submodule. |
| 48 | + |
| 49 | + |
| 50 | +### Building |
| 51 | + |
| 52 | +Use the provided Makefile to build the project: |
| 53 | + |
| 54 | +```bash |
| 55 | +# Build everything! |
| 56 | +make build |
| 57 | +``` |
| 58 | + |
| 59 | +### Running Tests |
| 60 | + |
| 61 | +```bash |
| 62 | +# Run all conformance tests with both Go and Rust handlers |
| 63 | +make test |
| 64 | + |
| 65 | +# Run a specific test file with both Go and Rust handlers |
| 66 | +make test-single TEST=testdata/chainstate_basic.json |
| 67 | +``` |
0 commit comments