Skip to content

Commit 4bd85b0

Browse files
authored
Merge pull request #529 from lidofinance/feat/v3-vote
feat: V3 voting
2 parents 3945f64 + df3476b commit 4bd85b0

Some content is hidden

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

58 files changed

+15321
-2232
lines changed

.github/workflows/core_tests.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- "feat/rc2"
1010
- "feat/rc1"
1111
- "feat/next-vote"
12+
- "feat/v3-vote"
1213
schedule:
1314
- cron: "0 0 * * TUE"
1415

@@ -19,11 +20,10 @@ jobs:
1920
timeout-minutes: 120
2021

2122
services:
22-
2323
tests-runner:
24-
image: ghcr.io/lidofinance/scripts:v19
24+
image: ghcr.io/lidofinance/scripts:v21
2525
ports:
26-
- 8546:8546
26+
- 8545:8545
2727
volumes:
2828
- ${{ github.workspace }}:/root/scripts
2929
options: >-
@@ -36,23 +36,36 @@ jobs:
3636
- name: Run init script
3737
run: docker exec -e CORE_BRANCH tests-runner bash -c 'make init'
3838
env:
39-
CORE_BRANCH: master
39+
CORE_BRANCH: develop
4040

4141
- name: Run node
42-
run: docker exec -e ETH_RPC_URL --detach tests-runner bash -c 'NODE_PORT=8546 make node'
42+
run: docker exec -e ETH_RPC_URL --detach tests-runner bash -c 'NODE_PORT=8545 make node'
4343
env:
4444
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}
4545

4646
- name: Check that the fork is ready
4747
shell: bash
48-
run: timeout 30 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' 127.0.0.1 8546
48+
run: |
49+
echo "Waiting for fork node on 127.0.0.1:8545..."
50+
sleep 10
51+
for i in {1..30}; do
52+
if (echo > /dev/tcp/127.0.0.1/8545) >/dev/null 2>&1; then
53+
echo "Fork is ready ✅"
54+
exit 0
55+
fi
56+
echo "Not ready yet... ($i/30)"
57+
sleep 1
58+
done
59+
echo "❌ Fork was not ready after 30 seconds" >&2
60+
exit 1
4961
5062
- name: Prepare test environment with Brownie
51-
run: docker exec -e GITHUB_TOKEN -e ETH_RPC_URL tests-runner bash -c 'make ci-prepare-environment'
63+
run: docker exec -e GITHUB_TOKEN -e ETH_RPC_URL -e ETHERSCAN_TOKEN tests-runner bash -c 'make ci-prepare-environment'
5264
env:
5365
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
ETHERSCAN_TOKEN: ${{ secrets.ETHERSCAN_TOKEN }}
5467

5568
- name: Run core tests
5669
run: docker exec -e CORE_TESTS_TARGET_RPC_URL tests-runner bash -c 'make test-core'
5770
env:
58-
CORE_TESTS_TARGET_RPC_URL: http://127.0.0.1:8546
71+
CORE_TESTS_TARGET_RPC_URL: http://127.0.0.1:8545

.github/workflows/dual_governance_regression.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- "feat/rc2"
1414
- "feat/rc1"
1515
- "feat/next-vote"
16+
- "feat/v3-vote"
1617
workflow_dispatch:
1718

1819
jobs:
@@ -26,15 +27,14 @@ jobs:
2627
cancel-in-progress: true
2728

2829
env:
29-
NODE_VERSION: '20'
30-
PYTHON_VERSION: '3.10'
31-
POETRY_VERSION: '1.8.2'
32-
HARDHAT_NODE_URL: 'http://127.0.0.1:8545'
33-
ANVIL_NODE_URL: 'http://127.0.0.1:8555'
30+
NODE_VERSION: "20"
31+
PYTHON_VERSION: "3.10"
32+
POETRY_VERSION: "1.8.2"
33+
HARDHAT_NODE_URL: "http://127.0.0.1:8545"
34+
ANVIL_NODE_URL: "http://127.0.0.1:8555"
3435
CURL_PARAMS: '-X POST -H "Content-Type: application/json" -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1}"'
3536

