Skip to content

Commit

Permalink
Merge pull request #209 from lidofinance/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
F4ever authored Jun 25, 2024
2 parents f816ff6 + e931cd9 commit 37a96e4
Show file tree
Hide file tree
Showing 93 changed files with 6,979 additions and 12,626 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ FLASHBOT_SIGNATURE=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f

# List of staking module's ids in which the depositor bot will make deposits
DEPOSIT_MODULES_WHITELIST=1

# Prefix for the Prometheus metrics(depositor_bot,pauser_bot,unvetter_bot)
PROMETHEUS_PREFIX=depositor_bot
4 changes: 3 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests and Checks
name: Security checks

on: push

Expand All @@ -8,7 +8,9 @@ jobs:
permissions:
security-events: write
contents: read

docker:
uses: lidofinance/linters/.github/workflows/docker.yml@master

actions:
uses: lidofinance/linters/.github/workflows/actions.yml@master
26 changes: 0 additions & 26 deletions .github/workflows/ci-dev-goerli.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ on:
permissions: {}

jobs:
# test:
# ...

deploy:
runs-on: ubuntu-latest
# needs: test
name: Build and deploy
steps:
- name: Testnet deploy
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/ci-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ on:
permissions: {}

jobs:
# test:
# ...

deploy:
runs-on: ubuntu-latest
# needs: test
name: Build and deploy
steps:
- name: Staging deploy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Tests and checks
name: Integration tests

on:
on:
push:

jobs:
Expand All @@ -9,45 +9,31 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'

- name: Setup poetry
run: |
curl -sSL https://install.python-poetry.org/ | python - && echo "$HOME/.poetry/bin" >> $GITHUB_PATH
env:
POETRY_VERSION: 1.4.2
POETRY_VERSION: 1.8.2

- name: Install dependencies
run: |
poetry install
- name: Unit Tests with pytest
run: |
poetry run pytest tests -m unit
- name: Set up node
uses: actions/[email protected]
with:
node-version: '18.17.1'
cache: 'yarn'

- name: Install dependencies
run: yarn install --immutable

- name: Run chronix
run: |
yarn chronix start &
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Integration tests with pytest
run: |
poetry run pytest tests -m integration
env:

WEB3_RPC_ENDPOINTS: ${{ secrets.WEB3_RPC_ENDPOINT }}
DEPOSIT_CONTRACT: "0x00000000219ab540356cBB839Cbe05303d7705Fa"
LIDO_LOCATOR: "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb"
ANVIL_PATH: ""
46 changes: 46 additions & 0 deletions .github/workflows/tests-and-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests and checks

on:
push:

jobs:
tests:
name: App tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Setup poetry
run: |
curl -sSL https://install.python-poetry.org/ | python - && echo "$HOME/.poetry/bin" >> $GITHUB_PATH
env:
POETRY_VERSION: 1.8.2

- name: Install dependencies
run: |
poetry install
- name: Lint with Ruff
run: |
poetry run ruff check --output-format=github .
continue-on-error: true

- name: Format with Ruff
run: |
poetry run ruff check --output-format=github .
continue-on-error: true

- name: Typecheck with Pyright
run: |
poetry run pyright
continue-on-error: true

- name: Unit tests with pytest
run: |
poetry run pytest tests -m unit
110 changes: 0 additions & 110 deletions CHANGELOG.md

This file was deleted.

48 changes: 23 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM python:3.10.6-slim as base
FROM python:3.11.9-slim as base

RUN apt-get update && apt-get install -y --no-install-recommends -qq \
gcc=4:10.2.1-1 \
libffi-dev=3.3-6 \
g++=4:10.2.1-1 \
curl=7.74.0-1.3+deb11u10 \
gcc=4:12.2.0-3 \
libffi-dev=3.4.4-1 \
g++=4:12.2.0-3 \
curl=7.88.1-10+deb12u5 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -13,41 +13,39 @@ ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
VENV_PATH="/.venv"

WORKDIR /app
ENV PATH="$VENV_PATH/bin:$PATH"

FROM base as builder

ENV POETRY_VERSION=1.4.2 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
POETRY_HOME=/opt/poetry \
PATH="/opt/poetry/bin:$PATH"

# Set the SHELL option -o pipefail before RUN with a pipe in
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# install poetry - respects $POETRY_VERSION & $POETRY_HOME
RUN curl -sSL https://install.python-poetry.org | python -
ENV POETRY_VERSION=1.8.2
RUN pip install --no-cache-dir poetry==$POETRY_VERSION

WORKDIR /
COPY pyproject.toml poetry.lock ./
RUN poetry install
RUN poetry install --only main --no-root


FROM base as production

COPY --from=builder /app /app
COPY . /app
COPY --from=builder $VENV_PATH $VENV_PATH
WORKDIR /app
COPY . .

RUN apt-get clean && find /var/lib/apt/lists/ -type f -delete && chown -R www-data /app/

ENV PATH="/app/.venv/bin:$PATH"
ENV PULSE_SERVER_PORT 9010
ENV PROMETHEUS_PORT 9000
ENV HEALTHCHECK_SERVER_PORT 9010

EXPOSE $PROMETHEUS_PORT
USER www-data

HEALTHCHECK --interval=10s --timeout=3s \
CMD curl -f http://localhost:$PULSE_SERVER_PORT/healthcheck || exit 1
CMD curl -f http://localhost:$HEALTHCHECK_SERVER_PORT/healthcheck || exit 1

WORKDIR /app/

ENTRYPOINT ["python3"]
CMD ["src/depositor.py"]
ENTRYPOINT ["python3", "src/main.py"]
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
Loading

0 comments on commit 37a96e4

Please sign in to comment.