Skip to content

Commit db75162

Browse files
authored
Merge pull request #373 from lidofinance/feat/next-vote-with-core
Most of the work on plugging / moving core integration tests were done in this but the base branch, thus merging for keeping just a single branch
2 parents f1aa5ac + 9c09c40 commit db75162

File tree

113 files changed

+14699
-968
lines changed

Some content is hidden

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

113 files changed

+14699
-968
lines changed

.github/actions/core_tests/action.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
- uses: actions/checkout@v4
1515
with:
1616
repository: lidofinance/core
17-
ref: master
17+
ref: develop
1818
path: core
1919

2020
- name: Enable corepack
@@ -29,7 +29,14 @@ runs:
2929
- name: Install dependencies
3030
working-directory: core
3131
shell: bash
32-
run: yarn install
32+
run: yarn install --immutable
33+
env:
34+
CI: true
35+
36+
- name: Compile contracts
37+
working-directory: core
38+
shell: bash
39+
run: yarn compile
3340

3441
- name: Set env
3542
working-directory: core
@@ -39,6 +46,7 @@ runs:
3946
- name: Run integration tests
4047
working-directory: core
4148
shell: bash
42-
run: yarn test:integration:fork:mainnet
49+
run: yarn test:integration
4350
env:
44-
LOG_LEVEL: debug
51+
FORK_RPC_URL: http://localhost:8555
52+
LOG_LEVEL: info

.github/actions/scripts_tests/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
description: "etherscan api key"
1515
required: true
1616
default: ""
17+
command:
18+
description: "command to execute tests"
19+
required: true
20+
default: ""
1721

1822
runs:
1923
using: "composite"
@@ -65,8 +69,8 @@ runs:
6569
working-directory: scripts
6670
shell: bash
6771
run: >
68-
poetry run
69-
brownie test -ra --network mainnet-fork --durations=20
72+
${{ inputs.command }}
7073
env:
7174
WEB3_INFURA_PROJECT_ID: ${{ inputs.infura }}
7275
ETHERSCAN_TOKEN: ${{ inputs.etherscan }}
76+
ETH_RPC_URL: "https://mainnet.infura.io/v3/${{ inputs.infura }}"

.github/workflows/build_and_push_image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
password: ${{ secrets.GITHUB_TOKEN }}
6565

6666
- name: Create and push manifest images
67-
uses: Noelware/docker-manifest-action@master
67+
uses: lidofinance/docker-manifest-action@b33ab348026b120a895167160f5605b0197f0862
6868
with:
6969
inputs: ghcr.io/lidofinance/scripts:${{ github.ref_name }}
7070
images: ghcr.io/lidofinance/scripts:${{ github.ref_name }}-amd64,ghcr.io/lidofinance/scripts:${{ github.ref_name }}-arm64
@@ -78,7 +78,7 @@ jobs:
7878
uses: actions/checkout@v4
7979

8080
- name: Run Trivy vulnerability scanner
81-
uses: aquasecurity/trivy-action@0.28.0
81+
uses: lidofinance/trivy-action@master
8282
with:
8383
image-ref: 'ghcr.io/lidofinance/scripts:${{ github.ref_name }}'
8484
format: 'table'

.github/workflows/core_tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Core tests
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- "master"
7+
- "feat/tests"
8+
- "feat/rc3"
9+
- "feat/rc2"
10+
- "feat/rc1"
11+
- "feat/next-vote"
12+
schedule:
13+
- cron: "0 0 * * TUE"
14+
jobs:
15+
run-tests:
16+
name: Run core repo integration tests
17+
runs-on: "ubuntu-latest"
18+
timeout-minutes: 100
19+
20+
services:
21+
hardhat-node:
22+
image: ghcr.io/lidofinance/hardhat-node:2.24.3
23+
ports:
24+
- 8555:8545
25+
env:
26+
ETH_RPC_URL: "https://mainnet.infura.io/v3/${{ secrets.WEB3_INFURA_PROJECT_ID }}"
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Check that the fork is ready
32+
shell: bash
33+
run: timeout 30 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' 127.0.0.1 8555
34+
35+
- name: Core tests
36+
uses: ./.github/actions/core_tests
37+
with:
38+
vote: "normal"

