Skip to content

Commit 98bee99

Browse files
committed
miniscript: add Rust miniscript and bitcoin deps
rust-miniscript implements miniscrpit for the `wsh()` (Pay to witness script hash) context as well as for the `tr()` context (Pay to taproot). We use this dep as it works out of the box. The downside is that this library uses a lot of generics and binary-size-inefficent code. We could address much of that with PRs upstream, or in the worst case roll our own miniscript implementation that is space-efficient in the future. The rust-bitcoin dep is needed explicitly as rust-miniscript requires the `bitcoin::PublicKey` type to serialize pubkeys inside of miniscript expressions. Maybe we can make upstream changes that allow us to use our own types for that, as we already have all the code needed to serialize pubkeys. rust-bitcoin is a dependency to rust-miniscript as rust-bitcoin contains the necessary script generation functions. secp256k1 and secp256k1-sys are also transitive dependencies, as `bitcoin::PublicKey` is a re-export of `secp256k1::PublicKey`. Also here, we might be able to make upstream changes to remove the reliance on these deps. bech32 is updated to 0.9 as that is used by rust-bitcoin, so we don't vendor two versions of the same lib.
1 parent 0884576 commit 98bee99

File tree

646 files changed

+228124
-601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

646 files changed

+228124
-601
lines changed

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ else()
214214
# For binary reproducibility, strip path prefixes that can be different depending on environment (e.g. /home/<user>, etc.).
215215
set(RUSTFLAGS "--remap-path-prefix=${CMAKE_CURRENT_SOURCE_DIR}/rust=src --remap-path-prefix=$ENV{HOME}=")
216216
endif()
217+
# Use libsecp256k1 that we link ourselves (included via external/libwally-core).
218+
# See https://github.com/rust-bitcoin/rust-secp256k1/tree/7c8270a8506e31731e540fab7ee1abde1f48314e/secp256k1-sys#linking-to-external-symbols
219+
set(RUSTFLAGS "${RUSTFLAGS} --cfg=rust_secp_no_symbol_renaming")
217220

218221
if(CMAKE_CROSSCOMPILING)
219222
set(RUST_TARGET_ARCH thumbv7em-none-eabi)

src/rust/Cargo.lock

Lines changed: 136 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/bitbox02-rust/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ num-bigint = { version = "0.4.3", default-features = false, optional = true }
3939
num-traits = { version = "0.2", default-features = false, optional = true }
4040
bip32-ed25519 = { git = "https://github.com/digitalbitbox/rust-bip32-ed25519", tag = "v0.1.0", optional = true }
4141
bs58 = { version = "0.4.0", default-features = false, features = ["alloc", "check"] }
42-
bech32 = { version = "0.8.1", default-features = false, optional = true }
42+
bech32 = { version = "0.9", default-features = false, optional = true }
4343
blake2 = { version = "0.10.5", default-features = false, optional = true }
4444
minicbor = { version = "0.18.0", default-features = false, features = ["alloc"], optional = true }
4545
crc = { version = "2.1.0", optional = true }
@@ -48,6 +48,9 @@ lazy_static = { version = "1.4.0", optional = true }
4848
async-recursion = "1.0.0"
4949
hmac = "0.11.0"
5050

