Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,6 @@ cython_debug/
# Claude
.claude
CLAUDE.md

# request files
*.http
44 changes: 40 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
11 changes: 0 additions & 11 deletions src/common/clients.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down
10 changes: 1 addition & 9 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/validators/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading