Skip to content

Commit

Permalink
fix: debug wallet service with new logs
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Oct 18, 2024
1 parent 6fbab8a commit 3bfe566
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 61 deletions.
43 changes: 36 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build = "build.rs"
[dependencies]
wc = { git = "https://github.com/WalletConnect/utils-rs.git", tag = "v0.9.0", features = ["alloc", "analytics", "future", "http", "metrics", "geoip", "geoblock", "rate_limit"] }
relay_rpc = { git = "https://github.com/WalletConnect/WalletConnectRust.git", tag = "v0.32.0", features = ["cacao"] }
yttrium = { git = "https://github.com/reown-com/yttrium.git" }
yttrium = { git = "https://github.com/reown-com/yttrium.git", branch = "fix/logging" }

# Async
async-trait = "0.1.82"
Expand Down Expand Up @@ -66,7 +66,7 @@ ipnet = "2.5"
pnet_datalink = "0.31"

tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["json", "ansi"] }
tracing-subscriber = { version = "0.3", features = ["json", "ansi", "env-filter"] }

cerberus = { git = "https://github.com/WalletConnect/cerberus.git", tag = "v0.13.1" }
parquet = { git = "https://github.com/WalletConnect/arrow-rs.git", rev = "99a1cc3", default-features = false, features = ["flate2"] }
Expand Down
25 changes: 1 addition & 24 deletions src/handlers/wallet/prepare_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ use alloy::providers::{Provider, ReqwestProvider};
use alloy::sol_types::SolCall;
use alloy::sol_types::SolValue;
use alloy::transports::Transport;
use axum::{
extract::State,
response::{IntoResponse, Response},
Json,
};
use hyper::StatusCode;
use axum::extract::State;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use thiserror::Error;
Expand Down Expand Up @@ -150,24 +145,6 @@ pub enum PrepareCallsInternalError {
GetSessionContextError(InternalGetSessionContextError),
}

impl IntoResponse for PrepareCallsError {
fn into_response(self) -> Response {
match self {
Self::InternalError(e) => {
error!("HTTP server error: (prepare_calls) {e:?}");
StatusCode::INTERNAL_SERVER_ERROR.into_response()
}
e => (
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": e.to_string(),
})),
)
.into_response(),
}
}
}

pub async fn handler(
state: State<Arc<AppState>>,
project_id: String,
Expand Down
25 changes: 1 addition & 24 deletions src/handlers/wallet/send_prepared_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ use alloy::network::Ethereum;
use alloy::primitives::{Bytes, U64};
use alloy::providers::ReqwestProvider;
use axum::extract::{Path, Query};
use axum::{
extract::State,
response::{IntoResponse, Response},
Json,
};
use axum::{extract::State, response::IntoResponse, Json};
use hyper::body::to_bytes;
use hyper::StatusCode;
use parquet::data_type::AsBytes;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
Expand Down Expand Up @@ -142,24 +137,6 @@ pub enum SendPreparedCallsInternalError {
SendUserOperation(eyre::Error),
}

impl IntoResponse for SendPreparedCallsError {
fn into_response(self) -> Response {
match self {
Self::InternalError(e) => {
error!("HTTP server error: (prepare_calls) {e:?}");
StatusCode::INTERNAL_SERVER_ERROR.into_response()
}
e => (
StatusCode::BAD_REQUEST,
Json(serde_json::json!({
"error": e.to_string(),
})),
)
.into_response(),
}
}
}

pub async fn handler(
state: State<Arc<AppState>>,
project_id: String,
Expand Down
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use {
dotenv::dotenv,
rpc_proxy::{env::Config, error},
std::str::FromStr,
tracing_subscriber::fmt::format::FmtSpan,
tracing::level_filters::LevelFilter,
tracing_subscriber::{fmt::format::FmtSpan, EnvFilter},
};

#[global_allocator]
Expand All @@ -17,8 +17,11 @@ async fn main() -> error::RpcResult<()> {
.expect("Failed to load config, please ensure all env variables are defined.");

tracing_subscriber::fmt()
.with_max_level(
tracing::Level::from_str(config.server.log_level.as_str()).expect("Invalid log level"),
.with_env_filter(
EnvFilter::builder()
.with_default_directive(LevelFilter::ERROR.into())
.parse(&config.server.log_level)
.expect("Invalid log level"),
)
.with_span_events(FmtSpan::CLOSE)
.with_ansi(false)
Expand Down
1 change: 1 addition & 0 deletions terraform/ecs/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ resource "aws_ecs_task_definition" "app_task" {
essential = true,

environment = [
{ name = "RPC_PROXY_LOG_LEVEL", value = var.log_level },
{ name = "RPC_PROXY_PORT", value = tostring(var.port) },
{ name = "RPC_PROXY_PROMETHEUS_PORT", value = tostring(local.otel_port) },

Expand Down

0 comments on commit 3bfe566

Please sign in to comment.