diff --git a/.gitignore b/.gitignore index c2c144f..f7e6626 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,5 @@ db-tools/ # Coverage report lcov.info + +logs/ diff --git a/README.md b/README.md index 16543ca..6fd1583 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,60 @@ The graphs illustrate a marked reduction in latency across several operational s In addition to the improvements made in internal processing efficiency, using the OptimisticV2 implementation has resulted in significantly lower network latencies from our builders. +## How to run +The relay can be run locally for development, or configured for staging and production environments. Depending on the setup, you may want to leverage Docker for building and running the service, along with a Postgres database, Redis instance. + +#### Local setup +```bash +# Build the image +$ docker build -t helix_mev_relayer -f local.Dockerfile . + +# Run the container +$ docker run --name helix_mev_relayer helix_mev_relayer +``` + +#### Staging or Production-Ready setup +AWS configuration is required as a cloud storage option for [sccache](https://github.com/mozilla/sccache.git) (a rust wrapper for caching builds for faster development). +For environments closer to production, you can use the provided [Dockerfile](./Dockerfile). In these environments, [sccache](https://github.com/mozilla/sccache.git) can be configured to store build artifacts in AWS S3 for faster incremental builds. You must supply your AWS credentials as build arguments: + +```bash +$ docker build \ + --build-arg AWS_ACCESS_KEY_ID= \ + --build-arg AWS_SECRET_ACCESS_KEY= \ + --build-arg REPO_NAME= \ + -t helix_mev_relayer . + +$ docker run --name helix_mev_relayer helix_mev_relayer +``` + +### Configuration + +[config.yml](./config.yml) contains options for the relay. + +### Databases +The relay relies on postgres database for persistent storage. Ensure you point the `config.postgres` settings to a database with `timescaledb` extension installed and enabled. + +For Redis set `config.redis.url` to a connection url to a running redis instance. + +### The simulator service +`config.simulators`: should be an RPC endpoint for the payload validator. This service is responsible for sending block requests to the relay for validation. + +### Beacon client +Beacon clients provide APIs for validators to register and propose blocks. You can point the relay to one or multiple beacon clients using `config.beacon_clients`. Examples: [Prysm](https://github.com/prysmaticlabs/prysm.git), [Lighthouse](https://github.com/sigp/lighthouse.git). + +It is the **Consensus Layer** (CL) of the blockchain and is dependent on an **Execution Layer** (EL). + +Each beacon client must have **HTTP API** enabled and requires a working EL client like [geth](https://github.com/ethereum/go-ethereum.git) or [reth](https://github.com/paradigmxyz/reth.git) (Rust ecosystem). Make sure both CL and EL are synchronized and accessible to the relay. + +### Logging +Logs are tailed in `config.logging`. when there is a panic call by `panic::set_hook` logging is done in **{config.dir_path}/crash.log**. + +You can also add a webhook to log `panic!` messages to discord using the `config.discord_webhook_url`. Note this uses `reqwest::blocking` under the hood. + +### Additional Notes +- Ensure that your environment is properly set up before starting the relay (e.g., databases running, AWS credentials ready if using sccache). +- For best performance in production, always verify that your beacon and execution clients are properly synced and that the relay has the appropriate network permissions. + ## Future Work ### In-Memory Auctioneer diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..492d80d --- /dev/null +++ b/config.yml @@ -0,0 +1,70 @@ +network_config: Sepolia +website: + enabled: false + port: 8080 + listen_address: 0.0.0.0 + show_config_details: false + network_name: "" + relay_url: "" + relay_pubkey: "" + link_beaconchain: "" + link_etherscan: "" + link_data_api: "" +postgres: + hostname: localhost + port: 5434 + db_name: helix_mev_relayer + user: postgres + password: postgres + region: 0 + region_name: "" +redis: + url: redis://localhost:6379 +broadcasters: + - !BeaconClient + url: http://localhost:8545 + gossip_blobs_enabled: false +simulators: + - url: http://localhost:8545 +beacon_clients: + - url: http://localhost:8545 + gossip_blobs_enabled: false +relays: [] +builders: [] +logging: !File + dir_path: logs + file_name: log +validator_preferences: + filtering: regional + trusted_builders: null + header_delay: true + gossip_blobs: false +router_config: + enabled_routes: + - route: GetValidators + rate_limit: null + - route: SubmitBlock + rate_limit: null + - route: SubmitBlockOptimistic + rate_limit: null + - route: ValidatorRegistration + rate_limit: null + - route: GetHeader + rate_limit: + limit_duration_ms: 12 + max_requests: 3 + - route: GetPayload + rate_limit: null + - route: ProposerPayloadDelivered + rate_limit: null + - route: RegisterValidators + rate_limit: null + - route: Status + rate_limit: null +target_get_payload_propagation_duration_ms: 0 +constraints_api_config: + check_constraints_signature: true + max_block_value_to_verify_wei: null +primev_config: null +skip_floor_bid_builder_pubkeys: [] +discord_webhook_url: null