From 242a5892da8524be5e78c0a6204abefc5998e794 Mon Sep 17 00:00:00 2001 From: adrian Date: Wed, 10 Sep 2025 16:30:31 +0200 Subject: [PATCH] chore: update readme --- protocol-testing/README.md | 88 ++++++--------------------------- protocol-testing/run.Dockerfile | 2 +- 2 files changed, 17 insertions(+), 73 deletions(-) diff --git a/protocol-testing/README.md b/protocol-testing/README.md index 0ceb453..eaaec15 100644 --- a/protocol-testing/README.md +++ b/protocol-testing/README.md @@ -2,79 +2,23 @@ Rust-based integration testing framework for Tycho protocol implementations. -## Prerequisites +## How to Run -1. **PostgreSQL Database**: Start the required PostgreSQL instance using Docker: - ```bash - docker-compose up -d - ``` - -2. **Environment Variables**: Source the environment variables: - ```bash - source .env - ``` - Or set them manually: - - `DATABASE_URL`: PostgreSQL connection string (default: `postgres://postgres:mypassword@localhost:5431/tycho_indexer_0`) - - `RPC_URL`: Ethereum RPC endpoint - - `SUBSTREAMS_API_TOKEN`: Authentication token for Substreams API - - `AUTH_API_KEY`: API key for authentication - -## Running Tests - -### Basic Usage ```bash -cargo run -- --package +# Export necessary env vars +export RPC_URL=.. +export SUBSTREAMS_API_TOKEN=.. +export AUTH_API_KEY=.. +export PROTOCOLS="ethereum-balancer-v2=weighted_legacy_creation ethereum-ekubo-v2" + +# Start and show the test logs only +docker compose up -d && docker compose logs test-runner --follow + +# Clean up +docker compose down ``` -### Command Line Options - -- `--package ` (required): Name of the package to test -- `--tycho-logs `: Enable tycho logs (default: true) -- `--db-url `: Postgres database URL (default: postgres://postgres:mypassword@localhost:5431/tycho_indexer_0) -- `--vm-traces `: Enable tracing during VM simulations (default: false) - -### Examples - -Run tests with default settings: -```bash -cargo run -- --package uniswap-v2 -``` - -Run tests with VM tracing enabled: -```bash -cargo run -- --package uniswap-v2 --vm-traces true -``` - -Run tests with custom database URL: -```bash -cargo run -- --package uniswap-v2 --db-url postgres://user:pass@localhost:5432/custom_db -``` - -Run tests in silent mode (disable tycho logs): -```bash -cargo run -- --package uniswap-v2 --tycho-logs false -``` - -## Logging Configuration - -The application uses `tracing` for structured logging. Control log levels using the `RUST_LOG` environment variable: - -### Log Levels -```bash -# Show test results and progress (recommended) -export RUST_LOG=info - -# Show all detailed logs including debug information -export RUST_LOG=debug - -# Show only errors (silent mode) -export RUST_LOG=error - -# Hide all logs (completely silent) -export RUST_LOG=warn -``` - -### Test Output Formatting +## Test Output Formatting The test runner outputs results similar to: @@ -102,7 +46,7 @@ Tests finished! RESULTS: 2/2 passed. ``` -### Module-specific Logging +## Module-specific Logging ```bash # Enable debug logs for specific modules export RUST_LOG=protocol_testing=debug,tycho_client=info @@ -111,7 +55,7 @@ export RUST_LOG=protocol_testing=debug,tycho_client=info export RUST_LOG=info,hyper=warn,reqwest=warn ``` -### Running with Different Log Levels +## Running with Different Log Levels ```bash # Standard test run with progress output RUST_LOG=info cargo run -- --package uniswap-v2 @@ -141,4 +85,4 @@ Tests are configured via YAML files located in the substreams package directory: - **Database Connection Issues**: Ensure PostgreSQL is running via `docker-compose up -d` - **RPC Errors**: Verify `RPC_URL` is set and accessible - **Missing Substreams**: Check that the package directory exists in `../substreams//` -- **Build Failures**: Ensure all dependencies are installed and environment variables are set \ No newline at end of file +- **Build Failures**: Ensure all dependencies are installed and environment variables are set diff --git a/protocol-testing/run.Dockerfile b/protocol-testing/run.Dockerfile index fe6a262..b2ce52e 100644 --- a/protocol-testing/run.Dockerfile +++ b/protocol-testing/run.Dockerfile @@ -14,7 +14,7 @@ FROM rust:1.89-bookworm AS protocol-sdk-builder WORKDIR /build RUN apt-get update && apt-get install -y git -RUN git clone --depth 1 --branch "testing-sdk/ab/ENG-4985-test-with-docker" https://github.com/propeller-heads/tycho-protocol-sdk.git +RUN git clone --depth 1 https://github.com/propeller-heads/tycho-protocol-sdk.git WORKDIR /build/tycho-protocol-sdk/protocol-testing RUN cargo build --release