Skip to content

Commit 8898518

Browse files
committed
Add ledger signer
1 parent 59bd742 commit 8898518

18 files changed

Lines changed: 12426 additions & 8666 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 100 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -6,80 +6,84 @@ repository = "https://github.com/mintlayer/mintlayer-core"
66
readme = "README.md"
77
license = "MIT"
88
version = "1.0.2"
9-
authors = ["Samer Afach <samer.afach@mintlayer.org>", "Ben Marsh <benjamin.marsh@mintlayer.org>", "Enrico Rubboli <enrico.rubboli@mintlayer.org>"]
9+
authors = [
10+
"Samer Afach <samer.afach@mintlayer.org>",
11+
"Ben Marsh <benjamin.marsh@mintlayer.org>",
12+
"Enrico Rubboli <enrico.rubboli@mintlayer.org>",
13+
]
1014
edition = "2021"
1115

1216
[workspace]
1317
members = [
14-
"accounting", # Accounting and balances abstractions.
15-
"api-server/api-server-common", # API server, for light-wallets and block explorers: common between web-server and scanner.
16-
"api-server/storage-test-suite", # Test suite for the abstract storage layer of the API server to ensure consistent behavior.
17-
"api-server/scanner-daemon", # API server, for light-wallets and block explorers: blockchain scanner daemon.
18-
"api-server/scanner-lib", # API server, for light-wallets and block explorers: blockchain scanner library.
19-
"api-server/stack-test-suite", # API server, for light-wallets and block explorers: testing the scanner and web-server.
20-
"api-server/web-server", # API server, for light-wallets and block explorers: web-server.
21-
"blockprod", # Block production with whatever consensus algorithm.
22-
"chainstate", # Code on chainstate of blocks and transactions.
23-
"chainstate/test-suite", # Tests for the chainstate, separated to make use of the chainstate test framework.
24-
"common", # Everything else, until it's moved to another crate.
25-
"consensus", # Consensus related logic.
26-
"crypto", # Cryptographic primitives and their interfaces.
27-
"dns-server", # DNS-server.
28-
"logging", # Logging engine and its interfaces.
29-
"mempool", # Mempool interface and implementation.
30-
"mempool/types", # Common mempool types.
31-
"mintscript", # Basic scripting language for validating transactions.
32-
"mocks", # Mock implementations of our traits (used for testing).
33-
"node-daemon", # Node terminal binary.
34-
"networking", # Pure networking implementations
35-
"node-gui", # Node GUI binary.
36-
"node-gui/backend", # Node GUI backend, common logic for implementing GUI clients.
37-
"node-lib", # Node lib; the common library between daemon, tui and gui node executables.
38-
"orders-accounting", # Orders accounting
39-
"p2p", # P2p communication interfaces and protocols.
40-
"p2p/backend-test-suite", # P2p backend agnostic tests.
41-
"p2p/types", # P2p support types with minimal dependencies.
42-
"pos-accounting", # PoS accounting and balances abstractions.
43-
"randomness", # A wrapper around all randomness functionality to make audits easier
44-
"rpc", # Rpc abstraction and implementation.
45-
"rpc/description", # Data types describing an RPC interface.
46-
"rpc/description-macro", # Macro to generate rpc interface description.
47-
"rpc/types", # Support types for use in RPC interfaces.
48-
"script", # Bitcoin script and its interfaces.
49-
"serialization", # Full featured serialization interfaces and implementations.
50-
"serialization/core", # Serialization core tools.
51-
"serialization/tagged", # Serialization for direct/tagged encoding style.
52-
"serialization/tagged/derive", # direct/tagged encoding style derive macros.
53-
"storage", # storage abstraction layer and its implementation.
54-
"storage/backend-test-suite", # Tests for validating storage backend implementations.
55-
"storage/core", # Core backend-agnostic storage abstraction.
56-
"storage/failing", # Storage adapter to occasionally fail certain operations, for testing.
57-
"storage/inmemory", # In-memory storage backend implementation.
58-
"storage/lmdb", # LMDB-based persistent storage backend implementation.
59-
"storage/sqlite", # SQLite-based persistent storage backend implementation.
60-
"subsystem", # Utilities for working with concurrent subsystems.
61-
"test", # Integration tests.
62-
"test-rpc-functions", # RPC functions specifically for tests.
63-
"test-utils", # Various utilities for tests.
64-
"tokens-accounting", # Tokens accounting
65-
"utils", # Various utilities.
66-
"utils/networking", # Various async/tokio utilities.
67-
"utxo", # Utxo and related utilities (cache, undo, etc.).
68-
"trezor-common", # Code used by Trezor firmware repository.
69-
"wallet", # Wallet primitives.
70-
"wallet/wallet-cli", # Wallet CLI/REPL binary.
71-
"wallet/wallet-cli-lib", # Wallet CLI/REPL lib.
72-
"wallet/wallet-cli-commands", # Wallet CLI/REPL commands.
73-
"wallet/wallet-controller", # Common code for wallet UI applications.
74-
"wallet/wallet-node-client", # Wallet-to-node communication tools.
75-
"wallet/wallet-address-generator", # Wallet address generator binary.
76-
"wallet/wallet-address-generator-lib",# Wallet address generator lib.
77-
"wallet/wallet-rpc-client", # Wallet RPC communication.
78-
"wallet/wallet-rpc-daemon", # Wallet RPC daemon binary.
79-
"wallet/wallet-rpc-lib", # Wallet RPC definitions library.
80-
"wallet/wallet-test-node", # Node for wallet testing as a library.
81-
"wasm-wrappers", # WASM wrappers for various components.
82-
"wasm-wrappers/wasm-doc-gen", # WASM wrappers documentation generator.
18+
"accounting", # Accounting and balances abstractions.
19+
"api-server/api-server-common", # API server, for light-wallets and block explorers: common between web-server and scanner.
20+
"api-server/storage-test-suite", # Test suite for the abstract storage layer of the API server to ensure consistent behavior.
21+
"api-server/scanner-daemon", # API server, for light-wallets and block explorers: blockchain scanner daemon.
22+
"api-server/scanner-lib", # API server, for light-wallets and block explorers: blockchain scanner library.
23+
"api-server/stack-test-suite", # API server, for light-wallets and block explorers: testing the scanner and web-server.
24+
"api-server/web-server", # API server, for light-wallets and block explorers: web-server.
25+
"blockprod", # Block production with whatever consensus algorithm.
26+
"chainstate", # Code on chainstate of blocks and transactions.
27+
"chainstate/test-suite", # Tests for the chainstate, separated to make use of the chainstate test framework.
28+
"common", # Everything else, until it's moved to another crate.
29+
"consensus", # Consensus related logic.
30+
"crypto", # Cryptographic primitives and their interfaces.
31+
"dns-server", # DNS-server.
32+
"logging", # Logging engine and its interfaces.
33+
"mempool", # Mempool interface and implementation.
34+
"mempool/types", # Common mempool types.
35+
"mintscript", # Basic scripting language for validating transactions.
36+
"mocks", # Mock implementations of our traits (used for testing).
37+
"node-daemon", # Node terminal binary.
38+
"networking", # Pure networking implementations
39+
"node-gui", # Node GUI binary.
40+
"node-gui/backend", # Node GUI backend, common logic for implementing GUI clients.
41+
"node-lib", # Node lib; the common library between daemon, tui and gui node executables.
42+
"orders-accounting", # Orders accounting
43+
"p2p", # P2p communication interfaces and protocols.
44+
"p2p/backend-test-suite", # P2p backend agnostic tests.
45+
"p2p/types", # P2p support types with minimal dependencies.
46+
"pos-accounting", # PoS accounting and balances abstractions.
47+
"randomness", # A wrapper around all randomness functionality to make audits easier
48+
"rpc", # Rpc abstraction and implementation.
49+
"rpc/description", # Data types describing an RPC interface.
50+
"rpc/description-macro", # Macro to generate rpc interface description.
51+
"rpc/types", # Support types for use in RPC interfaces.
52+
"script", # Bitcoin script and its interfaces.
53+
"serialization", # Full featured serialization interfaces and implementations.
54+
"serialization/core", # Serialization core tools.
55+
"serialization/tagged", # Serialization for direct/tagged encoding style.
56+
"serialization/tagged/derive", # direct/tagged encoding style derive macros.
57+
"storage", # storage abstraction layer and its implementation.
58+
"storage/backend-test-suite", # Tests for validating storage backend implementations.
59+
"storage/core", # Core backend-agnostic storage abstraction.
60+
"storage/failing", # Storage adapter to occasionally fail certain operations, for testing.
61+
"storage/inmemory", # In-memory storage backend implementation.
62+
"storage/lmdb", # LMDB-based persistent storage backend implementation.
63+
"storage/sqlite", # SQLite-based persistent storage backend implementation.
64+
"subsystem", # Utilities for working with concurrent subsystems.
65+
"test", # Integration tests.
66+
"test-rpc-functions", # RPC functions specifically for tests.
67+
"test-utils", # Various utilities for tests.
68+
"tokens-accounting", # Tokens accounting
69+
"utils", # Various utilities.
70+
"utils/networking", # Various async/tokio utilities.
71+
"utxo", # Utxo and related utilities (cache, undo, etc.).
72+
"trezor-common", # Code used by Trezor firmware repository.
73+
"wallet", # Wallet primitives.
74+
"wallet/wallet-cli", # Wallet CLI/REPL binary.
75+
"wallet/wallet-cli-lib", # Wallet CLI/REPL lib.
76+
"wallet/wallet-cli-commands", # Wallet CLI/REPL commands.
77+
"wallet/wallet-controller", # Common code for wallet UI applications.
78+
"wallet/wallet-node-client", # Wallet-to-node communication tools.
79+
"wallet/wallet-address-generator", # Wallet address generator binary.
80+
"wallet/wallet-address-generator-lib", # Wallet address generator lib.
81+
"wallet/wallet-rpc-client", # Wallet RPC communication.
82+
"wallet/wallet-rpc-daemon", # Wallet RPC daemon binary.
83+
"wallet/wallet-rpc-lib", # Wallet RPC definitions library.
84+
"wallet/wallet-test-node", # Node for wallet testing as a library.
85+
"wasm-wrappers", # WASM wrappers for various components.
86+
"wasm-wrappers/wasm-doc-gen", # WASM wrappers documentation generator.
8387
]
8488

