[WIP] Miniscript support#6936
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Looks like you changed |
|
| model | device_test | click_test | persistence_test |
|---|---|---|---|
| T2T1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3B1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3T1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3W1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
Latest CI run: 25934521840
[no changelog]
d47a1f0 to
9b60367
Compare
Add `rust-miniscript` library to compile Bitcoin descriptors on-device, enabling policy-based script generation for registered policies. Rust changes: - Add `miniscript` crate v13.0.0 to Cargo.toml - Use global allocator for temporary heap allocations - Register `trezorminiscript` MicroPython module - Export `mp_module_trezorminiscript` symbol in librust.h Build system changes: - Add `miniscript` feature to both firmware and unix builds - Configure build-std with `alloc` crate when miniscript is enabled Other fixes: - Fix type inference in translations/obj.rs for data_hash slice [no changelog] (cherry picked from commit 1325a95) Co-authored-by: Vojtěch Nevřela <nevrelav@gmail.com> Co-authored-by: Jakub Janků <janku.jakub.jj@gmail.com>
[no changelog]
…th C - Pull rust-miniscript through a forked secp256k1-sys 0.10.1 that skips its bundled libsecp256k1 build and uses unprefixed FFI symbols. The canonical secp256k1_* symbols will be supplied at link time by the existing vendored libsecp256k1 at vendor/secp256k1-zkp/, eliminating the second copy of libsecp256k1 (and its full-size precomputed ecmult tables) the firmware would otherwise carry when MINISCRIPT=1. - The fork is wired in via [patch.crates-io] in core/embed/rust/Cargo.toml and is a no-op when MINISCRIPT=0 (secp256k1-sys is not in the resolved dep graph). ABI compatibility with vendored libsecp256k1 v0.7.0 was verified against the bundled commit secp256k1-sys ships (1ad5185c) by header diff and struct-size check. - The fork is a subset. It excludes `depend/secp256k1/`, `wasm/`, `vendor-libsecp.sh` and some other non-relevant files. - New `Cargo.toml` and `build.rs` were written for the purposes of the fork. [no changelog]
rust-miniscript references three pieces of libsecp256k1 the SECP256K1_ZKP build wasn't providing when MINISCRIPT=1: - secp256k1::ellswift (unconditional in secp256k1 0.29): add ENABLE_MODULE_ELLSWIFT so the module is compiled. - ecdsa::Signature::from_der_lax binds ecdsa_signature_parse_der_lax from contrib/lax_der_parsing.c: add it to the link. - That file does `#include <secp256k1.h>`, which the default CPPPATH resolves to vendor/trezor-crypto/secp256k1.h. Override CPPPATH for this one file so vendor/secp256k1-zkp/include comes first. - Companion to 58b0b1f (the secp256k1-sys [patch.crates-io] fork). [no changelog]
MINISCRIPT=1 TREZOR_MODEL=T3T1 PYOPT=0 make -C core build_unix core/emu.py -eac pytest tests/device_tests/bitcoin/ -k miniscript [no changelog]
9b60367 to
71d6c03
Compare




































Resolves #6854.
TODOs: