Skip to content
Merged

V4 #10

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
13 changes: 7 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ jobs:
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.10.14
python-version: 3.12.8

# Install poetry
- name: Load cached Poetry installation
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0
key: poetry-3.12

- name: Install Poetry
uses: snok/install-poetry@v1
Expand Down Expand Up @@ -55,16 +55,17 @@ jobs:
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.10.14
python-version: 3.12.8

# Install poetry
- name: Load cached Poetry installation
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0
key: poetry-3.12

- name: Install Poetry
uses: snok/install-poetry@v1
with:
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,11 @@ repos:
files: no-files
args: ["lock", "--check"]
always_run: true

- repo: https://github.com/jendrikseipp/vulture
rev: 'v2.13'
hooks:
- id: vulture
args: ["src/"]
files: no-files
always_run: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# `python-base` sets up all our shared environment variables
FROM python:3.10.14-slim-bookworm as python-base
FROM python:3.12.8-slim-bookworm as python-base

# python
ENV PYTHONUNBUFFERED=1 \
Expand Down
3,260 changes: 1,598 additions & 1,662 deletions poetry.lock

Large diffs are not rendered by default.

29 changes: 20 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[tool.poetry]
name = "relayer-example"
version = "0.1.0"
version = "0.2.0"
description = "Relayer example for Stakewise Operator service"
authors = ["StakeWise Labs <info@stakewise.io>"]
package-mode = false

[tool.poetry.dependencies]
python = ">=3.10,<3.11"
python = ">=3.12,<3.13"
python-decouple = "==3.8"
py-ecc = "==6.0.0"
sw-utils = {git = "https://github.com/stakewise/sw-utils.git", rev = "v0.9.7"}
click = "==8.1.7"
py-ecc = "==8.0.0"
sw-utils = {git = "https://github.com/stakewise/sw-utils.git", rev = "v0.10.0"}
click = "==8.2.1"
tomli = "~2"
prometheus-client = "==0.17.1"
pyyaml = "==6.0.1"
python-json-logger = "==2.0.7"
fastapi = { version = "==0.115.12", extras = ["standard"] }
staking-deposit = { git = "https://github.com/ethereum/staking-deposit-cli.git", rev = "v2.4.0" }
fastapi = { version = "==0.116.1", extras = ["standard"] }
staking-deposit = { git = "https://github.com/ethereum/staking-deposit-cli.git", rev = "v2.8.0" }

[tool.poetry.group.dev.dependencies]
pylint = "==3.0.1"
mypy = "==1.6.1"
isort = "==5.12.0"
pre-commit = "==3.5.0"
Flake8-pyproject = "==1.2.3"
bandit = { version = "==1.7.5", extras = ["toml"] }
bandit = { version = "==1.8.6", extras = ["toml"] }
black = { version = "==23.10.0", extras = ["d"] }
flake8-print = "==5.0.0"
flake8-datetimez = "==20.10.0"
Expand All @@ -49,7 +49,9 @@ disable = [
"R0801", # duplicate-code
"R0903", # too-few-public-methods
"W0703", # broad-except
"W0718" # broad-exception-caught
"W0718", # broad-exception-caught
"W0511", # todo (fixme)

]
ignore-paths=["src/.*/tests/.*", "src/test_fixtures/.*"]
ignore=["conftest.py"]
Expand Down Expand Up @@ -99,3 +101,12 @@ exclude = '''
| dist
)/
'''

[tool.vulture]
ignore_names = [
"app_instance",
"register_validators", "fund_validators", # used in API routes
"withdraw_validators", "consolidate_validators", # used in API routes
"get_info" # used in API routes
]
ignore_decorators = ["@router"]
5 changes: 4 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware

from src.common.app_state import AppState
from src.common.endpoints import router as info_router
from src.common.setup_logging import setup_logging
from src.config import settings
from src.validators.endpoints import router
from src.validators.typings import AppState
from src.validators.validators_manager import load_validators_manager_account

setup_logging()
Expand All @@ -20,6 +21,7 @@
async def lifespan(app_instance: FastAPI) -> AsyncIterator: # pylint:disable=unused-argument
app_state = AppState()

# load validators manager account
validators_manager = load_validators_manager_account()
app_state.validators_manager_account = validators_manager
logger.info('validators manager address: %s', validators_manager.address)
Expand All @@ -39,6 +41,7 @@ async def lifespan(app_instance: FastAPI) -> AsyncIterator: # pylint:disable=un
)

app.include_router(router)
app.include_router(info_router)


if __name__ == '__main__':
Expand Down
Loading
Loading