diff --git a/Cargo.lock b/Cargo.lock index 1d7cb355e..12d2f3494 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1229,7 +1229,7 @@ dependencies = [ [[package]] name = "eos" -version = "6.11.3" +version = "6.11.4" dependencies = [ "bitcoin 0.29.0", "bitcoin 0.29.2", @@ -1478,7 +1478,7 @@ dependencies = [ [[package]] name = "ethereum" -version = "6.14.1" +version = "6.15.0" dependencies = [ "chain_ids", "common", @@ -4320,7 +4320,7 @@ dependencies = [ [[package]] name = "sentinel-lib" -version = "0.2.0" +version = "0.2.1" dependencies = [ "anyhow", "axum", diff --git a/common/eos/Cargo.toml b/common/eos/Cargo.toml index af46aca09..0b7a9cdc7 100644 --- a/common/eos/Cargo.toml +++ b/common/eos/Cargo.toml @@ -3,7 +3,7 @@ name = "eos" license = "MIT" publish = false edition = "2021" -version = "6.11.3" +version = "6.11.4" readme = "README.md" rust-version = "1.56" keywords = ["provable", "defi", "crypto"] diff --git a/common/eos/src/eos_types.rs b/common/eos/src/eos_types.rs index 90d983581..0f5c18a86 100644 --- a/common/eos/src/eos_types.rs +++ b/common/eos/src/eos_types.rs @@ -125,13 +125,3 @@ pub struct ProducerSchedule { pub version: u32, pub producers: ProducerKeys, } - -#[derive(Debug)] -pub struct EosRawTxData { - pub sender: String, - pub mint_nonce: u64, - pub receiver: String, - pub asset_amount: u64, - pub asset_name: String, - pub eth_address: String, -} diff --git a/common/ethereum/Cargo.toml b/common/ethereum/Cargo.toml index 6202171e5..b70a57b3c 100644 --- a/common/ethereum/Cargo.toml +++ b/common/ethereum/Cargo.toml @@ -3,7 +3,7 @@ license = "MIT" publish = false edition = "2021" name = "ethereum" -version = "6.14.1" +version = "6.15.0" readme = "README.md" rust-version = "1.56" keywords = ["defi", "crypto"] diff --git a/common/ethereum/src/eth_crypto/eth_private_key.rs b/common/ethereum/src/eth_crypto/eth_private_key.rs index 151d85c9c..96590e386 100644 --- a/common/ethereum/src/eth_crypto/eth_private_key.rs +++ b/common/ethereum/src/eth_crypto/eth_private_key.rs @@ -2,7 +2,7 @@ use std::{convert::TryFrom, fmt, str::FromStr}; use common::{ constants::MAX_DATA_SENSITIVITY_LEVEL, - crypto_utils::{generate_random_private_key, keccak_hash_bytes}, + crypto_utils::{generate_random_private_key, keccak_hash_bytes, sha256_hash_bytes}, strip_hex_prefix, traits::DatabaseInterface, types::{Byte, Result}, @@ -91,10 +91,19 @@ impl EthSigningCapabilities for EthPrivateKey { self.sign_hash(hash).map(EthSignature::set_recovery_param) } - fn hash_and_sign_msg(&self, message: &[Byte]) -> Result { + fn keccak_hash_and_sign_msg(&self, message: &[Byte]) -> Result { self.sign_hash(keccak_hash_bytes(message)) } + fn sha256_hash_and_sign_msg(&self, message: &[Byte]) -> Result { + self.sign_hash(H256::from_slice(&sha256_hash_bytes(message))) + } + + fn hash_and_sign_msg(&self, message: &[Byte]) -> Result { + // NOTE: For backwards compatibility, where keccack was the default hashing for eth sigs + self.keccak_hash_and_sign_msg(message) + } + fn hash_and_sign_msg_with_eth_prefix(&self, message: &[Byte]) -> Result { let eth_msg_prefix = b"\x19Ethereum Signed Message:\n"; diff --git a/common/ethereum/src/eth_traits.rs b/common/ethereum/src/eth_traits.rs index 96ccc2237..48add078c 100644 --- a/common/ethereum/src/eth_traits.rs +++ b/common/ethereum/src/eth_traits.rs @@ -19,6 +19,8 @@ pub trait EthTxInfoCompatible { pub trait EthSigningCapabilities { fn sign_hash(&self, hash: EthHash) -> Result; fn hash_and_sign_msg(&self, message: &[Byte]) -> Result; + fn keccak_hash_and_sign_msg(&self, message: &[Byte]) -> Result; + fn sha256_hash_and_sign_msg(&self, message: &[Byte]) -> Result; fn hash_and_sign_msg_with_eth_prefix(&self, message: &[Byte]) -> Result; fn sign_hash_and_set_eth_recovery_param(&self, hash: EthHash) -> Result; } diff --git a/common/sentinel/Cargo.toml b/common/sentinel/Cargo.toml index d1aedae3e..ec4c9ba88 100644 --- a/common/sentinel/Cargo.toml +++ b/common/sentinel/Cargo.toml @@ -1,6 +1,6 @@ [package] edition = "2021" -version = "0.2.0" +version = "0.2.1" name = "sentinel-lib" authors = [ "Greg Kapka " ] description = "shared fxnality for pTokens sentinels" diff --git a/common/sentinel/src/messages/websocket/websocket_messages_args/reset_chain_args.rs b/common/sentinel/src/messages/websocket/websocket_messages_args/reset_chain_args.rs index 62a903515..a47ca7927 100644 --- a/common/sentinel/src/messages/websocket/websocket_messages_args/reset_chain_args.rs +++ b/common/sentinel/src/messages/websocket/websocket_messages_args/reset_chain_args.rs @@ -45,22 +45,26 @@ impl TryFrom> for WebSocketMessagesResetChainArgs { }); } - let mut arg = args[0].clone(); + let arg1 = args[0].clone(); - let network_id = NetworkId::try_from(&arg).map_err(|_| WebSocketMessagesError::UnrecognizedNetworkId(arg))?; + let network_id = NetworkId::try_from(&arg1).map_err(|_| WebSocketMessagesError::UnrecognizedNetworkId(arg1))?; - arg = args[1].clone(); - let use_latest_block = matches!(arg.to_lowercase().as_ref(), "latest"); + let arg2 = args[1].clone(); + let use_latest_block = matches!(arg2.to_lowercase().as_ref(), "latest"); let block_num = if use_latest_block { None } else { - let n = arg.parse::().map_err(|_| WebSocketMessagesError::ParseInt(arg))?; + let n = arg2 + .parse::() + .map_err(|_| WebSocketMessagesError::ParseInt(arg2))?; Some(n) }; - arg = args[2].clone(); - let confs = arg.parse::().map_err(|_| WebSocketMessagesError::ParseInt(arg))?; + let arg3 = args[2].clone(); + let confs = arg3 + .parse::() + .map_err(|_| WebSocketMessagesError::ParseInt(arg3))?; let validate = matches!(args[3].as_ref(), "true");