Skip to content

Commit 128ea40

Browse files
authored
Merge pull request #526 from lidofinance/feat/next-vote
Omnibuses (#194 Lido V3 + #195 Operations + #196 LDO recover + #197 LDO recover)
2 parents 43248a8 + dd3fc3f commit 128ea40

File tree

87 files changed

+18331
-964
lines changed

Some content is hidden

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

87 files changed

+18331
-964
lines changed

.github/workflows/core_tests.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ on:
1515
jobs:
1616
run-tests:
1717
name: Core repo tests in docker
18-
runs-on: "ubuntu-latest"
18+
runs-on: [voting-private-runners]
1919
timeout-minutes: 120
2020

2121
services:
22-
2322
tests-runner:
24-
image: ghcr.io/lidofinance/scripts:v19
23+
image: ghcr.io/lidofinance/scripts:v21
2524
ports:
26-
- 8546:8546
25+
- 8545:8545
2726
volumes:
2827
- ${{ github.workspace }}:/root/scripts
2928
options: >-
@@ -34,25 +33,38 @@ jobs:
3433
uses: actions/checkout@v4
3534

3635
- name: Run init script
37-
run: docker exec -e CORE_BRANCH tests-runner bash -c 'make init'
36+
run: docker exec -e CORE_BRANCH tests-runner bash -c 'PYTHONPATH=$PWD make init'
3837
env:
3938
CORE_BRANCH: master
4039

4140
- name: Run node
42-
run: docker exec -e ETH_RPC_URL --detach tests-runner bash -c 'NODE_PORT=8546 make node'
41+
run: docker exec -e ETH_RPC_URL --detach tests-runner bash -c 'NODE_PORT=8545 make node'
4342
env:
4443
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}
4544

4645
- name: Check that the fork is ready
4746
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
47+
run: |
48+
echo "Waiting for fork node on 127.0.0.1:8545..."
49+
sleep 10
50+
for i in {1..30}; do
51+
if (echo > /dev/tcp/127.0.0.1/8545) >/dev/null 2>&1; then
52+
echo "Fork is ready ✅"
53+
exit 0
54+
fi
55+
echo "Not ready yet... ($i/30)"
56+
sleep 1
57+
done
58+
echo "❌ Fork was not ready after 30 seconds" >&2
59+
exit 1
4960
5061
- 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'
62+
run: docker exec -e GITHUB_TOKEN -e ETH_RPC_URL -e ETHERSCAN_TOKEN tests-runner bash -c 'make ci-prepare-environment'
5263
env:
5364
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
ETHERSCAN_TOKEN: ${{ secrets.ETHERSCAN_TOKEN }}
5466

5567
- name: Run core tests
5668
run: docker exec -e CORE_TESTS_TARGET_RPC_URL tests-runner bash -c 'make test-core'
5769
env:
58-
CORE_TESTS_TARGET_RPC_URL: http://127.0.0.1:8546
70+
CORE_TESTS_TARGET_RPC_URL: http://127.0.0.1:8545

.github/workflows/dual_governance_regression.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ jobs:
2626
cancel-in-progress: true
2727

2828
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'
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"
3434
CURL_PARAMS: '-X POST -H "Content-Type: application/json" -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1}"'
3535

3636
steps:
37-
3837
################################################################
3938
# Clone repositories`
4039
################################################################
@@ -50,7 +49,7 @@ jobs:
5049
uses: actions/checkout@v4
5150
with:
5251
repository: lidofinance/dual-governance
53-
ref: feature/escrow-mainnet-deploy
52+
ref: develop
5453
path: dual-governance
5554
persist-credentials: false
5655
token: ${{ secrets.GITHUB_TOKEN }}
@@ -63,7 +62,7 @@ jobs:
6362
uses: actions/setup-node@v4
6463
with:
6564
node-version: ${{ env.NODE_VERSION }}
66-
cache: 'yarn'
65+
cache: "yarn"
6766
cache-dependency-path: scripts/yarn.lock
6867

6968
- name: Install Poetry
@@ -141,11 +140,17 @@ jobs:
141140
done
142141
working-directory: scripts
143142

143+
- name: Import network config for brownie
144+
shell: bash
145+
run: poetry run brownie networks import network-config.yaml True
146+
working-directory: scripts
147+
144148
- name: Prepare test environment with Brownie
145-
run: poetry run brownie run scripts/ci/prepare_environment --network mainnet-fork
149+
run: PYTHONPATH=$PWD poetry run brownie run scripts/ci/prepare_environment --network mfh-1
146150
working-directory: scripts
147151
env:
148152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
ETHERSCAN_TOKEN: ${{ secrets.ETHERSCAN_TOKEN }}
149154

150155
- name: Run regression tests
151156
run: npm run test:regressions -- --load-accounts

