1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 10:58:21 +00:00

feat: update dependencies, fix breaking changes

This commit is contained in:
DaniPopes 2023-11-22 23:10:48 +01:00 committed by matejcik
parent 2172644626
commit 04bf769b57
14 changed files with 147 additions and 166 deletions

View File

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "aho-corasick"
version = "1.1.1"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
"memchr",
]
@ -25,36 +25,38 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bech32"
version = "0.9.1"
version = "0.10.0-beta"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445"
checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea"
[[package]]
name = "bitcoin"
version = "0.30.1"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e99ff7289b20a7385f66a0feda78af2fc119d28fb56aea8886a9cd0a4abdd75"
checksum = "5973a027b341b462105675962214dfe3c938ad9afd395d84b28602608bdcec7b"
dependencies = [
"bech32",
"bitcoin-private",
"bitcoin-internals",
"bitcoin_hashes",
"hex-conservative",
"hex_lit",
"secp256k1",
]
[[package]]
name = "bitcoin-private"
version = "0.1.0"
name = "bitcoin-internals"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57"
checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb"
[[package]]
name = "bitcoin_hashes"
version = "0.12.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d7066118b13d4b20b23645932dfb3a81ce7e29f95726c2036fa33cd7b092501"
checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b"
dependencies = [
"bitcoin-private",
"bitcoin-internals",
"hex-conservative",
]
[[package]]
@ -65,15 +67,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.0"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "byteorder"
version = "1.4.3"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "cc"
@ -103,7 +105,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [
"cfg-if",
"hashbrown 0.14.1",
"hashbrown 0.14.2",
"lock_api",
"once_cell",
"parking_lot_core",
@ -117,25 +119,14 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "errno"
version = "0.3.3"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd"
checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "fastrand"
version = "2.0.1"
@ -153,9 +144,9 @@ dependencies = [
[[package]]
name = "futures"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335"
dependencies = [
"futures-channel",
"futures-core",
@ -168,9 +159,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
dependencies = [
"futures-core",
"futures-sink",
@ -178,15 +169,15 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
[[package]]
name = "futures-executor"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc"
dependencies = [
"futures-core",
"futures-task",
@ -195,27 +186,27 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa"
[[package]]
name = "futures-sink"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817"
[[package]]
name = "futures-task"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
[[package]]
name = "futures-util"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
dependencies = [
"futures-channel",
"futures-core",
@ -236,9 +227,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.1"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
[[package]]
name = "hex"
@ -246,6 +237,12 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hex-conservative"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2"
[[package]]
name = "hex_lit"
version = "0.1.1"
@ -279,9 +276,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.148"
version = "0.2.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
[[package]]
name = "libusb1-sys"
@ -297,15 +294,15 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
version = "0.4.10"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
[[package]]
name = "lock_api"
version = "0.4.10"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
dependencies = [
"autocfg",
"scopeguard",
@ -319,9 +316,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "memchr"
version = "2.6.3"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]]
name = "nu-ansi-term"
@ -357,9 +354,9 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.8"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
dependencies = [
"cfg-if",
"libc",
@ -388,9 +385,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "primitive-types"
version = "0.12.1"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66"
checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2"
dependencies = [
"fixed-hash",
"uint",
@ -398,9 +395,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.67"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328"
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
dependencies = [
"unicode-ident",
]
@ -467,18 +464,18 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.3.5"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "regex"
version = "1.9.5"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick",
"memchr",
@ -488,9 +485,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.3.8"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
@ -499,9 +496,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.7.5"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rusb"
@ -515,11 +512,11 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.19"
version = "0.38.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed"
checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e"
dependencies = [
"bitflags 2.4.0",
"bitflags 2.4.1",
"errno",
"libc",
"linux-raw-sys",
@ -534,9 +531,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "secp256k1"
version = "0.27.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f"
checksum = "2acea373acb8c21ecb5a23741452acd2593ed44ee3d343e72baaa143bc89d0d5"
dependencies = [
"bitcoin_hashes",
"secp256k1-sys",
@ -544,9 +541,9 @@ dependencies = [
[[package]]
name = "secp256k1-sys"
version = "0.8.1"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e"
checksum = "09e67c467c38fd24bd5499dc9a18183b31575c12ee549197e3e20d57aa4fe3b7"
dependencies = [
"cc",
]
@ -578,9 +575,9 @@ dependencies = [
[[package]]
name = "sharded-slab"
version = "0.1.6"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b21f559e07218024e7e9f90f96f601825397de0e25420135f7f952453fed0b"
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
dependencies = [
"lazy_static",
]
@ -596,9 +593,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.11.1"
version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]]
name = "static_assertions"
@ -608,9 +605,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "syn"
version = "2.0.37"
version = "2.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
dependencies = [
"proc-macro2",
"quote",
@ -619,9 +616,9 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.8.0"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
dependencies = [
"cfg-if",
"fastrand",
@ -632,18 +629,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.49"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.49"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
@ -677,11 +674,10 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tracing"
version = "0.1.37"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [
"cfg-if",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
@ -689,9 +685,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
version = "0.1.26"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
@ -700,9 +696,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.31"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [
"once_cell",
"valuable",
@ -710,20 +706,20 @@ dependencies = [
[[package]]
name = "tracing-log"
version = "0.1.3"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"lazy_static",
"log",
"once_cell",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.17"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
dependencies = [
"nu-ansi-term",
"sharded-slab",

View File

@ -41,7 +41,7 @@ thiserror = "1.0"
tracing = "0.1"
# bitcoin
bitcoin = { version = "0.30", optional = true }
bitcoin = { version = "0.31", optional = true }
unicode-normalization = { version = "0.1.22", optional = true }
# ethereum

View File

@ -1,6 +1,6 @@
use std::io;
use bitcoin::{bip32, network::constants::Network, Address};
use bitcoin::{bip32, network::Network, Address};
use trezor_client::{Error, TrezorMessage, TrezorResponse};
fn handle_interaction<T, R: TrezorMessage>(resp: TrezorResponse<T, R>) -> Result<T, Error> {

View File

@ -1,6 +1,6 @@
use std::io;
use bitcoin::{bip32, network::constants::Network, Address};
use bitcoin::{bip32, network::Network, Address};
use trezor_client::{InputScriptType, TrezorMessage, TrezorResponse};
fn handle_interaction<T, R: TrezorMessage>(resp: TrezorResponse<T, R>) -> T {

View File

@ -1,8 +1,8 @@
use std::io::{self, Write};
use bitcoin::{
bip32, blockdata::script::Builder, consensus::encode::Decodable, network::constants::Network,
psbt, Address, Sequence, Transaction, TxIn, TxOut,
bip32, blockdata::script::Builder, consensus::encode::Decodable, network::Network, psbt,
transaction::Version, Address, Amount, Sequence, Transaction, TxIn, TxOut,
};
use trezor_client::{Error, SignTxProgress, TrezorMessage, TrezorResponse};
@ -33,7 +33,7 @@ fn handle_interaction<T, R: TrezorMessage>(resp: TrezorResponse<T, R>) -> T {
}
fn tx_progress(
psbt: &mut psbt::PartiallySignedTransaction,
psbt: &mut psbt::Psbt,
progress: SignTxProgress,
raw_tx: &mut Vec<u8>,
) -> Result<(), Error> {
@ -74,9 +74,9 @@ fn main() {
let addr = Address::p2pkh(&pubkey.to_pub(), Network::Testnet);
println!("address: {}", addr);
let mut psbt = psbt::PartiallySignedTransaction {
let mut psbt = psbt::Psbt {
unsigned_tx: Transaction {
version: 1,
version: Version::ONE,
lock_time: bitcoin::absolute::LockTime::from_consensus(0),
input: vec![TxIn {
previous_output: "c5bdb27907b78ce03f94e4bf2e94f7a39697b9074b79470019e3dbc76a10ecb6:0".parse().unwrap(),
@ -85,7 +85,7 @@ fn main() {
witness: Default::default(),
}],
output: vec![TxOut {
value: 14245301,
value: Amount::from_sat(14245301),
script_pubkey: addr.script_pubkey(),
}],
},

View File

@ -1,7 +1,7 @@
use super::{Trezor, TrezorResponse};
use crate::{error::Result, flows::sign_tx::SignTxProgress, protos, utils};
use bitcoin::{
address::NetworkUnchecked, bip32, network::constants::Network, psbt,
address::NetworkUnchecked, bip32, network::Network, psbt,
secp256k1::ecdsa::RecoverableSignature, Address,
};
@ -14,7 +14,7 @@ impl Trezor {
script_type: InputScriptType,
network: Network,
show_display: bool,
) -> Result<TrezorResponse<'_, bip32::ExtendedPubKey, protos::PublicKey>> {
) -> Result<TrezorResponse<'_, bip32::Xpub, protos::PublicKey>> {
let mut req = protos::GetPublicKey::new();
req.address_n = utils::convert_path(path);
req.set_show_display(show_display);
@ -41,7 +41,7 @@ impl Trezor {
pub fn sign_tx(
&mut self,
psbt: &psbt::PartiallySignedTransaction,
psbt: &psbt::Psbt,
network: Network,
) -> Result<TrezorResponse<'_, SignTxProgress<'_>, protos::TxRequest>> {
let tx = &psbt.unsigned_tx;
@ -49,7 +49,7 @@ impl Trezor {
req.set_inputs_count(tx.input.len() as u32);
req.set_outputs_count(tx.output.len() as u32);
req.set_coin_name(utils::coin_name(network)?);
req.set_version(tx.version as u32);
req.set_version(tx.version.0 as u32);
req.set_lock_time(tx.lock_time.to_consensus_u32());
self.call(req, Box::new(|c, m| Ok(SignTxProgress::new(c, m))))
}

View File

@ -88,5 +88,5 @@ pub enum Error {
/// Address error.
#[cfg(feature = "bitcoin")]
#[error(transparent)]
Address(#[from] bitcoin::address::Error),
Address(#[from] bitcoin::address::ParseError),
}

View File

@ -15,21 +15,12 @@ use crate::{
use bitcoin::{hashes::sha256d, psbt, Network, Transaction};
use protos::{
tx_ack::transaction_type::TxInputType, tx_request::RequestType as TxRequestType,
OutputScriptType,
InputScriptType, OutputScriptType,
};
use tracing::trace;
// Some types with raw protos that we use in the public interface so they have to be exported.
pub use protos::{
ButtonRequest as ButtonRequestType, Features, InputScriptType,
PinMatrixRequest as PinMatrixRequestType,
};
/// Fulfill a TxRequest for TXINPUT.
fn ack_input_request(
req: &protos::TxRequest,
psbt: &psbt::PartiallySignedTransaction,
) -> Result<protos::TxAck> {
fn ack_input_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result<protos::TxAck> {
if req.details.is_none() || !req.details.has_request_index() {
return Err(Error::MalformedTxRequest(req.clone()))
}
@ -87,7 +78,7 @@ fn ack_input_request(
if script_pubkey.is_p2pkh() {
InputScriptType::SPENDADDRESS
} else if script_pubkey.is_v0_p2wpkh() || script_pubkey.is_v0_p2wsh() {
} else if script_pubkey.is_p2wpkh() || script_pubkey.is_p2wsh() {
InputScriptType::SPENDWITNESS
} else if script_pubkey.is_p2sh() && psbt_input.witness_script.is_some() {
InputScriptType::SPENDP2SHWITNESS
@ -99,7 +90,7 @@ fn ack_input_request(
data_input.set_script_type(script_type);
//TODO(stevenroose) multisig
data_input.set_amount(txout.value);
data_input.set_amount(txout.value.to_sat());
}
trace!("Prepared input to ack: {:?}", data_input);
@ -113,7 +104,7 @@ fn ack_input_request(
/// Fulfill a TxRequest for TXOUTPUT.
fn ack_output_request(
req: &protos::TxRequest,
psbt: &psbt::PartiallySignedTransaction,
psbt: &psbt::Psbt,
network: Network,
) -> Result<protos::TxAck> {
if req.details.is_none() || !req.details.has_request_index() {
@ -140,7 +131,7 @@ fn ack_output_request(
};
let mut bin_output = TxOutputBinType::new();
bin_output.set_amount(output.value);
bin_output.set_amount(output.value.to_sat());
bin_output.set_script_pubkey(output.script_pubkey.to_bytes());
trace!("Prepared bin_output to ack: {:?}", bin_output);
@ -153,7 +144,7 @@ fn ack_output_request(
let output = opt.ok_or(Error::TxRequestInvalidIndex(output_index))?;
let mut data_output = TxOutputType::new();
data_output.set_amount(output.value);
data_output.set_amount(output.value.to_sat());
// Set script type to PAYTOADDRESS unless we find out otherwise from the PSBT.
data_output.set_script_type(OutputScriptType::PAYTOADDRESS);
if let Some(addr) = utils::address_from_script(&output.script_pubkey, network) {
@ -194,10 +185,7 @@ fn ack_output_request(
}
/// Fulfill a TxRequest for TXMETA.
fn ack_meta_request(
req: &protos::TxRequest,
psbt: &psbt::PartiallySignedTransaction,
) -> Result<protos::TxAck> {
fn ack_meta_request(req: &protos::TxRequest, psbt: &psbt::Psbt) -> Result<protos::TxAck> {
if req.details.is_none() {
return Err(Error::MalformedTxRequest(req.clone()))
}
@ -217,7 +205,7 @@ fn ack_meta_request(
};
let mut txdata = TransactionType::new();
txdata.set_version(tx.version as u32);
txdata.set_version(tx.version.0 as u32);
txdata.set_lock_time(tx.lock_time.to_consensus_u32());
txdata.set_inputs_cnt(tx.input.len() as u32);
txdata.set_outputs_cnt(tx.output.len() as u32);
@ -314,7 +302,7 @@ impl<'a> SignTxProgress<'a> {
/// so it should always be checked in advance.
pub fn ack_psbt(
self,
psbt: &psbt::PartiallySignedTransaction,
psbt: &psbt::Psbt,
network: Network,
) -> Result<TrezorResponse<'a, SignTxProgress<'a>, protos::TxRequest>> {
assert!(self.req.request_type() != TxRequestType::TXFINISHED);

View File

@ -11,21 +11,23 @@
//! We use the log package interface, so any logger that supports log can be attached.
//! Please be aware that `trace` logging can contain sensitive data.
#![warn(rust_2018_idioms)]
#![warn(unreachable_pub, rustdoc::all)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod messages;
mod transport;
pub mod client;
pub mod error;
pub mod protos;
pub mod transport;
#[cfg(feature = "bitcoin")]
pub mod utils;
mod flows {
#[cfg(feature = "bitcoin")]
pub mod sign_tx;
pub(crate) mod sign_tx;
}
pub use client::{

View File

@ -3,7 +3,7 @@
// Note: we do not use the generated `mod.rs` because we want to feature-gate some modules manually.
// This significantly improves compile times.
// See https://github.com/joshieDo/rust-trezor-api/pull/9 for more details.
#[allow(ambiguous_glob_reexports)]
#[allow(ambiguous_glob_reexports, unreachable_pub)]
mod generated {
macro_rules! modules {
($($($feature:literal =>)? $module:ident)+) => {$(

View File

@ -69,9 +69,9 @@ pub fn connect(available_device: &AvailableDevice) -> Result<Box<dyn Transport>,
// A collection of transport-global constants.
mod constants {
pub const DEV_TREZOR_LEGACY: (u16, u16) = (0x534C, 0x0001);
pub const DEV_TREZOR: (u16, u16) = (0x1209, 0x53C1);
pub const DEV_TREZOR_BOOTLOADER: (u16, u16) = (0x1209, 0x53C0);
pub(crate) const DEV_TREZOR_LEGACY: (u16, u16) = (0x534C, 0x0001);
pub(crate) const DEV_TREZOR: (u16, u16) = (0x1209, 0x53C1);
pub(crate) const DEV_TREZOR_BOOTLOADER: (u16, u16) = (0x1209, 0x53C0);
}
/// Derive the Trezor model from the USB device.

View File

@ -8,10 +8,10 @@ use std::{fmt, net::UdpSocket, result::Result, time::Duration};
// A collection of constants related to the Emulator Ports.
mod constants {
pub const DEFAULT_HOST: &str = "127.0.0.1";
pub const DEFAULT_PORT: &str = "21324";
pub const DEFAULT_DEBUG_PORT: &str = "21325";
pub const LOCAL_LISTENER: &str = "127.0.0.1:0";
pub(crate) const DEFAULT_HOST: &str = "127.0.0.1";
pub(crate) const DEFAULT_PORT: &str = "21324";
pub(crate) const DEFAULT_DEBUG_PORT: &str = "21325";
pub(crate) const LOCAL_LISTENER: &str = "127.0.0.1:0";
}
use constants::{DEFAULT_DEBUG_PORT, DEFAULT_HOST, DEFAULT_PORT, LOCAL_LISTENER};
@ -37,8 +37,8 @@ impl fmt::Display for AvailableUdpTransport {
/// An actual serial HID USB link to a device over which bytes can be sent.
struct UdpLink {
pub socket: UdpSocket,
pub device: (String, String),
socket: UdpSocket,
device: (String, String),
}
// No need to implement drop as every member is owned
@ -68,7 +68,7 @@ impl Link for UdpLink {
}
impl UdpLink {
pub fn open(path: &str) -> Result<UdpLink, Error> {
fn open(path: &str) -> Result<UdpLink, Error> {
let mut parts = path.split(':');
let link = Self {
socket: UdpSocket::bind(LOCAL_LISTENER)?,

View File

@ -12,17 +12,15 @@ use std::{fmt, result::Result, time::Duration};
// A collection of constants related to the WebUsb protocol.
mod constants {
pub use crate::transport::constants::*;
pub(crate) const CONFIG_ID: u8 = 0;
pub(crate) const INTERFACE_DESCRIPTOR: u8 = 0;
pub(crate) const LIBUSB_CLASS_VENDOR_SPEC: u8 = 0xff;
pub const CONFIG_ID: u8 = 0;
pub const INTERFACE_DESCRIPTOR: u8 = 0;
pub const LIBUSB_CLASS_VENDOR_SPEC: u8 = 0xff;
pub const INTERFACE: u8 = 0;
pub const INTERFACE_DEBUG: u8 = 1;
pub const ENDPOINT: u8 = 1;
pub const ENDPOINT_DEBUG: u8 = 2;
pub const READ_ENDPOINT_MASK: u8 = 0x80;
pub(crate) const INTERFACE: u8 = 0;
pub(crate) const INTERFACE_DEBUG: u8 = 1;
pub(crate) const ENDPOINT: u8 = 1;
pub(crate) const ENDPOINT_DEBUG: u8 = 2;
pub(crate) const READ_ENDPOINT_MASK: u8 = 0x80;
}
/// The chunk size for the serial protocol.

View File

@ -17,10 +17,7 @@ pub fn address_from_script(script: &Script, network: Network) -> Option<address:
}
/// Find the (first if multiple) PSBT input that refers to the given txid.
pub fn psbt_find_input(
psbt: &psbt::PartiallySignedTransaction,
txid: sha256d::Hash,
) -> Result<&psbt::Input> {
pub fn psbt_find_input(psbt: &psbt::Psbt, txid: sha256d::Hash) -> Result<&psbt::Input> {
let inputs = &psbt.unsigned_tx.input;
let idx = inputs
.iter()