.github/workflows/large_vote_ci.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Large vote CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "feat/tests"
8+
- "feat/rc3"
9+
- "feat/rc2"
10+
- "feat/rc1"
11+
- "feat/next-vote"
12+
schedule:
13+
- cron: "0 0 * * TUE"
14+
jobs:
15+
run-tests-large-1:
16+
name: Brownie fork LARGE tests 1
17+
runs-on: [protocol-heavy-runners]
18+
timeout-minutes: 150
19+
20+
steps:
21+
- name: Enabling swap
22+
run: |
23+
sudo df -h
24+
sudo swapon --show
25+
sudo swapoff -a
26+
sudo touch /swapfile
27+
sudo fallocate -l 32G /swapfile
28+
sudo chmod 600 /swapfile
29+
sudo mkswap /swapfile
30+
sudo swapon /swapfile
31+
sudo swapon --show
32+
- uses: actions/checkout@v3
33+
- name: Main action
34+
uses: ./.github/actions/brownie_fork_tests
35+
with:
36+
vote: "large"
37+
infura: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
38+
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
39+
command: "make test-1/3"
40+
41+
run-tests-large-2:
42+
name: Brownie fork LARGE tests 2
43+
runs-on: [protocol-heavy-runners]
44+
timeout-minutes: 150
45+
46+
steps:
47+
- name: Enabling swap
48+
run: |
49+
sudo df -h
50+
sudo swapon --show
51+
sudo swapoff -a
52+
sudo touch /swapfile
53+
sudo fallocate -l 32G /swapfile
54+
sudo chmod 600 /swapfile
55+
sudo mkswap /swapfile
56+
sudo swapon /swapfile
57+
sudo swapon --show
58+
- uses: actions/checkout@v3
59+
- name: Main action
60+
uses: ./.github/actions/brownie_fork_tests
61+
with:
62+
vote: "large"
63+
infura: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
64+
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
65+
command: "make test-2/3"
66+
67+
run-tests-large-3:
68+
name: Brownie fork LARGE tests 3
69+
runs-on: [protocol-heavy-runners]
70+
timeout-minutes: 150
71+
72+
steps:
73+
- name: Enabling swap
74+
run: |
75+
sudo df -h
76+
sudo swapon --show
77+
sudo swapoff -a
78+
sudo touch /swapfile
79+
sudo fallocate -l 32G /swapfile
80+
sudo chmod 600 /swapfile
81+
sudo mkswap /swapfile
82+
sudo swapon /swapfile
83+
sudo swapon --show
84+
- uses: actions/checkout@v3
85+
- name: Main action
86+
uses: ./.github/actions/brownie_fork_tests
87+
with:
88+
vote: "large"
89+
infura: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
90+
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
91+
command: "make test-3/3"

.github/workflows/normal_vote_ci.yml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,48 @@ on:
99
- "feat/rc2"
1010
- "feat/rc1"
1111
- "feat/next-vote"
12-
schedule:
13-
- cron: "0 0 * * TUE"
1412
jobs:
15-
run-tests:
16-
name: Run all tests on NORMAL runner
13+
run-tests-normal-1:
14+
name: Brownie fork NORMAL tests 1
1715
runs-on: "ubuntu-latest"
1816
timeout-minutes: 100
19-
20-
services:
21-
hardhat-node:
22-
image: ghcr.io/lidofinance/hardhat-node:2.22.19.2-shanghai
23-
ports:
24-
- 8545:8545
25-
env:
26-
ETH_RPC_URL: "https://mainnet.infura.io/v3/${{ secrets.WEB3_INFURA_PROJECT_ID }}"
17+
2718
steps:
28-
- uses: actions/checkout@v4
29-
30-
- name: Check that the fork is ready
31-
shell: bash
32-
run: timeout 30 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' 127.0.0.1 8545
33-
34-
- name: Execute vote
35-
uses: ./.github/actions/execute_vote
19+
- uses: actions/checkout@v3
20+
- name: Main action
21+
uses: ./.github/actions/brownie_fork_tests
3622
with:
3723
vote: "normal"
3824
infura: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
3925
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
26+
command: "make test-1/3"
4027

41-
- name: Core tests
42-
uses: ./.github/actions/core_tests
28+
run-tests-normal-2:
29+
name: Brownie fork NORMAL tests 2
30+
runs-on: "ubuntu-latest"
31+
timeout-minutes: 100
32+
33+
steps:
34+
- uses: actions/checkout@v3
35+
- name: Main action
36+
uses: ./.github/actions/brownie_fork_tests
4337
with:
4438
vote: "normal"
39+
infura: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
40+
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
41+
command: "make test-2/3"
42+
43+
run-tests-normal-3:
44+
name: Brownie fork NORMAL tests 3
45+
runs-on: "ubuntu-latest"
46+
timeout-minutes: 100
4547

