Skip to content

Commit d2268ba

Browse files
hweawerF4everinfloop
authored
Release (#293)
* Examples of alerts * Remove special forks annotations (#271) * Remove special forks annotations * take addresses from envs * Add env * Variables in README * Move to other section * Holesky only * fix check balance test * Actualize readme * remove deprecated entrypoints * Add account label to balance * fix xfail unit tests * Update minor deps + remove package-mode * add balance check * remove tests * Remove mellow * Remove test * Fix test * Refactor strategy * Update alerts * Empty whitelist (#282) * Empty whitelist * Change default * Refactor --------- Co-authored-by: Kirill <[email protected]> Co-authored-by: Raman Siamionau <[email protected]> * Track recommended fee despite checks (#281) * Fetch prefix one time for a batch (#279) * Fetch prefix one time * default arg * function arg * Filters on request * Fix tests * refactor * Fix unvetter tests * Fix bug * fix signatures in test * Fix * Fix * Fix * Fix * Fix comments * Gas strategy with addendum (#285) * Gas strategy with addendum * Precommit hooks * Env variable * Update README * Gwei default * Module iteration until first healthy module (#286) * Cache quorum * Gather quorum in advance * Update tests * Fix types * fix var * fix * Fix comments * Fix sorting * Remove unit tests * Move minutes to a variable * Add more logs * Unit tests for iteration order * Comment * Fix comments * Update curl (#287) * Update curl * Pin version * Update aiohttp (#289) * Max operators per unvetting check (#290) * Max operators per unvetting check * Upgrade test * Cache chain-id (#288) * Cache chain-id * middleware to cache id * Cache gnosis * Add metrics to gnosis * Remove i * Fix recursion (#292) * Fix recursion * Remove metrics from onchain web3 * Reorder middlewares (#294) --------- Co-authored-by: F4ever <[email protected]> Co-authored-by: Kirill <[email protected]>
1 parent 74b6432 commit d2268ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1809
-1979
lines changed

.env.example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,3 @@ DEPOSIT_MODULES_WHITELIST=1
3838

3939
# Prefix for the Prometheus metrics(depositor_bot,pauser_bot,unvetter_bot)
4040
PROMETHEUS_PREFIX=depositor_bot
41-
42-
# Mellow strategy address for direct deposits
43-
# Holesky: 0x182Cb3A76B0EFaCb25255F9594B5807460882fa4
44-
MELLOW_CONTRACT_ADDRESS=0x182Cb3A76B0EFaCb25255F9594B5807460882fa4

.github/workflows/integration-tests.yml

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,15 @@ jobs:
2929
- name: Install Foundry
3030
uses: foundry-rs/foundry-toolchain@v1
3131

32-
- name: Integration tests with pytest, holesky fork
33-
run: |
34-
poetry run pytest tests -m integration_holesky
35-
env:
36-
WEB3_RPC_ENDPOINTS: ${{ secrets.HOLESKY_WEB3_RPC_ENDPOINT }}
37-
DEPOSIT_CONTRACT: "0x4242424242424242424242424242424242424242"
38-
LIDO_LOCATOR: "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"
39-
MELLOW_CONTRACT_ADDRESS: "0x182Cb3A76B0EFaCb25255F9594B5807460882fa4"
40-
ANVIL_PATH: ""
41-
42-
- name: Integration tests with pytest, chiado testnet
43-
run: |
44-
poetry run pytest tests -m integration_chiado
45-
env:
46-
WEB3_RPC_ENDPOINTS: "https://gnosis-chiado-rpc.publicnode.com"
47-
ONCHAIN_TRANSPORT_RPC_ENDPOINTS: "https://gnosis-chiado-rpc.publicnode.com"
48-
ONCHAIN_TRANSPORT_ADDRESS: "0x42E1DEfC18388E3AA1fCADa851499A11405cf37f"
49-
DEPOSIT_CONTRACT: "0x4242424242424242424242424242424242424242"
50-
LIDO_LOCATOR: "0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8"
51-
MELLOW_CONTRACT_ADDRESS: "0x182Cb3A76B0EFaCb25255F9594B5807460882fa4"
52-
ANVIL_PATH: ""
53-
54-
- name: Integration tests with pytest, mainnet fork
32+
- name: Integration tests with pytest
5533
if: success() || failure()
5634
run: |
5735
poetry run pytest tests -m integration
5836
env:
5937
WEB3_RPC_ENDPOINTS: ${{ secrets.WEB3_RPC_ENDPOINT }}
38+
TESTNET_WEB3_RPC_ENDPOINTS: 'https://ethereum-holesky-rpc.publicnode.com'
6039
DEPOSIT_CONTRACT: "0x00000000219ab540356cBB839Cbe05303d7705Fa"
6140
LIDO_LOCATOR: "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb"
41+
ONCHAIN_TRANSPORT_RPC_ENDPOINTS: "https://gnosis-chiado-rpc.publicnode.com"
42+
ONCHAIN_TRANSPORT_ADDRESS: "0x42E1DEfC18388E3AA1fCADa851499A11405cf37f"
6243
ANVIL_PATH: ""

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0 # Use the latest stable version
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
9+
- repo: local
10+
hooks:
11+
- id: poetry-pytest-unit
12+
name: Run pytest unit tests with Poetry
13+
entry: poetry run pytest -m unit
14+
language: system
15+
pass_filenames: false
16+
always_run: true
17+
stages: [commit]
18+
219
- repo: https://github.com/astral-sh/ruff-pre-commit
320
# Ruff version.
421
rev: v0.4.4

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends -qq \
44
gcc=4:12.2.0-3 \
55
libffi-dev=3.4.4-1 \
66
g++=4:12.2.0-3 \
7-
curl=7.88.1-10+deb12u7 \
7+
curl=7.88.1-10+deb12u8 \
88
&& apt-get clean \
99
&& rm -rf /var/lib/apt/lists/*
1010

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ Unvetting is the proces of decreasing approved depositable signing keys.
3434

3535
## Running Daemon
3636

37-
1. Create `.env` file
37+
1. Create `.env` file
3838
2. Setup variables
39-
- Set WEB3_RPC_ENDPOINTS
40-
- Set WALLET_PRIVATE_KEY
41-
- Set CREATE_TRANSACTIONS to true
42-
- Set MESSAGE_TRANSPORTS to rabbit
43-
- Set RABBIT_MQ_URL, RABBIT_MQ_USERNAME and RABBIT_MQ_PASSWORD
39+
- Set WEB3_RPC_ENDPOINTS
40+
- Set WALLET_PRIVATE_KEY
41+
- Set CREATE_TRANSACTIONS to true
42+
- Set MESSAGE_TRANSPORTS to rabbit
43+
- Set RABBIT_MQ_URL, RABBIT_MQ_USERNAME and RABBIT_MQ_PASSWORD
4444
3. ```docker-compose up```
4545
4. Send metrics and logs to grafana
4646
5. Setup alerts
@@ -76,13 +76,14 @@ Unvetting is the proces of decreasing approved depositable signing keys.
7676
| GAS_FEE_PERCENTILE_1 | 20 | Percentile for first recommended fee calculation |
7777
| GAS_FEE_PERCENTILE_DAYS_HISTORY_1 | 1 | Percentile for first recommended calculates from N days of the fee history |
7878
| GAS_PRIORITY_FEE_PERCENTILE | 25 | Priority transaction will be N percentile from priority fees in last block (min MIN_PRIORITY_FEE - max MAX_PRIORITY_FEE) |
79+
| GAS_ADDENDUM | 6 gwei | Addendum to the GAS_PRIORITY_FEE_PERCENTILE percentile value |
7980
| MAX_BUFFERED_ETHERS | 5000 ether | Maximum amount of ETH in the buffer, after which the bot deposits at any gas |
8081
| PROMETHEUS_PORT | 9000 | Port with metrics server |
8182
| PROMETHEUS_PREFIX | depositor_bot | Prefix for the metrics |
8283
| HEALTHCHECK_SERVER_PORT | 9010 | Port with bot`s status server |
8384
| MAX_CYCLE_LIFETIME_IN_SECONDS | 1200 | Max lifetime of usual cycle. If cycle will not end in this time, bot will crush |
84-
| MELLOW_CONTRACT_ADDRESS | None | If variable is set then deposit can go to predifined module |
85-
| VAULT_DIRECT_DEPOSIT_THRESHOLD | 1 ether | If mellow vault has VAULT_DIRECT_DEPOSIT_THRESHOLD ethers then direct deposit will be sent |
85+
| ONCHAIN_TRANSPORT_RPC_ENDPOINTS | - | RPC endpoint for the databus RPC, Gnosis at the moment |
86+
| QUORUM_RETENTION_MINUTES | 5 | TTL of quorum collection for marking module as healthy |
8687

8788
## Metrics and logs
8889

@@ -96,17 +97,18 @@ Prometheus server hosted on `http://localhost:${{PROMETHEUS_PORT}}/`.
9697
```bash
9798
git clone [email protected]:lidofinance/depositor-bot.git
9899
cd depositor-bot
99-
poetry install
100+
poetry install --with dev
101+
poetry run pre-commit install
100102
```
101103

102104
To run bot
103105

104106
```bash
105-
poetry run python main depositor
107+
poetry run python src/main.py depositor
106108

107-
poetry run python main pauser
109+
poetry run python src/main.py pauser
108110

109-
poetry run python main unvetter
111+
poetry run python src/main.py unvetter
110112
```
111113

112114
### Tests
@@ -119,6 +121,8 @@ poetry run pytest tests -m unit
119121

120122
#### Run integration tests.
121123

124+
TESTNET_WEB3_RPC_ENDPOINTS - set this variable for the Ethereum EL testnet RPC, Holesky only.
125+
122126
Install Anvil
123127

124128
```bash

alerts/alerts.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
groups:
2+
- name: Depositor bot. No metrics
3+
rules:
4+
- alert: DepositorBotNoMetrics
5+
annotations:
6+
info: "Depositor has not reported metrics for 5m."
7+
expr: absent_over_time(depositor_bot_build_info{service="lido-depositor-bot"}[5m])
8+
labels:
9+
severity: critical
10+
11+
- name: Pauser bot. No metrics
12+
rules:
13+
- alert: PauserBotNoMetrics
14+
annotations:
15+
info: "Pauser has not reported metrics for 5m."
16+
expr: absent_over_time(pauser_bot_build_info{service="lido-pause-bot"}[5m])
17+
labels:
18+
severity: critical
19+
20+
- name: Unvetter bot. No metrics
21+
rules:
22+
- alert: UnvetterBotNoMetrics
23+
annotations:
24+
info: "Unvetter has not reported metrics for 5m."
25+
expr: absent_over_time(unvetter_bot_build_info{service="lido-unvetter-bot"}[5m])
26+
labels:
27+
severity: critical
28+
29+
- name: No transport heartbeat
30+
rules:
31+
- alert: NoTransportConnection
32+
annotations:
33+
info: "None of the counters (deposit, pause, unvet, ping) have increased in the last 6 hours for bot {{ $labels.service }}"
34+
expr: sum by (service) (changes(label_replace({__name__=~"depositor_bot_ping_messages|depositor_bot_deposit_messages|pauser_bot_ping_messages|pauser_bot_pause_messages|unvetter_bot_ping_messages|unvetter_bot_unvet_messages"},"name_label","$1","__name__", "(.+)")[6h:])) == 0
35+
labels:
36+
severity: critical
37+
- name: Depositor bot. Account balance
38+
rules:
39+
- alert: DepositorBotAccountBalanceLow
40+
annotations:
41+
info: "Account balance is {{ $value }} ETH. Less than 3 ETH."
42+
expr:
43+
depositor_bot_account_balance{service="lido-depositor-bot"}/10^18 < 3
44+
UNLESS ON(service)
45+
depositor_bot_build_info{service="lido-depositor-bot",CREATE_TRANSACTIONS="False"}
46+
labels:
47+
severity: warning
48+
49+
- alert: DepositorBotAccountBalanceCriticalLow
50+
annotations:
51+
info: "Account balance is {{ $value }} ETH."
52+
expr:
53+
depositor_bot_account_balance{service="lido-depositor-bot"}/10^18 < 1
54+
UNLESS ON(service)
55+
depositor_bot_build_info{service="lido-depositor-bot",CREATE_TRANSACTIONS="False"}
56+
labels:
57+
severity: major

0 commit comments

Comments
 (0)