3637
steps:
37-
3838
################################################################
3939
# Clone repositories`
4040
################################################################
@@ -50,7 +50,7 @@ jobs:
5050
uses: actions/checkout@v4
5151
with:
5252
repository: lidofinance/dual-governance
53-
ref: feature/escrow-mainnet-deploy
53+
ref: feature/report-simulation
5454
path: dual-governance
5555
persist-credentials: false
5656
token: ${{ secrets.GITHUB_TOKEN }}
@@ -63,7 +63,7 @@ jobs:
6363
uses: actions/setup-node@v4
6464
with:
6565
node-version: ${{ env.NODE_VERSION }}
66-
cache: 'yarn'
66+
cache: "yarn"
6767
cache-dependency-path: scripts/yarn.lock
6868

6969
- name: Install Poetry
@@ -141,11 +141,17 @@ jobs:
141141
done
142142
working-directory: scripts
143143

144+
- name: Import network config for brownie
145+
shell: bash
146+
run: poetry run brownie networks import network-config.yaml True
147+
working-directory: scripts
148+
144149
- name: Prepare test environment with Brownie
145-
run: poetry run brownie run scripts/ci/prepare_environment --network mainnet-fork
150+
run: poetry run brownie run scripts/ci/prepare_environment --network mfh-1
146151
working-directory: scripts
147152
env:
148153
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154+
ETHERSCAN_TOKEN: ${{ secrets.ETHERSCAN_TOKEN }}
149155

150156
- name: Run regression tests
151157
run: npm run test:regressions -- --load-accounts

.github/workflows/normal_vote_ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
run-tests-normal-1:
1414
name: Brownie fork NORMAL tests 1
1515
runs-on: "ubuntu-latest"
16-
timeout-minutes: 100
16+
timeout-minutes: 150
1717

1818
services:
1919
hardhat-node:
@@ -37,7 +37,7 @@ jobs:
3737
run-tests-normal-2:
3838
name: Brownie fork NORMAL tests 2
3939
runs-on: "ubuntu-latest"
40-
timeout-minutes: 100
40+
timeout-minutes: 150
4141

4242
services:
4343
hardhat-node:

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,40 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
233233
git clean -d -x -f; \
234234
fi
235235

236+
RUN if [ "$TARGETARCH" = "arm64" ]; then \
237+
# build solc-v0.8.25
238+
git checkout v0.8.25; \
239+
# the compiler throws warnings when compiling this version, and the warnings are treated as errors.
240+
# we disable treating the warnings as errors, unless the build doesn't succeed
241+
grep -rl '\-Werror' ./cmake/EthCompilerSettings.cmake | xargs sed -i 's/\-Werror/\-Wno\-error/g'; \
242+
# there is no sudo in the container, but we are under root so we do not need it
243+
grep -rl 'sudo make install' ./scripts/build.sh | xargs sed -i 's/sudo make install/make install/g'; \
244+
# build solc faster
245+
grep -rl 'make -j2' ./scripts/build.sh | xargs sed -i 's/make -j2/make -j4/g'; \
246+
./scripts/build.sh; \
247+
mv /usr/local/bin/solc /root/.solcx/solc-v0.8.25; \
248+
git checkout .; \
249+
git checkout develop; \
250+
git clean -d -x -f; \
251+
fi
252+
253+
RUN if [ "$TARGETARCH" = "arm64" ]; then \
254+
# build solc-v0.8.21
255+
git checkout v0.8.21; \
256+
# the compiler throws warnings when compiling this version, and the warnings are treated as errors.
257+
# we disable treating the warnings as errors, unless the build doesn't succeed
258+
grep -rl '\-Werror' ./cmake/EthCompilerSettings.cmake | xargs sed -i 's/\-Werror/\-Wno\-error/g'; \
259+
# there is no sudo in the container, but we are under root so we do not need it
260+
grep -rl 'sudo make install' ./scripts/build.sh | xargs sed -i 's/sudo make install/make install/g'; \
261+
# build solc faster
262+
grep -rl 'make -j2' ./scripts/build.sh | xargs sed -i 's/make -j2/make -j4/g'; \
263+
./scripts/build.sh; \
264+
mv /usr/local/bin/solc /root/.solcx/solc-v0.8.21; \
265+
git checkout .; \
266+
git checkout develop; \
267+
git clean -d -x -f; \
268+
fi
269+
236270
RUN if [ "$TARGETARCH" = "arm64" ]; then \
237271
# build solc-v0.6.11
238272
git checkout v0.6.11; \
@@ -303,6 +337,8 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.7.6 --version | gr
303337
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.15 --version | grep 'Version: 0.8.15+commit.e14f2714' || (echo "Incorrect solc-v0.8.15 version" && exit 1) fi
304338
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.19 --version | grep 'Version: 0.8.19+commit.7dd6d404' || (echo "Incorrect solc-v0.8.19 version" && exit 1) fi
305339
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.24 --version | grep 'Version: 0.8.24+commit.e11b9ed9' || (echo "Incorrect solc-v0.8.24 version" && exit 1) fi
340+
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.25 --version | grep 'Version: 0.8.25+commit.b61c2a91' || (echo "Incorrect solc-v0.8.25 version" && exit 1) fi
341+
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.21 --version | grep 'Version: 0.8.21+commit.d9974bed' || (echo "Incorrect solc-v0.8.21 version" && exit 1) fi
306342
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.6.11 --version | grep 'Version: 0.6.11+commit.5ef660b1' || (echo "Incorrect solc-v0.6.11 version" && exit 1) fi
307343
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.vvm/vyper-0.3.7 --version | grep '0.3.7+' || (echo "Incorrect vyper-0.3.7 version" && exit 1) fi
308344

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ define run_2nd_test
44
poetry run $(1)
55
endef
66

7+
# Get the latest block number from the target RPC node to use as FORKING_BLOCK_NUMBER for core tests
8+
__get_rpc_latest_block_number:
9+
@curl -s -X POST $(CORE_TESTS_TARGET_RPC_URL) \
10+
-H "Content-Type: application/json" \
11+
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
12+
| sed -E 's/.*"result":"([^"]+)".*/\1/' \
13+
| xargs printf "%d"
714

815
test:
916
ifdef vote
@@ -22,6 +29,7 @@ CORE_DIR ?= lido-core
2229
CORE_BRANCH ?= master
2330
NODE_PORT ?= 8545
2431
SECONDARY_NETWORK ?= mfh-2
32+
NETWORK_STATE_FILE ?= deployed-mainnet.json
2533

2634
test-1/2:
2735
poetry run brownie test tests/[tc]*.py tests/regression/test_staking_router_stake_distribution.py --durations=20 --network mfh-1
@@ -78,9 +86,12 @@ node3:
7886
npx hardhat node --fork $(ETH_RPC_URL3) --port $(NODE_PORT)
7987

8088
test-core:
89+
LATEST_BLOCK_NUMBER=$$($(MAKE) --no-print-directory __get_rpc_latest_block_number) && \
90+
echo "LATEST_BLOCK_NUMBER: $$LATEST_BLOCK_NUMBER" && \
8191
cd $(CORE_DIR) && \
82-
FORK_RPC_URL=$(CORE_TESTS_TARGET_RPC_URL) \
8392
RPC_URL=$(CORE_TESTS_TARGET_RPC_URL) \
93+
NETWORK_STATE_FILE=$(NETWORK_STATE_FILE) \
94+
FORKING_BLOCK_NUMBER=$$LATEST_BLOCK_NUMBER \
8495
yarn test:integration
8596

8697
slots:
@@ -92,7 +103,7 @@ slots:
92103
@rm -f slots.ts
93104

94105
ci-prepare-environment:
95-
poetry run brownie run scripts/ci/prepare_environment --network $(SECONDARY_NETWORK)
106+
poetry run brownie run scripts/ci/prepare_environment --network mfh-1
96107

97108
enact-fork:
98109
poetry run brownie run $(vote) start_and_execute_vote_on_fork_manual --network=mfh-1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ _*may be optionally set when running tests asynchronously to reduce the risk of
4949
Run the container in the `scripts` directory and specify the ENV VARs:
5050

5151
```shell
52-
docker run --name scripts -v "$(pwd)":/root/scripts -e ETH_RPC_URL -e ETH_RPC_URL2 -e ETH_RPC_URL3 -e PINATA_CLOUD_TOKEN -e DEPLOYER -e ETHERSCAN_TOKEN -e ETHERSCAN_TOKEN2 -e ETHERSCAN_TOKEN3 -d ghcr.io/lidofinance/scripts:v19
52+
docker run --name scripts -v "$(pwd)":/root/scripts -e ETH_RPC_URL -e ETH_RPC_URL2 -e PINATA_CLOUD_TOKEN -e DEPLOYER -e ETHERSCAN_TOKEN -e ETHERSCAN_TOKEN2 -p 8545:8545 -d ghcr.io/lidofinance/scripts:v21
5353
```
5454

5555
#### Step 4. Initialize container

configs/config_mainnet.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

109109
# LidoLocator
110110
LIDO_LOCATOR = "0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb"
111-
LIDO_LOCATOR_IMPL = "0x2C298963FB763f74765829722a1ebe0784f4F5Cf"
111+
LIDO_LOCATOR_IMPL = "0x2f8779042EFaEd4c53db2Ce293eB6B3f7096C72d"
112112

113113
# Other upgrade addresses
114114
LIDO_V2_UPGRADE_TEMPLATE = "0xa818fF9EC93122Bf9401ab4340C42De638CD600a"
@@ -121,7 +121,7 @@
121121
WITHDRAWAL_CREDENTIALS = "0x010000000000000000000000b9d7934878b5fb9610b3fe8a5e441e8fad7e293f"
122122

123123
# Lido
124-
LIDO_IMPL = "0x17144556fd3424EDC8Fc8A4C940B2D04936d17eb"
124+
LIDO_IMPL = "0x6ca84080381E43938476814be61B779A8bB6a600"
125125
# see Lido's proxy appId()
126126
LIDO_ARAGON_APP_ID = "0x3ca7c3e38968823ccb4c78ea688df41356f182ae1d159e4ee608d30d68cef320"
127127
LIDO_MAX_STAKE_LIMIT_ETH = 150_000
@@ -172,7 +172,7 @@
172172
"0x637572617465642d6f6e636861696e2d76310000000000000000000000000000"
173173
)
174174
SIMPLE_DVT_VERSION = 4
175-
SIMPLE_DVT_MODULE_PRIORITY_EXIT_SHARE_THRESHOLD = 444
175+
SIMPLE_DVT_MODULE_PRIORITY_EXIT_SHARE_THRESHOLD = 478
176176
SIMPLE_DVT_MODULE_MAX_DEPOSITS_PER_BLOCK = 150
177177
SIMPLE_DVT_MODULE_MIN_DEPOSITS_BLOCK_DISTANCE = 25
178178

@@ -201,7 +201,7 @@
201201
EXIT_EVENTS_LOOKBACK_WINDOW_IN_SLOTS = 14 * 7200 # 14 days
202202

203203
# OracleReportSanityChecker
204-
ORACLE_REPORT_SANITY_CHECKER = "0x6232397ebac4f5772e53285B26c47914E9461E75"
204+
ORACLE_REPORT_SANITY_CHECKER = "0xf1647c86E6D7959f638DD9CE1d90e2F3C9503129"
205205
APPEARED_VALIDATORS_PER_DAY_LIMIT = 1800
206206
EXITED_VALIDATORS_PER_DAY_LIMIT = 3600
207207
ANNUAL_BALANCE_INCREASE_BP_LIMIT = 1000 # 10%
@@ -216,7 +216,7 @@
216216
CL_BALANCE_ORACLES_ERROR_UPPER_BP_LIMIT = 50
217217

218218
# Burner
219-
BURNER = "0xD15a672319Cf0352560eE76d9e89eAB0889046D3"
219+
BURNER = "0xE76c52750019b80B43E36DF30bf4060EB73F573a"
220220
TOTAL_NON_COVER_SHARES_BURNT = 32145684728326685744
221221
TOTAL_COVER_SHARES_BURNT = 0
222222

@@ -239,11 +239,11 @@
239239
# AccountingOracle
240240
# and its corresponding HashConsensus
241241
ACCOUNTING_ORACLE = "0x852deD011285fe67063a08005c71a85690503Cee"
242-
ACCOUNTING_ORACLE_IMPL = "0xE9906E543274cebcd335d2C560094089e9547e8d"
242+
ACCOUNTING_ORACLE_IMPL = "0x1455B96780A93e08abFE41243Db92E2fCbb0141c"
243243
HASH_CONSENSUS_FOR_AO = "0xD624B08C83bAECF0807Dd2c6880C3154a5F0B288"
244244
AO_EPOCHS_PER_FRAME = 225
245245
AO_FAST_LANE_LENGTH_SLOTS = 100
246-
AO_CONSENSUS_VERSION = 4
246+
AO_CONSENSUS_VERSION = 5
247247

248248
# ValidatorsExitBusOracle
249249
VALIDATORS_EXIT_BUS_ORACLE = "0x0De4Ea0184c2ad0BacA7183356Aea5B8d5Bf5c6e"
@@ -364,7 +364,7 @@
364364
OBOL_LIDO_SPLIT_IMPL = "0x2fB59065F049e0D0E3180C6312FA0FeB5Bbf0FE3"
365365

366366
# Ethereum Part for Optimism bridge
367-
L1_TOKEN_RATE_NOTIFIER = "0xe6793B9e4FbA7DE0ee833F9D02bba7DB5EB27823"
367+
L1_TOKEN_RATE_NOTIFIER = "0x25e35855783bec3E49355a29e110f02Ed8b05ba9"
368368
L1_OPTIMISM_TOKEN_RATE_PUSHER = "0xd54c1c6413caac3477AC14b2a80D5398E3c32FfE"
369369
L1_OPTIMISM_TOKENS_BRIDGE = "0x76943C0D61395d8F2edF9060e1533529cAe05dE6"
370370
L1_OPTIMISM_TOKENS_BRIDGE_IMPL = "0x29C5c51A031165CE62F964966A6399b81165EFA4"
@@ -522,3 +522,15 @@
522522
"WITHDRAWAL_BLOCKERS": (WITHDRAWAL_QUEUE, VALIDATORS_EXIT_BUS_ORACLE, TRIGGERABLE_WITHDRAWALS_GATEWAY),
523523
}
524524
}
525+
526+
# Lido V3 - stVaults
527+
VAULT_HUB = "0x1d201BE093d847f6446530Efb0E8Fb426d176709"
528+
ACCOUNTING = "0x23ED611be0e1a820978875C0122F92260804cdDf"
529+
ACCOUNTING_IMPL = "0xd43a3E984071F40d5d840f60708Af0e9526785df"
530+
OPERATOR_GRID = "0xC69685E89Cefc327b43B7234AC646451B27c544d"
531+
LAZY_ORACLE = "0x5DB427080200c235F2Ae8Cd17A7be87921f7AD6c"
532+
PREDEPOSIT_GUARANTEE = "0xF4bF42c6D6A0E38825785048124DBAD6c9eaaac3"
533+
VAULTS_ADAPTER = "0xe2DE6d2DefF15588a71849c0429101F8ca9FB14D"
534+
GATE_SEAL_V3 = "0x881dAd714679A6FeaA636446A0499101375A365c"
535+
536+
INITIAL_MAX_EXTERNAL_RATIO_BP = 300 # 3%

0 commit comments

Comments
 (0)