diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..002223a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,3 @@ +# Repository instructions + +Read [README.md](README.md) before making changes to this repository. diff --git a/README.md b/README.md index 3d2f5f3..6985338 100644 --- a/README.md +++ b/README.md @@ -356,3 +356,19 @@ npm run test:sim -- test/simulator-btc.test.ts For build, test, simulator, protobuf, and contribution workflow details, see [CONTRIBUTING.md](CONTRIBUTING.md). + +## Updating the Bitcoin transaction test vectors + +The vectors in [test/data/btc-transaction-test-vectors.json](test/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 \ + test/data/btc-transaction-test-vectors.json +```