Skip to content

Commit 6cf444b

Browse files
authored
fix: hash the msg before requesting signer (#3446)
* fix: hash the msg before requesting signer * refactor: taplo fmt
1 parent 4d2b4e4 commit 6cf444b

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

tee-worker/omni-executor/intent/executors/cross-chain/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ log = { workspace = true }
1111
parity-scale-codec = { workspace = true }
1212
rust_decimal = { workspace = true }
1313
solana-sdk = { workspace = true }
14+
sp-core = { workspace = true }
1415
tokio = { workspace = true }
1516

1617
# Local dependencies

tee-worker/omni-executor/intent/executors/cross-chain/src/cross_chain_swap_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ async fn simple_cross_chain_swap() {
129129
mockall::predicate::eq(pumpx::signer_client::ChainType::Evm),
130130
mockall::predicate::eq(pumpx_wallet_index),
131131
mockall::predicate::eq(pumpx_wallet_omni_account),
132-
mockall::predicate::eq(vec![create_order_encoded_tx.clone()]),
132+
mockall::predicate::always(),
133133
)
134134
.times(1)
135135
.returning(move |_, _, _, _| Ok(vec![create_order_tx_signature.to_vec()]));

tee-worker/omni-executor/intent/executors/cross-chain/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use heima_authentication::auth_token::AUTH_TOKEN_ACCESS_TYPE;
3434
use rust_decimal::prelude::*;
3535
use rust_decimal::Decimal;
3636
use solana::{signer::RemoteSigner, SolanaClient as SolanaClientTrait};
37+
use sp_core::keccak_256;
3738
use std::str::FromStr;
3839
use tokio::{
3940
runtime::Handle,
@@ -1110,7 +1111,8 @@ impl<BinanceClient: BinanceApi, SolanaClient: SolanaClientTrait>
11101111
.iter()
11111112
.map(|s| {
11121113
let hex_str = s.trim_start_matches("0x");
1113-
hex::decode(hex_str).expect("Invalid hex string")
1114+
let hex_decoded = hex::decode(hex_str).expect("Invalid hex string");
1115+
keccak_256(&hex_decoded).to_vec()
11141116
})
11151117
.collect();
11161118

0 commit comments

Comments
 (0)