8589
default-members = [
@@ -234,7 +238,11 @@ tempfile = "3.3"
234238
testing_logger = "0.1"
235239
thiserror = "1.0"
236240
tracing = "0.1"
237-
tracing-subscriber = { version = "0.3", features = ["registry", "env-filter", "json"] }
241+
tracing-subscriber = { version = "0.3", features = [
242+
"registry",
243+
"env-filter",
244+
"json",
245+
] }
238246
tokio = { version = "1.27", default-features = false }
239247
tokio-socks = "0.5"
240248
tokio-stream = "0.1"
@@ -246,9 +254,26 @@ hickory-client = "0.24"
246254
hickory-server = "0.24"
247255
zeroize = "1.5"
248256

257+
reqwest = "0.12"
258+
259+
[workspace.dependencies.ledger-lib]
260+
git = "https://github.com/ledger-community/rust-ledger.git"
261+
rev = "4be10b810bb6500b7d8bc0b67e64fef24257e0e8"
262+
263+
[workspace.dependencies.ledger-proto]
264+
git = "https://github.com/ledger-community/rust-ledger.git"
265+
rev = "4be10b810bb6500b7d8bc0b67e64fef24257e0e8"
266+
267+
# [workspace.dependencies.ledger-sim]
268+
# git = "https://github.com/ledger-community/rust-ledger.git"
269+
# rev = "4be10b810bb6500b7d8bc0b67e64fef24257e0e8"
270+
271+
[patch.crates-io]
272+
ledger-proto = { git = "https://github.com/ledger-community/rust-ledger.git", rev = "4be10b810bb6500b7d8bc0b67e64fef24257e0e8" }
273+
249274
[workspace.dependencies.trezor-client]
250275
git = "https://github.com/mintlayer/mintlayer-trezor-firmware"
251-
rev = "07229ff4943537b81c18a612fe971792d2a37574" # Commit "Support Mintlayer input commitments V1"
276+
rev = "07229ff4943537b81c18a612fe971792d2a37574" # Commit "Support Mintlayer input commitments V1"
252277
features = ["bitcoin", "mintlayer"]
253278

254279
[workspace.metadata.dist.dependencies.apt]
@@ -261,7 +286,7 @@ features = ["bitcoin", "mintlayer"]
261286
panic = "abort" # prevent panic catching (mostly for the tokio runtime)
262287

263288
[profile.release]
264-
panic = "abort" # prevent panic catching (mostly for the tokio runtime)
289+
panic = "abort" # prevent panic catching (mostly for the tokio runtime)
265290
overflow-checks = true
266291

267292
# "Release" profile with debug info enabled.
@@ -284,4 +309,5 @@ opt-level = 2
284309

285310
[features]
286311
trezor = []
287-
default = ["trezor"]
312+
ledger = []
313+
default = ["trezor", "ledger"]

wallet/Cargo.toml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ itertools.workspace = true
3838
parity-scale-codec.workspace = true
3939
serde.workspace = true
4040
thiserror.workspace = true
41+
tokio = { workspace = true, default-features = false, features = [
42+
"io-util",
43+
"macros",
44+
"rt",
45+
"sync",
46+
] }
4147
trezor-client = { workspace = true, optional = true }
48+
ledger-lib = { workspace = true, optional = true }
49+
ledger-proto = { workspace = true, optional = true }
4250
zeroize.workspace = true
4351

4452
[dev-dependencies]
@@ -51,6 +59,16 @@ tokio = { workspace = true, default-features = false, features = [
5159
"rt",
5260
"sync",
5361
] }
62+
# ledger-sim = { workspace = true }
63+
strum = { workspace = true }
64+
reqwest = { workspace = true, features = ["json"] }
65+
tracing = { workspace = true }
66+
anyhow = { workspace = true }
67+
clap = { workspace = true }
68+
bollard = "0.14"
69+
bytes = "1.10"
70+
tar = "0.4"
71+
5472

5573
ctor.workspace = true
5674
lazy_static.workspace = true
@@ -62,4 +80,5 @@ tempfile.workspace = true
6280
[features]
6381
trezor = ["dep:trezor-client", "wallet-types/trezor"]
6482
enable-trezor-device-tests = []
65-
default = ["trezor"]
83+
ledger = ["dep:ledger-lib", "dep:ledger-proto", "wallet-types/ledger"]
84+
default = ["trezor", "ledger"]

0 commit comments

Comments
 (0)