diff --git a/tee-worker/omni-executor/rpc-server/src/lib.rs b/tee-worker/omni-executor/rpc-server/src/lib.rs index 0123f14cb9..eafb7438fe 100644 --- a/tee-worker/omni-executor/rpc-server/src/lib.rs +++ b/tee-worker/omni-executor/rpc-server/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::result_large_err)] + mod auth_token_key_store; mod auth_utils; mod config; diff --git a/tee-worker/omni-executor/rpc-server/src/methods/omni/common.rs b/tee-worker/omni-executor/rpc-server/src/methods/omni/common.rs index ed4aa024b9..a5c5aa4a4e 100644 --- a/tee-worker/omni-executor/rpc-server/src/methods/omni/common.rs +++ b/tee-worker/omni-executor/rpc-server/src/methods/omni/common.rs @@ -21,6 +21,16 @@ pub struct PumpxRpcError { pub struct PumpxRpcErrorData { #[serde(skip_serializing_if = "Option::is_none")] pub backend_response: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub field: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub expected: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub received: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub suggestion: Option, } #[derive(Serialize, Debug)] @@ -50,6 +60,11 @@ impl PumpxRpcError { code: api_response.code as i32, message: api_response.message, }), + field: None, + expected: None, + received: None, + reason: None, + suggestion: None, }), } } @@ -66,7 +81,14 @@ impl From for PumpxRpcError { Self { code: error.code, message: error.message, - data: Some(PumpxRpcErrorData { backend_response: None }), + data: Some(PumpxRpcErrorData { + backend_response: None, + field: error.details.field, + expected: error.details.expected, + received: error.details.received, + reason: error.details.reason, + suggestion: error.details.suggestion, + }), } } } diff --git a/tee-worker/omni-executor/rpc-server/src/methods/omni/payback_loan_test.rs b/tee-worker/omni-executor/rpc-server/src/methods/omni/payback_loan_test.rs index 71069d02cf..3c7c0455ab 100644 --- a/tee-worker/omni-executor/rpc-server/src/methods/omni/payback_loan_test.rs +++ b/tee-worker/omni-executor/rpc-server/src/methods/omni/payback_loan_test.rs @@ -464,8 +464,6 @@ async fn handle_payback_loan_impl< initial_margin.min(withdrawable_usdc) }; - info!("Transferring {} USDC from perp to spot", transfer_amount); - // Get initial spot balance BEFORE submitting the transfer let initial_spot_usdc = hypercore_client .get_spot_balance(smart_wallet_address_str, "USDC") @@ -496,7 +494,10 @@ async fn handle_payback_loan_impl< ) .await?; - info!("Action 2: USD transfer submitted with tx_hash: {:?}", usd_transfer_tx_hash); + info!( + "Action 2: USD transfer submitted, size: {}, tx_hash: {:?}", + transfer_amount, usd_transfer_tx_hash + ); current_nonce += 1; hypercore_client diff --git a/tee-worker/omni-executor/rpc-server/src/methods/omni/request_loan_test.rs b/tee-worker/omni-executor/rpc-server/src/methods/omni/request_loan_test.rs index 5ff5b5fedd..73dc6ffb2e 100644 --- a/tee-worker/omni-executor/rpc-server/src/methods/omni/request_loan_test.rs +++ b/tee-worker/omni-executor/rpc-server/src/methods/omni/request_loan_test.rs @@ -381,7 +381,7 @@ async fn handle_request_loan_impl< encode_send_raw_action(usd_transfer_action), ); - let _usd_transfer_tx_hash = submit_corewriter_userop( + let usd_transfer_tx_hash = submit_corewriter_userop( ctx.clone(), &omni_account, &prepare_skeleton_with_nonce(&skeleton_user_op, current_nonce), @@ -392,7 +392,10 @@ async fn handle_request_loan_impl< ) .await?; - info!("Action 2: USD class transfer submitted"); + info!( + "Action 2: USD class transfer submitted, size: {}, tx_hash: {:?}", + usdc_for_perp, usd_transfer_tx_hash + ); // Wait for USD transfer to complete let _actual_perp_balance = hypercore_client @@ -439,8 +442,8 @@ async fn handle_request_loan_impl< let hedge_size = (usdc_for_perp * effective_leverage) / target_hedge_price; info!( - "Perp hedge open pricing - markPx: {}, midPx: {}, ask (lowest sell): {}, target (with {}x buffer): {}", - perp_mark_price, perp_mid_price, perp_ask_price, PERP_ENTRY_PRICE_RATIO, target_hedge_price + "Perp hedge open pricing - markPx: {}, midPx: {}, ask (lowest sell): {}, target (with {}x buffer): {}, hedge_size: {}", + perp_mark_price, perp_mid_price, perp_ask_price, PERP_ENTRY_PRICE_RATIO, target_hedge_price, hedge_size ); let clamped_hedge_size = clamp_size(hedge_size, validation_result.perp_sz_decimals);