diff --git a/.dockerignore b/.dockerignore index 32dce25c..d30736a2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,6 @@ /Dockerfile /redis-cell-server/ /target -/web3-proxy/flamegraph.svg -/web3-proxy/perf.data -/web3-proxy/perf.data.old +/web3_proxy/flamegraph.svg +/web3_proxy/perf.data +/web3_proxy/perf.data.old diff --git a/Cargo.lock b/Cargo.lock index f1356aef..04d6d8d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5194,7 +5194,7 @@ dependencies = [ ] [[package]] -name = "web3-proxy" +name = "web3_proxy" version = "0.1.0" dependencies = [ "anyhow", diff --git a/Dockerfile b/Dockerfile index 2cdb41ca..579e06ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM rust:1-bullseye as builder -WORKDIR /usr/src/web3-proxy +WORKDIR /usr/src/web3_proxy COPY . . RUN --mount=type=cache,target=/usr/local/cargo/registry \ - --mount=type=cache,target=/usr/src/web3-proxy/target \ + --mount=type=cache,target=/usr/src/web3_proxy/target \ cargo install --locked --path ./web3_proxy FROM debian:bullseye-slim diff --git a/README.md b/README.md index 9ea908ee..91b39505 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# web3-proxy +# web3_proxy -Web3-proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. +Web3_proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. **Under construction!** This code is under active development. The basics seem to work, but theres lots of tests and features to write still. @@ -15,12 +15,12 @@ $ cargo install sea-orm-cli $ cargo run --release -- --help ``` ``` - Compiling web3-proxy v0.1.0 (/home/bryan/src/web3-proxy/web3-proxy) + Compiling web3_proxy v0.1.0 (/home/bryan/src/web3_proxy/web3_proxy) Finished release [optimized + debuginfo] target(s) in 17.69s - Running `target/release/web3-proxy --help` -Usage: web3-proxy [--port ] [--workers ] [--config ] + Running `target/release/web3_proxy --help` +Usage: web3_proxy [--port ] [--workers ] [--config ] -Web3-proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. +web3_proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. Options: --port what port the proxy should listen on @@ -84,7 +84,7 @@ Flame graphs make finding slow code painless: Run the proxy under gdb for advanced debugging: - cargo build --release && RUST_LOG=web3_proxy=debug rust-gdb --args target/debug/web3-proxy --listen-port 7503 --rpc-config-path ./config/production-eth.toml + cargo build --release && RUST_LOG=web3_proxy=debug rust-gdb --args target/debug/web3_proxy --listen-port 7503 --rpc-config-path ./config/production-eth.toml TODO: also enable debug symbols in the release build by modifying the root Cargo.toml diff --git a/TODO.md b/TODO.md index ed3108d4..7462f5bd 100644 --- a/TODO.md +++ b/TODO.md @@ -206,6 +206,6 @@ in another repo: event subscriber - [ ] better error handling. we warn too often for validation errors and use the same error code for most every request - [ ] use &str more instead of String. lifetime annotations get really annoying though - [ ] tarpit instead of reject requests (unless theres a lot) -- [ ] tune database connection pool size. i think a single web3-proxy currently maxes out our server +- [ ] tune database connection pool size. i think a single web3_proxy currently maxes out our server - [ ] subscribing to transactions should be configurable per server. listening to paid servers can get expensive - [ ] archive servers should be lowest priority diff --git a/redis-cell-server/Dockerfile b/redis-cell-server/Dockerfile index 077806a0..5eab503b 100644 --- a/redis-cell-server/Dockerfile +++ b/redis-cell-server/Dockerfile @@ -4,7 +4,7 @@ FROM rust:1-bullseye as builder WORKDIR /usr/src/redis-cell RUN \ --mount=type=cache,target=/usr/local/cargo/registry \ - --mount=type=cache,target=/usr/src/web3-proxy/target \ + --mount=type=cache,target=/usr/src/web3_proxy/target \ { \ set -eux; \ git clone -b v0.3.0 https://github.com/brandur/redis-cell .; \ diff --git a/web3_proxy/Cargo.toml b/web3_proxy/Cargo.toml index f198e477..4e182a2e 100644 --- a/web3_proxy/Cargo.toml +++ b/web3_proxy/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "web3-proxy" +name = "web3_proxy" version = "0.1.0" edition = "2021" default-run = "web3_proxy" diff --git a/web3_proxy/src/app.rs b/web3_proxy/src/app.rs index 5d80cf94..ed18f7d0 100644 --- a/web3_proxy/src/app.rs +++ b/web3_proxy/src/app.rs @@ -438,7 +438,7 @@ impl Web3ProxyApp { let frontend_rate_limiter = redis_client_pool.as_ref().map(|redis_client_pool| { RedisCellClient::new( redis_client_pool.clone(), - "web3-proxy", + "web3_proxy", "frontend", public_max_burst, app_config.shared.public_rate_limit_per_minute, diff --git a/web3_proxy/src/bin/web3_proxy_cli/main.rs b/web3_proxy/src/bin/web3_proxy_cli/main.rs index 4437815e..ac269e4d 100644 --- a/web3_proxy/src/bin/web3_proxy_cli/main.rs +++ b/web3_proxy/src/bin/web3_proxy_cli/main.rs @@ -6,7 +6,7 @@ use tracing::info; use web3_proxy::app::get_migrated_db; #[derive(Debug, FromArgs)] -/// Command line interface for admins to interact with web3-proxy +/// Command line interface for admins to interact with web3_proxy pub struct TopConfig { /// what database the client should connect to #[argh( diff --git a/web3_proxy/src/config.rs b/web3_proxy/src/config.rs index dc24e050..3411f0d9 100644 --- a/web3_proxy/src/config.rs +++ b/web3_proxy/src/config.rs @@ -12,7 +12,7 @@ use crate::connection::Web3Connection; pub type BlockAndRpc = (Arc>, Arc); #[derive(Debug, FromArgs)] -/// Web3-proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. +/// Web3_proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. pub struct CliConfig { /// what port the proxy should listen on #[argh(option, default = "8544")] diff --git a/web3_proxy/src/connection.rs b/web3_proxy/src/connection.rs index fadb191a..b23204d2 100644 --- a/web3_proxy/src/connection.rs +++ b/web3_proxy/src/connection.rs @@ -151,7 +151,7 @@ impl Web3Connection { let period = 1; RedisCellClient::new( redis_conection, - "web3-proxy", + "web3_proxy", &format!("{}:{}", chain_id, url_str), hard_rate_limit, hard_rate_limit,