diff --git a/AGENTS.md b/AGENTS.md index beefa4f..437656c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,6 +2,8 @@ This repo contains the Rust BitBox02 client library. +Read [README.md](README.md) before making changes to this repository. + ## Versioning - The client version is in Cargo.toml. The changelog is in CHANGELOG.md. The readme is in README.md. diff --git a/README.md b/README.md index 1473794..3e5f1c4 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,19 @@ make build-protos ``` This will generate/update [src/shiftcrypto.bitbox02.rs](src/shiftcrypto.bitbox02.rs). + +## Updating the Bitcoin transaction test vectors + +The vectors in [tests/data/btc-transaction-test-vectors.json](tests/data/btc-transaction-test-vectors.json) +are generated in the BitBox02 firmware repository. Do not modify this JSON file directly. + +The source of truth is the Rust constructors in +[`src/rust/bitbox-test-vectors/src/btc_transaction/cases/`](https://github.com/BitBoxSwiss/bitbox02-firmware/tree/master/src/rust/bitbox-test-vectors/src/btc_transaction/cases). +Make changes there and regenerate the canonical JSON following the +[test vector generation instructions](https://github.com/BitBoxSwiss/bitbox02-firmware/blob/master/src/rust/bitbox-test-vectors/README.md). +Then copy the generated file byte-for-byte into this repository: + +```sh +cp /path/to/bitbox02-firmware/src/rust/bitbox-test-vectors/testdata/btc-transaction-test-vectors.json \ + tests/data/btc-transaction-test-vectors.json +```