51+
miniscript = { version = "10.0.0", default-features = false, features = ["no-std"] }
52+
bitcoin = { version = "0.30.0", default-features = false, features = ["no-std"] }
53+
5154
# For stack allocated strings
5255
[dependencies.arrayvec]
5356
version = "0.5.1"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"files":{"Cargo.toml":"31399b9babab52fabfe71f52ffe38fef0d3d894fdd5829f84a4e69b031f463c9","FAQ.md":"9eb41898523ee209a0a937f9bcb78afe45ad55ca0556f8a4d4063558098f6d1e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"ff8f68cb076caf8cefe7a6430d4ac086ce6af2ca8ce2c4e5a2004d4552ef52a2","README.md":"72185284f100e149998fe5301f70489e617cc4415b51cc77e967c63c6e970a67","build.rs":"123b322034273b5aa1b4934d84c277fef279afd533ecfb44831a3715e9887fcd","rustfmt.toml":"e090969e99df9360705680cc0097cfaddae10c22dc2e01470592cf3b9787fd36","src/aes_hash.rs":"04483498a0d86e3ab099e22f734ea6fcac384b92f349bd310456856bf6a9a5e2","src/convert.rs":"f0e78840046493d0679a9ec077c8164cf57cf30d5e852b11bfadfdd996d29bd1","src/fallback_hash.rs":"ec00691bd555c69f7446afe893b6631cb84207cb7b512260dec8ef488e1905f3","src/hash_map.rs":"ed0c79c41c2218ad9591a585670a2b9b983807c9725880b780138a44c126cbfd","src/hash_quality_test.rs":"6c1fea90a38dc7b2ac5b2fa6e44a565e0c3385c72df6e87231401f920912d053","src/hash_set.rs":"dc3d33e290aad62457ab1f5e64d3e33eb79e28c9468bfc8686339f0bbd8b19aa","src/lib.rs":"9fec7d1d412e414231c9b929081b1daa7c3b788a9f91eedd79a55efdf5d0d291","src/operations.rs":"10772e65b8b7106f195428c5eb8dbf6cbd49dd5a2165ac750e54af5995210f88","src/random_state.rs":"b7981967ec5ecbff04d166b5e05c59c386062b4de3b36816f3c98ef284372f63","src/specialize.rs":"38d3b56ef4f264d564f48dbcb8ac137928babf90635090c9771c1a62140d1f30","tests/bench.rs":"0851dffebaffd7a437f6f9946ed5e03a957e9a6eb0da7911451af58778c411ec","tests/map_tests.rs":"e0f155f964dd965740b072ee1da110a8c6ef34491c95219f7c89064112c7840f","tests/nopanic.rs":"3363675c4c1a197b86604a0aebbe958fb5ec7c01a414fbfd70e9eb8a29707400"},"package":"fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"}

src/rust/vendor/ahash/Cargo.toml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
2+
#
3+
# When uploading crates to the registry Cargo will automatically
4+
# "normalize" Cargo.toml files for maximal compatibility
5+
# with all versions of Cargo and also rewrite `path` dependencies
6+
# to registry (e.g., crates.io) dependencies
7+
#
8+
# If you believe there's an error in this file please file an
9+
# issue against the rust-lang/cargo repository. If you're
10+
# editing this file be aware that the upstream Cargo.toml
11+
# will likely look very different (and much more reasonable)
12+
13+
[package]
14+
edition = "2018"
15+
name = "ahash"
16+
version = "0.7.6"
17+
authors = ["Tom Kaitchuck <[email protected]>"]
18+
build = "./build.rs"
19+
exclude = ["/smhasher", "/benchmark_tools"]
20+
description = "A non-cryptographic hash function using AES-NI for high performance"
21+
documentation = "https://docs.rs/ahash"
22+
readme = "README.md"
23+
keywords = ["hash", "hasher", "hashmap", "aes", "no-std"]
24+
categories = ["algorithms", "data-structures", "no-std"]
25+
license = "MIT OR Apache-2.0"
26+
repository = "https://github.com/tkaitchuck/ahash"
27+
[package.metadata.docs.rs]
28+
features = ["std"]
29+
rustc-args = ["-C", "target-feature=+aes"]
30+
rustdoc-args = ["-C", "target-feature=+aes"]
31+
[profile.bench]
32+
opt-level = 3
33+
lto = "fat"
34+
codegen-units = 1
35+
debug = false
36+
debug-assertions = false
37+
38+
[profile.release]
39+
opt-level = 3
40+
lto = "fat"
41+
codegen-units = 1
42+
debug = false
43+
debug-assertions = false
44+
45+
[profile.test]
46+
opt-level = 2
47+
lto = "fat"
48+
49+
[lib]
50+
name = "ahash"
51+
path = "src/lib.rs"
52+
test = true
53+
doctest = true
54+
bench = true
55+
doc = true
56+
57+
[[bench]]
58+
name = "ahash"
59+
path = "tests/bench.rs"
60+
harness = false
61+
62+
[[bench]]
63+
name = "map"
64+
path = "tests/map_tests.rs"
65+
harness = false
66+
[dev-dependencies.criterion]
67+
version = "0.3.2"
68+
69+
[dev-dependencies.fnv]
70+
version = "1.0.5"
71+
72+
[dev-dependencies.fxhash]
73+
version = "0.2.1"
74+
75+
[dev-dependencies.hex]
76+
version = "0.4.2"
77+
78+
[dev-dependencies.no-panic]
79+
version = "0.1.10"
80+
81+
[dev-dependencies.rand]
82+
version = "0.7.3"
83+
84+
[dev-dependencies.seahash]
85+
version = "4.0"
86+
87+
[dev-dependencies.serde_json]
88+
version = "1.0.59"
89+
[build-dependencies.version_check]
90+
version = "0.9"
91+
92+
[features]
93+
compile-time-rng = ["const-random"]
94+
default = ["std"]
95+
std = []
96+
[target."cfg(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\"))".dependencies.const-random]
97+
version = "0.1.12"
98+
optional = true
99+
100+
[target."cfg(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\"))".dependencies.getrandom]
101+
version = "0.2.3"
102+
103+
[target."cfg(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\"))".dependencies.serde]
104+
version = "1.0.117"
105+
optional = true
106+
[target."cfg(not(all(target_arch = \"arm\", target_os = \"none\")))".dependencies.once_cell]
107+
version = "1.8"
108+
features = ["alloc"]
109+
default-features = false
110+
[target."cfg(not(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\")))".dependencies.const-random]
111+
version = "0.1.12"
112+
optional = true
113+
114+
[target."cfg(not(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\")))".dependencies.serde]
115+
version = "1.0.117"
116+
optional = true

0 commit comments

Comments
 (0)