diff --git a/.env.example b/.env.example index f77db68..092b299 100644 --- a/.env.example +++ b/.env.example @@ -11,8 +11,6 @@ NETWORK=hoodi EXECUTION_ENDPOINT=https://hoodi-geth CONSENSUS_ENDPOINT=https://hoodi-lighthouse -DATABASE=relayer.db - PUBLIC_KEYS_FILE=public_keys.csv VALIDATORS_MANAGER_KEY_FILE=validators-manager-key.json diff --git a/.gitignore b/.gitignore index 2f17a3f..9ad6a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -173,3 +173,6 @@ cython_debug/ # Claude .claude CLAUDE.md + +# request files +*.http diff --git a/README.md b/README.md index b5025c9..83b058c 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,48 @@ In production environment: 3. `cp .env.example .env` 4. Fill .env file with appropriate values -## Run +## Run from sources 1. `poetry shell` 2. `export PYTHONPATH=.` 3. `python src/app.py` +## Run with Docker + +```bash +export DVT_RELAYER_VERSION=v1.0.0 +``` + +Pull the image: + +```bash +docker pull europe-west4-docker.pkg.dev/stakewiselabs/public/dvt-relayer:$DVT_RELAYER_VERSION +``` + +You can also build the image from source: + +```bash +docker build --pull -t europe-west4-docker.pkg.dev/stakewiselabs/public/dvt-relayer:$DVT_RELAYER_VERSION . +``` + +Run the container, mounting a directory with your `.env` and key files: + +```bash +docker run --rm -ti \ + --env-file /path/to/.env \ + -v /path/to/data:/data \ + -p 8000:8000 \ + europe-west4-docker.pkg.dev/stakewiselabs/public/dvt-relayer:$DVT_RELAYER_VERSION +``` + +Set paths in `.env` to point inside the container, e.g.: + +```ini +VALIDATORS_MANAGER_KEY_FILE=/data/validators-manager-key.json +VALIDATORS_MANAGER_PASSWORD_FILE=/data/validators-manager-password.txt +PUBLIC_KEYS_FILE=/data/public_keys.csv +``` + ## Test Running the whole cluster of DVT sidecars locally may be cumbersome. @@ -43,6 +79,6 @@ See [DVT sidecar readme](https://github.com/stakewise/dvt-operator-sidecar/blob/ DVT sidecar: -1. Loads DV keystores -2. Polls validator exits from Relayer -3. Pushes exit signature shares to Relayer on behalf of DVT operators. +1. Loads distributed validator (DV) keystores. +2. Retrieves validator data from the Relayer. +3. Submits deposit signature shares and exit signature shares to the Relayer on behalf of DVT operators. diff --git a/src/common/clients.py b/src/common/clients.py index 5c36d79..08f894e 100644 --- a/src/common/clients.py +++ b/src/common/clients.py @@ -1,6 +1,3 @@ -import sqlite3 -from sqlite3 import Connection - from sw_utils import IpfsFetchClient, get_consensus_client, get_execution_client from src.config import settings @@ -16,14 +13,6 @@ retry_timeout=settings.consensus_retry_timeout, ) - -class Database: - def get_db_connection(self) -> Connection: - return sqlite3.connect(settings.database) - - -db_client = Database() - ipfs_fetch_client = IpfsFetchClient( ipfs_endpoints=settings.ipfs_fetch_endpoints, timeout=settings.ipfs_timeout, diff --git a/src/config/settings.py b/src/config/settings.py index f3a849f..10a6855 100644 --- a/src/config/settings.py +++ b/src/config/settings.py @@ -31,14 +31,6 @@ ) ipfs_timeout: int = config('IPFS_TIMEOUT', default=60, cast=int) ipfs_retry_timeout: int = config('IPFS_RETRY_TIMEOUT', default=120, cast=int) -genesis_validators_ipfs_timeout: int = config( - 'GENESIS_VALIDATORS_IPFS_TIMEOUT', default=300, cast=int -) -genesis_validators_ipfs_retry_timeout: int = config( - 'GENESIS_VALIDATORS_IPFS_RETRY_TIMEOUT', default=600, cast=int -) - -database: str = config('DATABASE') # logging LOG_PLAIN = 'plain' @@ -51,7 +43,7 @@ sentry_dsn: str = config('SENTRY_DSN', default='') sentry_environment = config('SENTRY_ENVIRONMENT', default='') -VALIDATOR_LIFETIME: int = config('VALIDATOR_LIFETIME', default=3600, cast=int) +validator_lifetime: int = config('VALIDATOR_LIFETIME', default=3600, cast=int) validators_manager_key_file: str = config('VALIDATORS_MANAGER_KEY_FILE') validators_manager_password_file: str = config('VALIDATORS_MANAGER_PASSWORD_FILE') diff --git a/src/validators/tasks.py b/src/validators/tasks.py index 1530daa..8b28d52 100644 --- a/src/validators/tasks.py +++ b/src/validators/tasks.py @@ -31,7 +31,7 @@ async def process_block(self) -> None: public_keys = [] now = int(time()) for public_key, validator in app_state.validators.items(): - if now - validator.created_at > settings.VALIDATOR_LIFETIME: + if now - validator.created_at > settings.validator_lifetime: public_keys.append(public_key) for public_key in public_keys: