Skip to content

Commit

Permalink
Problem: Dependencies are not upgraded to latest (#81)
Browse files Browse the repository at this point in the history
* Problem: Dependencies are not upgraded to latest

Solution: Upgraded dependencies and fixed clippy warnings

* Fix ethermint build failure

* Add missing import

* upgrade dependencies

* bump up versions of crate to 0.1.2
  • Loading branch information
devashishdxt authored May 11, 2022
1 parent 96bf65e commit 5678573
Show file tree
Hide file tree
Showing 8 changed files with 666 additions and 578 deletions.
1,110 changes: 596 additions & 514 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions event-hooks/stdout-logger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stdout-logger"
version = "0.1.0"
version = "0.1.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -9,6 +9,6 @@ edition = "2021"
crate-type = ["dylib"]

[dependencies]
anyhow = "1.0.51"
async-trait = "0.1.51"
anyhow = "1.0.57"
async-trait = "0.1.53"
solo-machine-core = { path = "../../solo-machine-core" }
16 changes: 8 additions & 8 deletions signers/mnemonic-signer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mnemonic-signer"
version = "0.1.0"
version = "0.1.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -9,13 +9,13 @@ edition = "2021"
crate-type = ["dylib"]

[dependencies]
anyhow = "1.0.51"
async-trait = "0.1.51"
bip32 = { version = "0.2.2", features = ["bip39"] }
k256 = { version = "0.9.6", features = ["ecdsa"] }
ripemd160 = "0.9.1"
sha2 = "0.9.8"
sha3 = { version = "0.9.1", optional = true }
anyhow = "1.0.57"
async-trait = "0.1.53"
bip32 = { version = "0.4.0", features = ["bip39"] }
k256 = { version = "0.11.0", features = ["ecdsa"] }
ripemd = "0.1.1"
sha2 = "0.10.2"
sha3 = { version = "0.10.1", optional = true }
solo-machine-core = { path = "../../solo-machine-core" }

[features]
Expand Down
14 changes: 8 additions & 6 deletions signers/mnemonic-signer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use std::{env, str::FromStr, sync::Arc};
use anyhow::{anyhow, Context, Result};
use async_trait::async_trait;
use bip32::{DerivationPath, ExtendedPrivateKey, Language, Mnemonic};
use k256::ecdsa::{signature::DigestSigner, Signature, SigningKey};
use ripemd160::Digest;
use k256::ecdsa::{Signature, SigningKey};
use solo_machine_core::{
cosmos::crypto::PublicKey,
signer::{AddressAlgo, Message, SignerRegistrar},
Expand Down Expand Up @@ -107,11 +106,14 @@ impl Signer for MnemonicSigner {
let signing_key = self.get_signing_key()?;

let signature: Signature = match self.algo {
AddressAlgo::Secp256k1 => signing_key.sign_digest(sha2::Sha256::new().chain(message)),
AddressAlgo::Secp256k1 => <SigningKey as k256::ecdsa::signature::Signer<
k256::ecdsa::Signature,
>>::sign(&signing_key, message.as_ref()),
#[cfg(feature = "ethermint")]
AddressAlgo::EthSecp256k1 => {
signing_key.sign_digest(sha3::Keccak256::new().chain(message))
}
AddressAlgo::EthSecp256k1 => <SigningKey as k256::ecdsa::signature::Signer<
k256::ecdsa::recoverable::Signature,
>>::sign(&signing_key, message.as_ref())
.into(),
};

Ok(signature.as_ref().to_vec())
Expand Down
44 changes: 22 additions & 22 deletions solo-machine-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
[package]
name = "solo-machine-core"
version = "0.1.0"
version = "0.1.2"
authors = ["Devashish Dixit <devashishdxt@gmail.com>"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.51"
async-trait = "0.1.51"
anyhow = "1.0.57"
async-trait = "0.1.53"
bech32 = "0.8.1"
chrono = { version = "0.4.19", default-features = false }
cosmos-sdk-proto = "0.8.0"
chrono = { version = "0.4.19", default-features = false, features = ["serde"] }
cosmos-sdk-proto = "0.11.0"
ed25519-dalek = { version = "1.0.1", features = ["serde"] }
hex = { version = "0.4.3", features = ["serde"] }
k256 = { version = "0.9.6", features = ["ecdsa"] }
k256 = { version = "0.11.0", features = ["ecdsa"] }
num-rational = { version = "0.4.0", features = ["serde"] }
primitive-types = { version = "0.10.1", features = ["serde"] }
primitive-types = { version = "0.11.1", features = ["serde"] }
prost = "0.9.0"
prost-types = "0.9.0"
rand = "0.8.4"
regex = "1.5.4"
ripemd160 = "0.9.1"
rust_decimal = "1.18.0"
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.72"
sha2 = "0.9.8"
sha3 = { version = "0.9.1", optional = true }
sqlx = { version = "0.5.9", features = [
rand = "0.8.5"
regex = "1.5.5"
ripemd = "0.1.1"
rust_decimal = "1.23.1"
serde = { version = "1.0.137", features = ["derive"] }
serde_json = "1.0.81"
sha2 = "0.10.2"
sha3 = { version = "0.10.1", optional = true }
sqlx = { version = "0.5.13", features = [
"json",
"macros",
"runtime-tokio-rustls",
"sqlite",
"chrono",
] }
tendermint = "0.23.1"
tendermint-light-client = "0.23.1"
tendermint-rpc = { version = "0.23.1", features = ["http-client"] }
tokio = { version = "1.14.0", features = ["sync"] }
tonic = { version = "0.6.1", features = ["tls", "tls-roots"] }
tendermint = "0.23.6"
tendermint-light-client = "0.23.6"
tendermint-rpc = { version = "0.23.6", features = ["http-client"] }
tokio = { version = "1.18.2", features = ["sync"] }
tonic = { version = "0.6.2", features = ["tls", "tls-roots"] }
urlencoding = "2.1.0"

[build-dependencies]
tonic-build = "0.6.0"
tonic-build = "0.6.2"

[features]
default = ["solomachine-v2"]
Expand Down
11 changes: 6 additions & 5 deletions solo-machine-core/src/cosmos/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ use anyhow::{anyhow, ensure, Error, Result};
use bech32::{ToBase32, Variant};
use cosmos_sdk_proto::cosmos::tx::signing::v1beta1::signature_descriptor::data::Sum as SignatureData;
use k256::ecdsa::VerifyingKey;
#[cfg(feature = "ethermint")]
use k256::elliptic_curve::sec1::ToEncodedPoint;
use prost::Message;
use prost_types::Any;
use ripemd160::{Digest, Ripemd160};
use ripemd::Ripemd160;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use sha2::Sha256;
use sha2::{Digest, Sha256};
#[cfg(feature = "ethermint")]
use sha3::Keccak256;

Expand Down Expand Up @@ -151,9 +153,8 @@ impl PublicKey {
Self::EthSecp256k1(ref key) => {
use k256::EncodedPoint;

let encoded_point: EncodedPoint = key.into();
let hash =
Keccak256::digest(&encoded_point.to_untagged_bytes().unwrap())[12..].to_vec();
let encoded_point: EncodedPoint = key.to_encoded_point(false);
let hash = Keccak256::digest(&encoded_point.as_bytes()[1..])[12..].to_vec();

Ok(hash)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::time::SystemTime;

use cosmos_sdk_proto::ibc::{
core::commitment::v1::MerkleRoot, lightclients::tendermint::v1::ConsensusState,
};
Expand All @@ -12,11 +10,17 @@ pub trait IConsensusState: Sized {

impl IConsensusState for ConsensusState {
fn from_block_header(header: BlockHeader) -> Self {
let timestamp =
cosmos_sdk_proto::tendermint::google::protobuf::Timestamp::from(header.time);

Self {
root: Some(MerkleRoot {
hash: header.app_hash.value(),
}),
timestamp: Some(Timestamp::from(SystemTime::from(header.time.0))),
timestamp: Some(Timestamp {
seconds: timestamp.seconds,
nanos: timestamp.nanos,
}),
next_validators_hash: header.next_validators_hash.as_bytes().to_vec(),
}
}
Expand Down
33 changes: 16 additions & 17 deletions solo-machine/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
[package]
name = "solo-machine"
version = "0.1.0"
version = "0.1.2"
authors = ["Devashish Dixit <devashishdxt@gmail.com>"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.51"
async-trait = "0.1.51"
bip32 = { version = "0.2.2", features = ["bip39"] }
cli-table = { version = "0.4.6", default-features = false, features = [
anyhow = "1.0.57"
async-trait = "0.1.53"
cli-table = { version = "0.4.7", default-features = false, features = [
"derive",
] }
dotenv = "0.15.0"
env_logger = "0.9.0"
hex = "0.4.3"
humantime = "2.1.0"
k256 = { version = "0.9.6", features = ["ecdsa"] }
libloading = "0.7.2"
log = "0.4.14"
k256 = { version = "0.11.0", features = ["ecdsa"] }
libloading = "0.7.3"
log = "0.4.17"
num-rational = "0.4.0"
primitive-types = "0.10.1"
primitive-types = "0.11.1"
prost = "0.9.0"
prost-types = "0.9.0"
rust_decimal = "1.18.0"
serde_json = "1.0.72"
rust_decimal = "1.23.1"
serde_json = "1.0.81"
solo-machine-core = { path = "../solo-machine-core", features = [
"solomachine-v2",
] }
structopt = "0.3.25"
tendermint = "0.23.1"
termcolor = "1.1.2"
tokio = { version = "1.14.0", features = ["fs", "macros", "rt-multi-thread"] }
tonic = { version = "0.6.1", features = ["tls", "tls-roots"] }
structopt = "0.3.26"
tendermint = "0.23.6"
termcolor = "1.1.3"
tokio = { version = "1.18.2", features = ["fs", "macros", "rt-multi-thread"] }
tonic = { version = "0.6.2", features = ["tls", "tls-roots"] }

[features]
default = []
Expand All @@ -42,4 +41,4 @@ postgres = ["solo-machine-core/postgres"]

[build-dependencies]
prost-build = "0.9.0"
tonic-build = "0.6.0"
tonic-build = "0.6.2"

0 comments on commit 5678573

Please sign in to comment.