From c9a802f31cc93fe5af9482e1eb11a0b7ec2a3726 Mon Sep 17 00:00:00 2001 From: Juan Leni Date: Fri, 15 Mar 2019 20:00:36 +0100 Subject: [PATCH 1/4] using ledger-tendermint directly --- Cargo.lock | 17 ++--------------- Cargo.toml | 7 +++++-- src/keyring/ed25519/ledgertm.rs | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 50829ec..6d34b8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -502,13 +502,13 @@ dependencies = [ [[package]] name = "ledger-tendermint" version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ledger 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "signatory 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -991,17 +991,6 @@ dependencies = [ "signatory 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "signatory-ledger-tm" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ledger-tendermint 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", - "signatory 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "signatory-secp256k1" version = "0.11.0" @@ -1188,6 +1177,7 @@ dependencies = [ "hkdf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ledger-tendermint 0.3.2", "prost-amino 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "prost-amino-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1199,7 +1189,6 @@ dependencies = [ "signal-hook 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "signatory 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "signatory-dalek 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "signatory-ledger-tm 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "signatory-secp256k1 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "subtle-encoding 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1395,7 +1384,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum ledger 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6c9a2f47929b010a64a4bf9cdfe03b0d02175d44db0b91e16283f5a4a731d52c" -"checksum ledger-tendermint 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9a5d19a16cfc269d902ccc0a594033cf6a5d8aafecf1513c18b8991dfa1903fb" "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" "checksum libusb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f990ddd929cbe53de4ecd6cf26e1f4e0c5b9796e4c629d9046570b03738aa53" "checksum libusb-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4c53b6582563d64ad3e692f54ef95239c3ea8069e82c9eb70ca948869a7ad767" @@ -1452,7 +1440,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum signal-hook 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "97a47ae722318beceb0294e6f3d601205a1e6abaa4437d9d33e3a212233e3021" "checksum signatory 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e282f6c031ca56210bb82a9aec3e5c1638345367cbab0208440e6a5a9493552f" "checksum signatory-dalek 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b5ed7678eaeb98cb23e1efdb5e961021b02d3bd9f8bab4d4e30c53ebb3dd50" -"checksum signatory-ledger-tm 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2633f1e0a241347d31f2031b6053506dd72d9c5dedf06fe231526f049e4d1ed" "checksum signatory-secp256k1 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57765ca2c5615453b345477546ddc697921f3c8fc71fd1ffc4edc2ffa0453f1d" "checksum simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e95345f185d5adeb8ec93459d2dc99654e294cc6ccf5b75414d8ea262de9a13" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" diff --git a/Cargo.toml b/Cargo.toml index 79ef782..44ee4b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,7 @@ failure_derive = "0.1" hkdf = "0.7" hmac = "0.7" lazy_static = "1" +ledger-tendermint = { version = "0.3.2", optional = true } prost-amino = "0.4.0" prost-amino-derive = "0.4.0" rand_os = "0.1" @@ -39,7 +40,6 @@ signal-hook = "0.1.7" signatory = { version = "0.11.1", features = ["ed25519", "ecdsa"] } signatory-dalek = "0.11" signatory-secp256k1 = "0.11" -signatory-ledger-tm = { version = "0.11", optional = true } subtle = "2" subtle-encoding = { version = "0.3", features = ["bech32-preview"] } tendermint = { version = "0.5.0-alpha1", path = "tendermint-rs" } @@ -55,9 +55,12 @@ rand = "0.6" # TODO: switch to the getrandom crate [features] default = [] softsign = [] -ledgertm = ["signatory-ledger-tm"] +ledgertm = ["ledger-tendermint"] yubihsm-mock = ["yubihsm/mockhsm"] # Enable integer overflow checks in release builds for security reasons [profile.release] overflow-checks = true + +[patch.crates-io] +ledger-tendermint = { path = "../ledger-tendermint-rs" } diff --git a/src/keyring/ed25519/ledgertm.rs b/src/keyring/ed25519/ledgertm.rs index 22c9faa..ce23d39 100644 --- a/src/keyring/ed25519/ledgertm.rs +++ b/src/keyring/ed25519/ledgertm.rs @@ -6,8 +6,8 @@ use crate::{ keyring::{ed25519::Signer, KeyRing, SigningProvider}, }; use signatory::PublicKeyed; -use signatory_ledger_tm::{self, Ed25519LedgerTmAppSigner}; use tendermint::TendermintKey; +use ledger_tendermint::signer::Ed25519LedgerTmAppSigner; /// Create Ledger Tendermint signer object from the given configuration pub fn init( From 66284963b62394f0f75d32460edce7efee47e7ac Mon Sep 17 00:00:00 2001 From: Juan Leni Date: Fri, 15 Mar 2019 23:03:52 +0100 Subject: [PATCH 2/4] upgrade and fix formatting --- Cargo.lock | 6 ++++-- Cargo.toml | 6 +++--- src/keyring/ed25519/ledgertm.rs | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d34b8e..b9ccc9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -501,7 +501,8 @@ dependencies = [ [[package]] name = "ledger-tendermint" -version = "0.3.2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1177,7 +1178,7 @@ dependencies = [ "hkdf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ledger-tendermint 0.3.2", + "ledger-tendermint 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "prost-amino 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "prost-amino-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1384,6 +1385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum ledger 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6c9a2f47929b010a64a4bf9cdfe03b0d02175d44db0b91e16283f5a4a731d52c" +"checksum ledger-tendermint 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "798701caf0fe437d7d72939eed5f18ae187e9c414eb5f4e9b8eeceaa16f99a23" "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" "checksum libusb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f990ddd929cbe53de4ecd6cf26e1f4e0c5b9796e4c629d9046570b03738aa53" "checksum libusb-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4c53b6582563d64ad3e692f54ef95239c3ea8069e82c9eb70ca948869a7ad767" diff --git a/Cargo.toml b/Cargo.toml index 44ee4b0..2e2567f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ failure_derive = "0.1" hkdf = "0.7" hmac = "0.7" lazy_static = "1" -ledger-tendermint = { version = "0.3.2", optional = true } +ledger-tendermint = { version = "0.4.0", optional = true } prost-amino = "0.4.0" prost-amino-derive = "0.4.0" rand_os = "0.1" @@ -62,5 +62,5 @@ yubihsm-mock = ["yubihsm/mockhsm"] [profile.release] overflow-checks = true -[patch.crates-io] -ledger-tendermint = { path = "../ledger-tendermint-rs" } +#[patch.crates-io] +#ledger-tendermint = { path = "../ledger-tendermint-rs" } diff --git a/src/keyring/ed25519/ledgertm.rs b/src/keyring/ed25519/ledgertm.rs index ce23d39..891da57 100644 --- a/src/keyring/ed25519/ledgertm.rs +++ b/src/keyring/ed25519/ledgertm.rs @@ -12,8 +12,7 @@ use ledger_tendermint::signer::Ed25519LedgerTmAppSigner; /// Create Ledger Tendermint signer object from the given configuration pub fn init( keyring: &mut KeyRing, - ledgertm_configs: &[LedgerTendermintConfig], -) -> Result<(), KmsError> { + ledgertm_configs: &[LedgerTendermintConfig]) -> Result<(), KmsError> { if ledgertm_configs.is_empty() { return Ok(()); } From 41ee37b635b7d309b8666eb99f7fb1d84d8b3270 Mon Sep 17 00:00:00 2001 From: Juan Leni Date: Fri, 15 Mar 2019 23:06:49 +0100 Subject: [PATCH 3/4] cargo fmt --- src/keyring/ed25519/ledgertm.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/keyring/ed25519/ledgertm.rs b/src/keyring/ed25519/ledgertm.rs index 891da57..c17e240 100644 --- a/src/keyring/ed25519/ledgertm.rs +++ b/src/keyring/ed25519/ledgertm.rs @@ -5,14 +5,15 @@ use crate::{ error::{KmsError, KmsErrorKind::*}, keyring::{ed25519::Signer, KeyRing, SigningProvider}, }; +use ledger_tendermint::signer::Ed25519LedgerTmAppSigner; use signatory::PublicKeyed; use tendermint::TendermintKey; -use ledger_tendermint::signer::Ed25519LedgerTmAppSigner; /// Create Ledger Tendermint signer object from the given configuration pub fn init( keyring: &mut KeyRing, - ledgertm_configs: &[LedgerTendermintConfig]) -> Result<(), KmsError> { + ledgertm_configs: &[LedgerTendermintConfig], +) -> Result<(), KmsError> { if ledgertm_configs.is_empty() { return Ok(()); } From 1cae4aaf868f0d3b3e28d91e331d83782369abda Mon Sep 17 00:00:00 2001 From: Juan Leni Date: Fri, 15 Mar 2019 23:07:24 +0100 Subject: [PATCH 4/4] remove crate override --- Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2e2567f..a0f31c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,3 @@ yubihsm-mock = ["yubihsm/mockhsm"] # Enable integer overflow checks in release builds for security reasons [profile.release] overflow-checks = true - -#[patch.crates-io] -#ledger-tendermint = { path = "../ledger-tendermint-rs" }