From e261886c608272ef0b4a4b2d482b846a353e5fb8 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 5 Sep 2022 06:29:27 +0000 Subject: [PATCH] user_address change not made yet --- TODO.md | 1 + config/example.toml | 2 +- web3_proxy/src/app.rs | 7 ++----- web3_proxy/src/bin/web3_proxy.rs | 2 +- web3_proxy/src/config.rs | 2 +- web3_proxy/src/frontend/rpc_proxy_ws.rs | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/TODO.md b/TODO.md index cef04bc4..60af74bf 100644 --- a/TODO.md +++ b/TODO.md @@ -318,3 +318,4 @@ in another repo: event subscriber {"jsonrpc":"2.0","id":null,"error":{"code":-32099,"message":"deadline has elapsed"}} - [ ] figure out rate limits for private rpcs. eden v1 gives 500 error instead of a code for rate limits +- [ ] https://gitlab.com/moka-labs/tiered-cache-example diff --git a/config/example.toml b/config/example.toml index b0c14752..7de66214 100644 --- a/config/example.toml +++ b/config/example.toml @@ -9,7 +9,7 @@ redis_url = "redis://dev-redis:6379/" # TODO: how do we find the optimal redis_max_connections? too high actually ends up being slower redis_max_connections = 99 redirect_public_url = "https://llamanodes.com/free-rpc-stats" -redirect_user_url = "https://llamanodes.com/user-rpc-stats/{{user_address}}" +redirect_user_url = "https://llamanodes.com/user-rpc-stats/{{user_id}}" public_rate_limit_per_minute = 0 # 1GB of cache response_cache_max_bytes = 10000000000 diff --git a/web3_proxy/src/app.rs b/web3_proxy/src/app.rs index f5a1dc6d..d7287959 100644 --- a/web3_proxy/src/app.rs +++ b/web3_proxy/src/app.rs @@ -153,11 +153,8 @@ impl Web3ProxyApp { // safety checks on the config debug!("redirect_user_url: {}", top_config.app.redirect_user_url); assert!( - top_config - .app - .redirect_user_url - .contains("{{user_address}}"), - "redirect user url must contain \"{{user_address}}\"" + top_config.app.redirect_user_url.contains("{{user_id}}"), + "redirect user url must contain \"{{user_id}}\"" ); // first, we connect to mysql and make sure the latest migrations have run diff --git a/web3_proxy/src/bin/web3_proxy.rs b/web3_proxy/src/bin/web3_proxy.rs index d13f6fa8..8ec7ec6c 100644 --- a/web3_proxy/src/bin/web3_proxy.rs +++ b/web3_proxy/src/bin/web3_proxy.rs @@ -218,7 +218,7 @@ mod tests { public_rate_limit_per_minute: 6_000_000, response_cache_max_bytes: 10_usize.pow(7), redirect_public_url: "example.com/".to_string(), - redirect_user_url: "example.com/{{user_address}}".to_string(), + redirect_user_url: "example.com/{{user_id}}".to_string(), ..Default::default() }, balanced_rpcs: HashMap::from([ diff --git a/web3_proxy/src/config.rs b/web3_proxy/src/config.rs index 51526093..6b9ad45b 100644 --- a/web3_proxy/src/config.rs +++ b/web3_proxy/src/config.rs @@ -71,7 +71,7 @@ pub struct AppConfig { pub response_cache_max_bytes: usize, /// the stats page url for an anonymous user. pub redirect_public_url: String, - /// the stats page url for a logged in user. it must contain "{user_address}" + /// the stats page url for a logged in user. it must contain "{user_id}" pub redirect_user_url: String, } diff --git a/web3_proxy/src/frontend/rpc_proxy_ws.rs b/web3_proxy/src/frontend/rpc_proxy_ws.rs index d3dc6375..33419616 100644 --- a/web3_proxy/src/frontend/rpc_proxy_ws.rs +++ b/web3_proxy/src/frontend/rpc_proxy_ws.rs @@ -72,7 +72,7 @@ pub async fn user_websocket_handler( // TODO: store this on the app and use register_template? let reg = Handlebars::new(); - // TODO: show the user's address, not their id (remember to update the checks for {{user_address}}} in app.rs) + // TODO: show the user's address, not their id (remember to update the checks for {{user_id}}} in app.rs) // TODO: query to get the user's address. expose that instead of user_id let user_url = reg .render_template(