forked from DmitIv/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (79 loc) · 2.9 KB
/
Makefile
File metadata and controls
98 lines (79 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
define run_2nd_test
ETH_RPC_URL="$${ETH_RPC_URL2:-$$ETH_RPC_URL}" \
ETHERSCAN_TOKEN="$${ETHERSCAN_TOKEN2:-$$ETHERSCAN_TOKEN}" \
poetry run $(1)
endef
test:
ifdef vote
OMNIBUS_VOTE_IDS=$(vote) poetry run brownie test --network mfh-1
else
ifdef dg
DG_PROPOSAL_IDS=$(dg) poetry run brownie test --network mfh-1
else
poetry run brownie test --network mfh-1
endif
endif
# Must be different from 8545 because core tests by default run its own fork on 8545
CORE_TESTS_TARGET_RPC_URL ?= http://127.0.0.1:8547
CORE_DIR ?= lido-core
CORE_BRANCH ?= master
NODE_PORT ?= 8545
SECONDARY_NETWORK ?= mfh-2
test-1/2:
poetry run brownie test tests/[tc]*.py tests/regression/test_staking_router_stake_distribution.py --durations=20 --network mfh-1
test-2/2:
$(call run_2nd_test,brownie test -k 'not test_staking_router_stake_distribution.py' --durations=20 --network $(SECONDARY_NETWORK))
init: init-scripts init-core
init-scripts:
# NB: OpenZeppelin/openzeppelin-contracts@4.0.0 is a dirty copy paste from brownie-config.yml
# because current brownie version does not support pm install from the config file
poetry install && \
yarn && \
poetry run brownie pm install OpenZeppelin/openzeppelin-contracts@4.0.0 && \
poetry run brownie compile && \
poetry run brownie networks import network-config.yaml True
debug:
echo $(shell shell awk '/^\s*-/ { print substr($0, index($0,$2)) }' brownie-config.yml)
init-core:
if [ -d "$(CORE_DIR)" ]; then \
cd $(CORE_DIR) && \
git config pull.rebase false && \
git fetch origin $(CORE_BRANCH) && \
git checkout $(CORE_BRANCH); \
else \
git clone -b $(CORE_BRANCH) https://github.com/lidofinance/core.git $(CORE_DIR); \
cd $(CORE_DIR); \
fi && \
CI=true yarn --immutable && \
yarn compile && \
if [ ! -f .env ]; then \
cp .env.example .env; \
fi
docker-init:
docker exec -w /root/scripts scripts bash -c 'make init'
docker:
docker exec -it scripts /bin/bash
node:
npx hardhat node --fork $(ETH_RPC_URL) --port $(NODE_PORT)
node1:
npx hardhat node --fork $(ETH_RPC_URL) --port $(NODE_PORT)
node2:
npx hardhat node --fork $(ETH_RPC_URL2) --port $(NODE_PORT)
node3:
npx hardhat node --fork $(ETH_RPC_URL3) --port $(NODE_PORT)
test-core:
cd $(CORE_DIR) && \
FORK_RPC_URL=$(CORE_TESTS_TARGET_RPC_URL) \
RPC_URL=$(CORE_TESTS_TARGET_RPC_URL) \
yarn test:integration
slots:
@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):"
@cat | grep -v "import { StorageSlot } from '../entity/storage_slot'" | sed 's/StorageSlot/any/g' > slots.ts
@cat check_storage_slots.ts >> slots.ts
@echo "Checking storage slots against 127.0.0.1:8545..."
@npx tsx slots.ts
@rm -f slots.ts
ci-prepare-environment:
poetry run brownie run scripts/ci/prepare_environment --network $(SECONDARY_NETWORK)
enact-fork:
poetry run brownie run $(vote) start_and_execute_vote_on_fork_manual --network=mfh-1