.github/workflows/large_vote_ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
vote: "large"
3737
rpc_url: ${{ secrets.ETH_RPC_URL }}
3838
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
39-
command: "make test-1/2"
39+
command: "PYTHONPATH=$PWD make test-1/2"
4040

4141
run-tests-large-2:
4242
name: Brownie fork LARGE tests 2
@@ -62,4 +62,4 @@ jobs:
6262
vote: "large"
6363
rpc_url: ${{ secrets.ETH_RPC_URL }}
6464
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
65-
command: "make test-2/2"
65+
command: "PYTHONPATH=$PWD make test-2/2"

.github/workflows/normal_vote_ci.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ jobs:
1313
run-tests-normal-1:
1414
name: Brownie fork NORMAL tests 1
1515
runs-on: [voting-private-runners]
16-
timeout-minutes: 100
16+
timeout-minutes: 150
17+
18+
services:
19+
hardhat-node:
20+
image: ghcr.io/lidofinance/hardhat-node:2.26.0
21+
ports:
22+
- 8545:8545
23+
env:
24+
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}
25+
HARDFORK: "cancun"
1726

1827
steps:
1928
- uses: actions/checkout@v4
@@ -23,12 +32,21 @@ jobs:
2332
vote: "normal"
2433
rpc_url: ${{ secrets.ETH_RPC_URL }}
2534
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
26-
command: "make test-1/2"
35+
command: "PYTHONPATH=$PWD make test-1/2"
2736

2837
run-tests-normal-2:
2938
name: Brownie fork NORMAL tests 2
3039
runs-on: [voting-private-runners]
31-
timeout-minutes: 100
40+
timeout-minutes: 150
41+
42+
services:
43+
hardhat-node:
44+
image: ghcr.io/lidofinance/hardhat-node:2.26.0
45+
ports:
46+
- 8546:8545
47+
env:
48+
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}
49+
HARDFORK: "cancun"
3250

3351
steps:
3452
- uses: actions/checkout@v4
@@ -38,4 +56,4 @@ jobs:
3856
vote: "normal"
3957
rpc_url: ${{ secrets.ETH_RPC_URL }}
4058
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
41-
command: "make test-2/2"
59+
command: "PYTHONPATH=$PWD make test-2/2"

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: 29 additions & 6 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
@@ -36,8 +44,8 @@ init-scripts:
3644
# because current brownie version does not support pm install from the config file
3745
poetry install && \
3846
yarn && \
39-
poetry run brownie pm install OpenZeppelin/openzeppelin-contracts@4.0.0 && \
40-
poetry run brownie compile && \
47+
PYTHONPATH=$$PWD poetry run brownie pm install OpenZeppelin/openzeppelin-contracts@4.0.0 && \
48+
PYTHONPATH=$$PWD poetry run brownie compile && \
4149
poetry run brownie networks import network-config.yaml True
4250

4351
debug:
@@ -78,21 +86,36 @@ 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:
87-
@echo "Input https://github.com/lidofinance/protocol-onchain-mon-bots/blob/main/bots/ethereum-steth-v2/src/utils/constants.ts file content (end with Enter and Ctrl+D):"
88-
@cat | grep -v "import { StorageSlot } from '../entity/storage_slot'" | sed 's/StorageSlot/any/g' > slots.ts
98+
@echo "Input https://github.com/lidofinance/protocol-onchain-mon-bots/blob/main/bots/ethereum-steth-v2/src/utils/constants.mainnet.ts file content (end with Enter and Ctrl+D):"
99+
@cat | grep -v "import { ERC20 } from './constants'" | sed 's/ERC20/any/g' > slots2.ts
100+
@cat \
101+
| grep -v "import { ERC20 } from './constants'" \
102+
| sed 's/ERC20/any/g' \
103+
> slots.ts
104+
105+
@echo "Input https://github.com/lidofinance/protocol-onchain-mon-bots/blob/main/bots/ethereum-steth-v2/src/services/storage-watcher/constants.ts file content (end with Enter and Ctrl+D):"
106+
@cat \
107+
| grep -v "import { StorageSlot } from '../../entity/storage_slot'" \
108+
| sed "s|import { Address } from '../../utils/constants.mainnet'|import { Address } from './slots2.ts'|g" \
109+
| sed 's/StorageSlot/any/g' \
110+
> slots.ts
89111
@cat check_storage_slots.ts >> slots.ts
90112
@echo "Checking storage slots against 127.0.0.1:8545..."
91113
@npx tsx slots.ts
92114
@rm -f slots.ts
115+
@rm -f slots2.ts
93116

94117
ci-prepare-environment:
95-
poetry run brownie run scripts/ci/prepare_environment --network $(SECONDARY_NETWORK)
118+
poetry run brownie run scripts/ci/prepare_environment --network mfh-1
96119

97120
enact-fork:
98121
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

0 commit comments

Comments
 (0)