diff --git a/orchestrator/Cargo.lock b/orchestrator/Cargo.lock index 84ed72eab..b563a9c41 100644 --- a/orchestrator/Cargo.lock +++ b/orchestrator/Cargo.lock @@ -782,9 +782,9 @@ checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" [[package]] name = "bech32" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c7f7096bc256f5e5cb960f60dfc4f4ef979ca65abe7fb9d5a4f77150d3783d4" +checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" [[package]] name = "bincode" @@ -811,6 +811,27 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bitcoin" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a41df6ad9642c5c15ae312dd3d074de38fd3eb7cc87ad4ce10f90292a83fe4d" +dependencies = [ + "bech32 0.8.1", + "bitcoin_hashes", + "secp256k1 0.20.3", + "serde", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006cc91e1a1d99819bc5b8214be3555c1f0611b169f527a1fdc54ed1f2b745b0" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.2.1" @@ -1094,7 +1115,7 @@ dependencies = [ "num-bigint 0.4.0", "num-traits", "num256", - "secp256k1 0.20.1", + "secp256k1 0.20.3", "serde", "serde-rlp", "serde_bytes", @@ -1441,10 +1462,10 @@ dependencies = [ [[package]] name = "deep_space" version = "2.4.7" -source = "git+https://github.com/iqlusioninc/deep_space/?branch=master#5fb0457ed49aed262e3f18eece038146cf62e321" +source = "git+https://github.com/iqlusioninc/deep_space/?branch=master#e35f52f5e2456a8abd26b1afe6e5cc33508c050b" dependencies = [ "base64 0.13.0", - "bech32 0.8.0", + "bech32 0.8.1", "bytes 1.1.0", "cosmos-sdk-proto", "hmac 0.11.0", @@ -1458,12 +1479,13 @@ dependencies = [ "rand 0.8.4", "ripemd160", "rust_decimal", - "secp256k1 0.20.1", + "secp256k1 0.20.3", "serde", "serde_derive", "serde_json", "sha2 0.9.8", "tendermint-proto", + "tiny-keccak", "tokio 1.13.0", "tonic", "unicode-normalization", @@ -2172,8 +2194,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -2203,7 +2227,7 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "gorc" -version = "0.3.8" +version = "0.3.9" dependencies = [ "abscissa_core", "abscissa_tokio", @@ -2307,12 +2331,14 @@ name = "gravity_utils" version = "0.1.0" dependencies = [ "actix", + "bitcoin", "clarity", "cosmos-sdk-proto", "deep_space 2.4.7", "ethers", "gravity_abi", "gravity_proto", + "hdpath", "log", "num-bigint 0.4.0", "num256", @@ -2322,6 +2348,7 @@ dependencies = [ "serde_derive", "serde_json", "sha3", + "tiny-bip39", "tokio 1.13.0", "tonic", "url", @@ -2384,6 +2411,16 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +[[package]] +name = "hdpath" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72adf5a17a0952ecfcddf8d46d071271d5ee52e78443f07ba0b2dcfe3063a132" +dependencies = [ + "bitcoin", + "byteorder", +] + [[package]] name = "heck" version = "0.3.2" @@ -2428,6 +2465,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + [[package]] name = "hmac" version = "0.10.1" @@ -3329,6 +3376,15 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac 0.8.0", +] + [[package]] name = "pbkdf2" version = "0.6.0" @@ -3984,6 +4040,12 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -4104,11 +4166,12 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733b114f058f260c0af7591434eef4272ae1a8ec2751766d3cb89c6df8d5e450" +checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a" dependencies = [ "secp256k1-sys 0.4.0", + "serde", ] [[package]] @@ -4709,6 +4772,25 @@ dependencies = [ "syn", ] +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.8", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "tiny-keccak" version = "2.0.2" diff --git a/orchestrator/Cargo.toml b/orchestrator/Cargo.toml index a5fd79794..1f66b7a63 100644 --- a/orchestrator/Cargo.toml +++ b/orchestrator/Cargo.toml @@ -41,3 +41,15 @@ gorc = { path = "./gorc" } relayer = { path = "./relayer" } gravity_abi_build = { path = "./gravity_abi_build" } gravity_abi = { path = "./gravity_abi" } + +[features] +ethermint = [ + "orchestrator/ethermint", + "cosmos_gravity/ethermint", + "relayer/ethermint", + "gorc/ethermint", + "register_delegate_keys/ethermint", +] + +[patch.crates-io] +deep_space = { git = "https://github.com/iqlusioninc/deep_space/", branch = "master" } diff --git a/orchestrator/cosmos_gravity/Cargo.toml b/orchestrator/cosmos_gravity/Cargo.toml index ee8100713..fb124245b 100644 --- a/orchestrator/cosmos_gravity/Cargo.toml +++ b/orchestrator/cosmos_gravity/Cargo.toml @@ -11,7 +11,7 @@ gravity_utils = {path = "../gravity_utils"} ethereum_gravity = {path = "../ethereum_gravity"} gravity_proto = {path = "../gravity_proto/"} -deep_space ={git="https://github.com/iqlusioninc/deep_space/", branch="master"} +deep_space = "2.4.7" ethers = { git = "https://github.com/iqlusioninc/ethers-rs.git", branch="zaki/error_abi_support", features = ["abigen"] } clarity = "0.4.11" serde = "1.0" @@ -29,3 +29,6 @@ bytes = "1" env_logger = "0.8" rand = "0.8" actix = "0.12" + +[features] +ethermint = [] diff --git a/orchestrator/cosmos_gravity/src/build.rs b/orchestrator/cosmos_gravity/src/build.rs index 9fa34223f..d898192b3 100644 --- a/orchestrator/cosmos_gravity/src/build.rs +++ b/orchestrator/cosmos_gravity/src/build.rs @@ -1,4 +1,3 @@ -use deep_space::private_key::PrivateKey as CosmosPrivateKey; use deep_space::Contact; use deep_space::Msg; use ethereum_gravity::types::EthClient; @@ -13,6 +12,8 @@ use gravity_utils::message_signatures::{ use gravity_utils::types::*; use std::collections::BTreeMap; +use crate::crypto::PrivateKey as CosmosPrivateKey; + pub async fn signer_set_tx_confirmation_messages( contact: &Contact, eth_client: EthClient, diff --git a/orchestrator/cosmos_gravity/src/crypto.rs b/orchestrator/cosmos_gravity/src/crypto.rs new file mode 100644 index 000000000..098a4f9dc --- /dev/null +++ b/orchestrator/cosmos_gravity/src/crypto.rs @@ -0,0 +1,104 @@ +use deep_space::private_key::TxParts; +use std::str::FromStr; + +#[cfg(not(feature = "ethermint"))] +use deep_space::public_key::COSMOS_PUBKEY_URL; +use deep_space::{ + error::{Bip39Error, HdWalletError, PrivateKeyError}, + private_key::{PrivateKey as InnerPrivateKey, SignType}, + Address, MessageArgs, Msg, +}; + +#[cfg(feature = "ethermint")] +pub const DEFAULT_HD_PATH: &str = "m/44'/60'/0'/0/0"; +#[cfg(not(feature = "ethermint"))] +pub const DEFAULT_HD_PATH: &str = "m/44'/118'/0'/0/0"; + +/// PrivateKey wraps cosmos private key, switch between cosmos and ethermint behavior according to cargo features. +#[derive(Debug, Copy, Clone)] +pub struct PrivateKey(InnerPrivateKey); + +impl FromStr for PrivateKey { + type Err = PrivateKeyError; + fn from_str(s: &str) -> Result { + InnerPrivateKey::from_str(s).map(Self) + } +} + +impl Into for PrivateKey { + fn into(self) -> InnerPrivateKey { + self.0 + } +} + +impl PrivateKey { + pub fn from_hd_wallet_path( + hd_path: &str, + phrase: &str, + passphrase: &str, + ) -> Result { + InnerPrivateKey::from_hd_wallet_path(hd_path, phrase, passphrase).map(Self) + } + + pub fn from_phrase(phrase: &str, passphrase: &str) -> Result { + if phrase.is_empty() { + return Err(HdWalletError::Bip39Error(Bip39Error::BadWordCount(0)).into()); + } + Self::from_hd_wallet_path(DEFAULT_HD_PATH, phrase, passphrase) + } + + pub fn from_secret(secret: &[u8]) -> Self { + Self(InnerPrivateKey::from_secret(secret)) + } + + pub fn to_address(&self, prefix: &str) -> Result { + #[cfg(feature = "ethermint")] + let result = { + let pubkey = self.0.to_public_key("")?; + Ok(pubkey.to_ethermint_address_with_prefix(prefix)?) + }; + #[cfg(not(feature = "ethermint"))] + let result = self.0.to_address(prefix); + + result + } + + pub fn sign_std_msg( + &self, + messages: &[Msg], + args: MessageArgs, + memo: impl Into, + ) -> Result, PrivateKeyError> { + #[cfg(feature = "ethermint")] + let result = self.0.sign_std_msg_ethermint( + messages, + args, + memo, + "/ethermint.crypto.v1.ethsecp256k1.PubKey", + ); + #[cfg(not(feature = "ethermint"))] + let result = self.0.sign_std_msg(messages, args, memo); + + result + } + + pub fn build_tx( + &self, + messages: &[Msg], + args: MessageArgs, + memo: impl Into, + ) -> Result { + #[cfg(feature = "ethermint")] + return self.0.build_tx( + messages, + args, + memo, + "/ethermint.crypto.v1.ethsecp256k1.PubKey", + SignType::Ethermint, + ); + #[cfg(not(feature = "ethermint"))] + return self + .0 + .build_tx(messages, args, memo, COSMOS_PUBKEY_URL, SignType::Cosmos); + } +} diff --git a/orchestrator/cosmos_gravity/src/lib.rs b/orchestrator/cosmos_gravity/src/lib.rs index 5106af88f..a8df72da7 100644 --- a/orchestrator/cosmos_gravity/src/lib.rs +++ b/orchestrator/cosmos_gravity/src/lib.rs @@ -7,6 +7,7 @@ extern crate log; pub mod build; +pub mod crypto; pub mod query; pub mod send; pub mod utils; diff --git a/orchestrator/cosmos_gravity/src/send.rs b/orchestrator/cosmos_gravity/src/send.rs index 09a830dc1..957dafdbc 100644 --- a/orchestrator/cosmos_gravity/src/send.rs +++ b/orchestrator/cosmos_gravity/src/send.rs @@ -2,7 +2,6 @@ use bytes::BytesMut; use deep_space::address::Address; use deep_space::coin::Coin; use deep_space::error::CosmosGrpcError; -use deep_space::private_key::PrivateKey as CosmosPrivateKey; use deep_space::Contact; use deep_space::Fee; use deep_space::Msg; @@ -19,6 +18,8 @@ use std::cmp; use std::collections::HashSet; use std::{result::Result, time::Duration}; +use crate::crypto::PrivateKey as CosmosPrivateKey; + pub const MEMO: &str = "Sent using Gravity Bridge Orchestrator"; pub const TIMEOUT: Duration = Duration::from_secs(60); diff --git a/orchestrator/ethereum_gravity/Cargo.toml b/orchestrator/ethereum_gravity/Cargo.toml index 45b49d0c7..a8b77af42 100644 --- a/orchestrator/ethereum_gravity/Cargo.toml +++ b/orchestrator/ethereum_gravity/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" gravity_abi = { path = "../gravity_abi" } gravity_utils = { path = "../gravity_utils" } -deep_space = { git="https://github.com/iqlusioninc/deep_space/", branch = "master" } +deep_space = "2.4.7" ethers = { git = "https://github.com/iqlusioninc/ethers-rs.git", branch = "zaki/error_abi_support", features = ["abigen"] } clarity = "0.4.11" web30 = "0.15.4" diff --git a/orchestrator/gorc/Cargo.toml b/orchestrator/gorc/Cargo.toml index 9add95477..4d06aae3e 100644 --- a/orchestrator/gorc/Cargo.toml +++ b/orchestrator/gorc/Cargo.toml @@ -18,7 +18,7 @@ gravity_utils = { path = "../gravity_utils" } orchestrator = { path = "../orchestrator" } relayer = { path = "../relayer" } -deep_space ={git="https://github.com/iqlusioninc/deep_space/", branch="master"} +deep_space = "2.4.7" ethers = { git = "https://github.com/iqlusioninc/ethers-rs.git", branch = "zaki/error_abi_support", features = ["abigen"] } clarity = "0.4.12" actix-rt = "2.5" @@ -51,3 +51,6 @@ version = "0.6.0-rc.0" [dev-dependencies] abscissa_core = { version = "0.6.0-rc.0", features = ["testing"] } once_cell = "1.2" + +[features] +ethermint = ["cosmos_gravity/ethermint", "orchestrator/ethermint", "relayer/ethermint"] diff --git a/orchestrator/gorc/src/commands/tx/cosmos.rs b/orchestrator/gorc/src/commands/tx/cosmos.rs index c59a68cc0..c99bf2a72 100644 --- a/orchestrator/gorc/src/commands/tx/cosmos.rs +++ b/orchestrator/gorc/src/commands/tx/cosmos.rs @@ -4,10 +4,11 @@ use crate::{application::APP, prelude::*, utils::*}; use abscissa_core::{clap::Parser, Command, Runnable}; use clarity::Uint256; use cosmos_gravity::send::send_to_eth; -use deep_space::{coin::Coin, private_key::PrivateKey as CosmosPrivateKey}; +use deep_space::coin::Coin; use ethers::types::Address as EthAddress; use gravity_proto::gravity::DenomToErc20Request; use gravity_utils::connection_prep::{check_for_fee_denom, create_rpc_connections}; +use cosmos_gravity::crypto::PrivateKey as CosmosPrivateKey; use regex::Regex; use std::process::exit; diff --git a/orchestrator/gorc/src/config.rs b/orchestrator/gorc/src/config.rs index 54d4010f5..96fbc919c 100644 --- a/orchestrator/gorc/src/config.rs +++ b/orchestrator/gorc/src/config.rs @@ -1,3 +1,4 @@ +use cosmos_gravity::crypto::DEFAULT_HD_PATH; use ethers::signers::LocalWallet as EthWallet; use serde::{Deserialize, Serialize}; use signatory::FsKeyStore; @@ -32,7 +33,7 @@ impl GorcConfig { EthWallet::from(self.load_secret_key(name)) } - pub fn load_deep_space_key(&self, name: String) -> deep_space::private_key::PrivateKey { + pub fn load_deep_space_key(&self, name: String) -> cosmos_gravity::crypto::PrivateKey { let key = self.load_secret_key(name).to_bytes(); let key = deep_space::utils::bytes_to_hex_str(&key); key.parse().expect("Could not parse private key") @@ -101,7 +102,7 @@ pub struct CosmosSection { impl Default for CosmosSection { fn default() -> Self { Self { - key_derivation_path: "m/44'/118'/0'/0/0".to_owned(), + key_derivation_path: DEFAULT_HD_PATH.to_owned(), grpc: "http://localhost:9090".to_owned(), prefix: "cosmos".to_owned(), gas_price: GasPrice::default(), diff --git a/orchestrator/gravity_utils/Cargo.toml b/orchestrator/gravity_utils/Cargo.toml index 6b525afba..eff0d947a 100644 --- a/orchestrator/gravity_utils/Cargo.toml +++ b/orchestrator/gravity_utils/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" gravity_abi = { path = "../gravity_abi" } gravity_proto = { path = "../gravity_proto/" } cosmos-sdk-proto = "0.6.3" -deep_space = { git="https://github.com/iqlusioninc/deep_space/", branch="master" } +deep_space = "2.4.7" ethers = { git = "https://github.com/iqlusioninc/ethers-rs.git", branch = "zaki/error_abi_support", features = ["abigen"] } web30 = "0.15" clarity = "0.4.11" @@ -24,7 +24,11 @@ num-bigint = "0.4" log = "0.4" url = "2" sha3 = "0.9" +tiny-bip39 = "0.8.0" +bitcoin = { version = "=0.27", features = ["use-serde"] } +hdpath = { version = "0.6.0", features = ["with-bitcoin"] } rustc-hex = "2.1.0" + [dev_dependencies] rand = "0.8" actix = "0.12" diff --git a/orchestrator/orchestrator/Cargo.toml b/orchestrator/orchestrator/Cargo.toml index 689c86eee..b89fb9b37 100644 --- a/orchestrator/orchestrator/Cargo.toml +++ b/orchestrator/orchestrator/Cargo.toml @@ -16,7 +16,7 @@ gravity_abi = { path = "../gravity_abi" } gravity_utils = { path = "../gravity_utils" } gravity_proto = { path = "../gravity_proto" } -deep_space={git="https://github.com/iqlusioninc/deep_space/", branch = "master" } +deep_space = "2.4.7" ethers = { git = "https://github.com/iqlusioninc/ethers-rs.git", branch = "zaki/error_abi_support", features = ["abigen"] } serde_derive = "1.0" clarity = "0.4.11" @@ -45,3 +45,6 @@ prometheus = "0.12.0" # feature includes it's own OpenSSL version that's compiled on the fly # If ANY crate in this workspace has this it will work for all of them. openssl = { version = "0.10", features = ["vendored"] } + +[features] +ethermint = ["cosmos_gravity/ethermint", "relayer/ethermint"] diff --git a/orchestrator/orchestrator/src/ethereum_event_watcher.rs b/orchestrator/orchestrator/src/ethereum_event_watcher.rs index e6e91004d..8c189fcae 100644 --- a/orchestrator/orchestrator/src/ethereum_event_watcher.rs +++ b/orchestrator/orchestrator/src/ethereum_event_watcher.rs @@ -6,7 +6,7 @@ use crate::get_with_retry::get_chain_id_with_retry; use crate::metrics; use cosmos_gravity::build; use cosmos_gravity::query::get_last_event_nonce; -use deep_space::private_key::PrivateKey as CosmosPrivateKey; +use cosmos_gravity::crypto::PrivateKey as CosmosPrivateKey; use deep_space::{Contact, Msg}; use ethereum_gravity::types::EthClient; use ethers::prelude::*; diff --git a/orchestrator/orchestrator/src/main_loop.rs b/orchestrator/orchestrator/src/main_loop.rs index 3d36a4405..fc2a5e0da 100644 --- a/orchestrator/orchestrator/src/main_loop.rs +++ b/orchestrator/orchestrator/src/main_loop.rs @@ -19,7 +19,7 @@ use cosmos_gravity::{ }; use deep_space::client::ChainStatus; use deep_space::error::CosmosGrpcError; -use deep_space::private_key::PrivateKey as CosmosPrivateKey; +use cosmos_gravity::crypto::PrivateKey as CosmosPrivateKey; use deep_space::{Contact, Msg}; use ethereum_gravity::types::EthClient; use ethereum_gravity::utils::get_gravity_id; diff --git a/orchestrator/register_delegate_keys/Cargo.toml b/orchestrator/register_delegate_keys/Cargo.toml index 71679d100..3e6d4e8b6 100644 --- a/orchestrator/register_delegate_keys/Cargo.toml +++ b/orchestrator/register_delegate_keys/Cargo.toml @@ -15,7 +15,7 @@ cosmos_gravity = {path = "../cosmos_gravity"} gravity_utils = {path = "../gravity_utils"} gravity_proto = {path = "../gravity_proto/"} -deep_space ={git="https://github.com/iqlusioninc/deep_space/", branch="master"} +deep_space = "2.4.7" ethers = { git = "https://github.com/iqlusioninc/ethers-rs.git", branch = "zaki/error_abi_support", features = ["abigen"] } contact = "0.4" serde_derive = "1.0" @@ -28,4 +28,7 @@ web30 = "0.15" env_logger = "0.8" log = "0.4.14" openssl-probe = "0.1" -rand = "0.8" \ No newline at end of file +rand = "0.8" + +[features] +ethermint = ["cosmos_gravity/ethermint", "relayer/ethermint"] diff --git a/orchestrator/register_delegate_keys/src/main.rs b/orchestrator/register_delegate_keys/src/main.rs index 79b418b62..02fa06dc0 100644 --- a/orchestrator/register_delegate_keys/src/main.rs +++ b/orchestrator/register_delegate_keys/src/main.rs @@ -7,13 +7,14 @@ extern crate lazy_static; use clarity::PrivateKey as EthPrivateKey; use cosmos_gravity::send::update_gravity_delegate_addresses; -use deep_space::{mnemonic::Mnemonic, private_key::PrivateKey as CosmosPrivateKey}; +use deep_space::{coin::Coin, mnemonic::Mnemonic}; use docopt::Docopt; use ethers::core::k256::ecdsa::SigningKey; use ethers::prelude::*; use gravity_utils::connection_prep::check_for_fee_denom; use gravity_utils::connection_prep::{create_rpc_connections, wait_for_cosmos_node_ready}; use log::error; +use cosmos_gravity::crypto::PrivateKey as CosmosPrivateKey; use rand::{thread_rng, Rng}; use std::time::Duration; diff --git a/orchestrator/relayer/Cargo.toml b/orchestrator/relayer/Cargo.toml index 23b9b76b1..dfd257bf2 100644 --- a/orchestrator/relayer/Cargo.toml +++ b/orchestrator/relayer/Cargo.toml @@ -19,7 +19,7 @@ gravity_abi = { path = "../gravity_abi" } gravity_utils = { path = "../gravity_utils" } gravity_proto = { path = "../gravity_proto" } -deep_space ={git="https://github.com/iqlusioninc/deep_space/", branch="master"} +deep_space = "2.4.7" ethers = { git = "https://github.com/iqlusioninc/ethers-rs.git", branch = "zaki/error_abi_support", features = ["abigen"] } serde_derive = "1.0" clarity = "0.4.11" @@ -34,6 +34,8 @@ tokio = "1.4" tonic = "0.4" openssl-probe = "0.1" - [dev-dependencies] actix = "0.12" + +[features] +ethermint = ["cosmos_gravity/ethermint"] diff --git a/orchestrator/test_runner/Cargo.toml b/orchestrator/test_runner/Cargo.toml index 41474fdf9..7a2e8e1d5 100644 --- a/orchestrator/test_runner/Cargo.toml +++ b/orchestrator/test_runner/Cargo.toml @@ -17,7 +17,7 @@ gravity_utils = {path = "../gravity_utils"} gravity_proto = {path = "../gravity_proto/"} orchestrator = {path = "../orchestrator/"} -deep_space ={git="https://github.com/iqlusioninc/deep_space/", branch="master"} +deep_space = "2.4.7" serde_derive = "1.0" clarity = "0.4.11" docopt = "1" @@ -36,3 +36,6 @@ rand = "0.8" tonic = "0.4" futures = "0.3.18" hex = "0.4.3" + +[features] +ethermint = ["cosmos_gravity/ethermint", "orchestrator/ethermint"] diff --git a/orchestrator/test_runner/src/bootstrapping.rs b/orchestrator/test_runner/src/bootstrapping.rs index 1d9e12338..ffb2788ac 100644 --- a/orchestrator/test_runner/src/bootstrapping.rs +++ b/orchestrator/test_runner/src/bootstrapping.rs @@ -1,5 +1,5 @@ use crate::utils::ValidatorKeys; -use deep_space::private_key::PrivateKey as CosmosPrivateKey; +use cosmos_gravity::crypto::PrivateKey as CosmosPrivateKey; use ethers::core::k256::ecdsa::SigningKey; use ethers::types::Address as EthAddress; use std::fs::File; diff --git a/orchestrator/test_runner/src/happy_path.rs b/orchestrator/test_runner/src/happy_path.rs index 429f1e86c..4cacc97f4 100644 --- a/orchestrator/test_runner/src/happy_path.rs +++ b/orchestrator/test_runner/src/happy_path.rs @@ -7,11 +7,11 @@ use crate::MINER_CLIENT; use crate::OPERATION_TIMEOUT; use crate::TOTAL_TIMEOUT; use clarity::Uint256; +use cosmos_gravity::crypto::PrivateKey as CosmosPrivateKey; use cosmos_gravity::send::{send_request_batch_tx, send_to_eth}; use cosmos_gravity::{build, query::get_oldest_unsigned_transaction_batch, send}; use deep_space::address::Address as CosmosAddress; use deep_space::coin::Coin; -use deep_space::private_key::PrivateKey as CosmosPrivateKey; use deep_space::Contact; use ethereum_gravity::erc20_utils::get_erc20_balance; use ethereum_gravity::utils::get_valset_nonce; @@ -185,7 +185,7 @@ pub async fn test_valset_update( delegate_address.parse().unwrap(), amount.clone(), get_fee(), - keys_to_change.orch_key, + keys_to_change.orch_key.into(), Some(OPERATION_TIMEOUT), ) .await; diff --git a/orchestrator/test_runner/src/happy_path_v2.rs b/orchestrator/test_runner/src/happy_path_v2.rs index e02f22a20..53e717134 100644 --- a/orchestrator/test_runner/src/happy_path_v2.rs +++ b/orchestrator/test_runner/src/happy_path_v2.rs @@ -120,7 +120,7 @@ pub async fn happy_path_test_v2( send_to_user_coin.clone(), Some(get_fee()), user.cosmos_address, - keys[0].validator_key, + keys[0].validator_key.into(), Some(TOTAL_TIMEOUT), ) .await diff --git a/orchestrator/test_runner/src/orch_keys_update.rs b/orchestrator/test_runner/src/orch_keys_update.rs index ac0f98a67..ffb14322e 100644 --- a/orchestrator/test_runner/src/orch_keys_update.rs +++ b/orchestrator/test_runner/src/orch_keys_update.rs @@ -3,7 +3,7 @@ use crate::utils::ValidatorKeys; use cosmos_gravity::send::update_gravity_delegate_addresses; use deep_space::address::Address as CosmosAddress; -use deep_space::private_key::PrivateKey as CosmosPrivateKey; +use cosmos_gravity::crypto::PrivateKey as CosmosPrivateKey; use deep_space::Contact; use ethers::types::Address as EthAddress; use ethers::{core::k256::ecdsa::SigningKey, prelude::*}; diff --git a/orchestrator/test_runner/src/utils.rs b/orchestrator/test_runner/src/utils.rs index c09ebd9ea..a7197f203 100644 --- a/orchestrator/test_runner/src/utils.rs +++ b/orchestrator/test_runner/src/utils.rs @@ -1,7 +1,7 @@ use crate::one_eth; use deep_space::address::Address as CosmosAddress; use deep_space::coin::Coin; -use deep_space::private_key::PrivateKey as CosmosPrivateKey; +use cosmos_gravity::crypto::PrivateKey as CosmosPrivateKey; use deep_space::Contact; use ethereum_gravity::{erc20_utils::get_erc20_balance, types::EthClient}; use ethers::core::k256::ecdsa::SigningKey;