46-
- name: Scripts tests
47-
uses: ./.github/actions/scripts_tests
48+
steps:
49+
- uses: actions/checkout@v3
50+
- name: Main action
51+
uses: ./.github/actions/brownie_fork_tests
4852
with:
4953
vote: "normal"
5054
infura: ${{ secrets.WEB3_INFURA_PROJECT_ID }}
5155
etherscan: ${{ secrets.ETHERSCAN_TOKEN }}
56+
command: "make test-3/3"

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ yarn-error.log
3131

3232
# local env
3333
.envrc
34+
35+
# Docker
36+
/cache
37+
.wake
38+
39+
cache

Dockerfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
102102
git checkout .; \git checkout .; \
103103
git checkout develop; \
104104
git clean -d -x -f; \
105+
# build solc-v0.8.26
106+
git checkout v0.8.26; \
107+
# there is no sudo in the container, but we are under root so we do not need it
108+
grep -rl 'sudo make install' ./scripts/build.sh | xargs sed -i 's/sudo make install/make install/g'; \
109+
# build solc faster
110+
grep -rl 'make -j2' ./scripts/build.sh | xargs sed -i 's/make -j2/make -j4/g'; \
111+
./scripts/build.sh; \
112+
mv /usr/local/bin/solc /root/.solcx/solc-v0.8.26; \
113+
git checkout .; \git checkout .; \
114+
git checkout develop; \
115+
git clean -d -x -f; \
105116
# build solc-v0.8.10
106117
git checkout v0.8.10; \
107118
# the compiler throws warnings when compiling this version, and the warnings are treated as errors.
@@ -265,14 +276,11 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
265276

266277

267278
# init script that runs when the container is started for the very first time
268-
# it will install poetry, yarn libs and init brownie networks
279+
# it will install poetry, yarn libs, init brownie networks and core repository
269280
WORKDIR /root/scripts
270-
RUN touch /root/init.sh
271-
RUN echo "if [ ! -e /root/inited ]; then \n touch /root/inited \n poetry install \n yarn \n poetry run brownie networks import network-config.yaml True \n fi" > /root/init.sh
272-
RUN chmod +x /root/init.sh
273281

274-
275-
# set default working dir for tty
282+
COPY docker-init.sh /root/init.sh
283+
RUN chmod +x /root/init.sh
276284
RUN echo "cd /root/scripts" >> /root/.bashrc
277285

278286

@@ -288,6 +296,7 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.5.14 --version | g
288296
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.5.12 --version | grep 'Version: 0.5.12+commit.7709ece9' || (echo "Incorrect solc-v0.5.12 version" && exit 1) fi
289297
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.6.12 --version | grep 'Version: 0.6.12+commit.27d51765' || (echo "Incorrect solc-v0.6.12 version" && exit 1) fi
290298
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.28 --version | grep 'Version: 0.8.28+commit.7893614a' || (echo "Incorrect solc-v0.8.28 version" && exit 1) fi
299+
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.26 --version | grep 'Version: 0.8.26+commit.8a97fa7' || (echo "Incorrect solc-v0.8.26 version" && exit 1) fi
291300
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.10 --version | grep 'Version: 0.8.10+commit.fc410830' || (echo "Incorrect solc-v0.8.10 version" && exit 1) fi
292301
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.9 --version | grep 'Version: 0.8.9+commit.e5eed63a' || (echo "Incorrect solc-v0.8.9 version" && exit 1) fi
293302
RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.solcx/solc-v0.8.4 --version | grep 'Version: 0.8.4+commit.c7e474f2' || (echo "Incorrect solc-v0.8.4 version" && exit 1) fi
@@ -301,4 +310,4 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then /root/.vvm/vyper-0.3.7 --version | grep
301310

302311

303312
# run init script and sleep to keep the container running
304-
CMD ["/bin/bash", "-c", "/root/init.sh && sleep infinity"]
313+
CMD ["/bin/bash", "-c", "/root/init.sh develop && sleep infinity"]

0 commit comments

Comments
 (0)