Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
[WIP] Upgrade tendermint crate to v0.11 (unreleased)
Browse files Browse the repository at this point in the history
...which hasn't actually been released yet. This is just checking to see
that there isn't anything that needs to be changed at the last minute
before another `tendermint-rs` release.

Upgrades the following crates:

- `tendermint` => v0.11-ish
- `chacha20poly1305` => v0.3
- `signatory` => v0.17
- `uuid` => v0.8
- `yubihsm` => v0.30
  • Loading branch information
tony-iqlusion committed Dec 11, 2019
1 parent 849f3ee commit 81d8b29
Show file tree
Hide file tree
Showing 8 changed files with 399 additions and 112 deletions.
446 changes: 367 additions & 79 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abscissa_core = "0.4"
atomicwrites = "0.2"
byteorder = "1.2"
bytes = "0.4"
chacha20poly1305 = "0.2"
chacha20poly1305 = "0.3"
chrono = "0.4"
failure = "0.1"
gumdrop = "0.7"
Expand All @@ -34,21 +34,20 @@ rpassword = { version = "3", optional = true }
serde = { version = "1", features = ["serde_derive"] }
serde_json = "1"
sha2 = "0.8"
signatory = { version = "0.16", features = ["ecdsa", "ed25519", "encoding"] }
signatory-dalek = "0.16"
signatory-secp256k1 = "0.16"
signatory-ledger-tm = { version = "0.16", optional = true }
signatory = { version = "0.17", features = ["ecdsa", "ed25519", "encoding"] }
signatory-dalek = "0.17"
signatory-secp256k1 = "0.17"
signatory-ledger-tm = { version = "0.17", optional = true }
subtle = "2"
subtle-encoding = { version = "0.4", features = ["bech32-preview"] }
tiny-bip39 = "0.6"
wait-timeout = "0.2"
x25519-dalek = "0.5"
yubihsm = { version = "0.29", features = ["setup", "usb"], optional = true }
yubihsm = { version = "0.30", features = ["setup", "usb"], optional = true }
zeroize = "1"

[dependencies.tendermint]
version = "0.10.1"
features = ["amino-types", "config"]
git = "https://github.com/interchainio/tendermint-rs"

[dev-dependencies]
tempfile = "3"
Expand Down
6 changes: 3 additions & 3 deletions src/connection/secret_connection.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
//! `SecretConnection`: Transport layer encryption for Tendermint P2P connections.
mod amino_types;
mod kdf;
mod nonce;
mod public_key;

pub use self::{kdf::Kdf, nonce::Nonce, public_key::PublicKey};
pub use self::{kdf::Kdf, nonce::Nonce, public_key::PublicKey, amino_types::AuthSigMessage};
use crate::error::{Error, ErrorKind};
use byteorder::{ByteOrder, LE};
use bytes::BufMut;
use chacha20poly1305::{
aead::{generic_array::GenericArray, NewAead},
aead::{generic_array::GenericArray, NewAead, Aead},
ChaCha20Poly1305,
};
use prost::{encoding::encode_varint, Message};
Expand All @@ -25,7 +26,6 @@ use std::{
marker::{Send, Sync},
};
use subtle::ConstantTimeEq;
use tendermint::amino_types::AuthSigMessage;
use x25519_dalek::{EphemeralSecret, PublicKey as EphemeralPublic};

/// Size of the MAC tag
Expand Down
15 changes: 15 additions & 0 deletions src/connection/secret_connection/amino_types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! Amino types used by Secret Connection
use prost_amino_derive::Message;

/// Authentication signature message
#[derive(Clone, PartialEq, Message)]
pub struct AuthSigMessage {
/// Public key
#[prost(bytes, tag = "1", amino_name = "tendermint/PubKeyEd25519")]
pub key: Vec<u8>,

/// Signature
#[prost(bytes, tag = "2")]
pub sig: Vec<u8>,
}
8 changes: 2 additions & 6 deletions src/keyring/ed25519/ledgertm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ pub fn init(
let provider = Ed25519LedgerTmAppSigner::connect().map_err(|_| Error::from(SigningError))?;
let public_key = provider.public_key().map_err(|_| Error::from(InvalidKey))?;

// TODO(tarcieri): support for adding account keys into keyrings; signatory upgrade
let consensus_pubkey = TendermintKey::ConsensusKey(
tendermint::signatory::ed25519::PublicKey::from_bytes(public_key.as_bytes())
.unwrap()
.into(),
);
// TODO(tarcieri): support for adding account keys into keyrings
let consensus_pubkey = TendermintKey::ConsensusKey(public_key.into());

let signer = Signer::new(
SigningProvider::LedgerTm,
Expand Down
8 changes: 2 additions & 6 deletions src/keyring/ed25519/softsign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,8 @@ pub fn init(chain_registry: &mut chain::Registry, configs: &[SoftsignConfig]) ->
let provider = Ed25519Signer::from(&seed);
let public_key = provider.public_key().map_err(|_| Error::from(InvalidKey))?;

// TODO(tarcieri): support for adding account keys into keyrings; upgrade Signatory version
let consensus_pubkey = TendermintKey::ConsensusKey(
tendermint::signatory::ed25519::PublicKey::from_bytes(public_key.as_bytes())
.unwrap()
.into(),
);
// TODO(tarcieri): support for adding account keys into keyrings
let consensus_pubkey = TendermintKey::ConsensusKey(public_key.into());

let signer = Signer::new(
SigningProvider::SoftSign,
Expand Down
8 changes: 2 additions & 6 deletions src/keyring/ed25519/yubihsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ pub fn init(
)
})?;

// TODO(tarcieri): support for adding account keys into keyrings; signatory upgrade
let consensus_pubkey = TendermintKey::ConsensusKey(
tendermint::signatory::ed25519::PublicKey::from_bytes(public_key.as_bytes())
.unwrap()
.into(),
);
// TODO(tarcieri): support for adding account keys into keyrings
let consensus_pubkey = TendermintKey::ConsensusKey(public_key.into());

let signer = Signer::new(SigningProvider::Yubihsm, consensus_pubkey, Box::new(signer));

Expand Down
5 changes: 1 addition & 4 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ impl Session {

self.log_signing_request(&request, started_at).unwrap();

// TODO(tarcieri): bump Signatory version in the `tendermint` crate
request.set_signature(&tendermint::signatory::ed25519::Signature::new(
signature.to_bytes(),
));
request.set_signature(&signature);

Ok(request.build_response(None))
}
Expand Down

0 comments on commit 81d8b29

Please sign in to comment.