forked from lambdaclass/ethrex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
184 lines (143 loc) · 8.01 KB
/
Makefile
File metadata and controls
184 lines (143 loc) · 8.01 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
.PHONY: build lint test clean run-image build-image clean-vectors \
setup-hive test-pattern-default run-hive run-hive-debug clean-hive-logs \
load-test-fibonacci load-test-io run-hive-eest-blobs
help: ## 📚 Show help for each of the Makefile recipes
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
build: ## 🔨 Build the client
cargo build --workspace
lint: ## 🧹 Linter check
# Note that we are compiling without the "gpu" feature (see #4048 for why)
# To compile with it you can replace '-F' with '--all-features', but you need to have nvcc installed
cargo clippy --all-targets -F debug,risc0,sp1,sync-test \
--workspace --exclude ethrex-prover --exclude guest_program --exclude ef_tests-blockchain \
--release -- -D warnings
CRATE ?= *
test: ## 🧪 Run each crate's tests
cargo test -p '$(CRATE)' --workspace --exclude ethrex-levm --exclude ef_tests-blockchain --exclude ethrex-l2 -- --skip test_contract_compilation
clean: clean-vectors ## 🧹 Remove build artifacts
cargo clean
rm -rf hive
STAMP_FILE := .docker_build_stamp
$(STAMP_FILE): $(shell find crates cmd -type f -name '*.rs') Cargo.toml Dockerfile
docker build -t ethrex:local .
touch $(STAMP_FILE)
build-image: $(STAMP_FILE) ## 🐳 Build the Docker image
run-image: build-image ## 🏃 Run the Docker image
docker run --rm -p 127.0.0.1:8545:8545 ethrex:main --http.addr 0.0.0.0
dev: ## 🏃 Run the ethrex client in DEV_MODE with the InMemory Engine
cargo run --bin ethrex -- \
--network ./fixtures/genesis/l1.json \
--http.port 8545 \
--http.addr 0.0.0.0 \
--authrpc.port 8551 \
--dev \
--datadir memory
ETHEREUM_PACKAGE_REVISION := 82e5a7178138d892c0c31c3839c89d53ffd42d9a
ETHEREUM_PACKAGE_DIR := ethereum-package
checkout-ethereum-package: ## 📦 Checkout specific Ethereum package revision
@if [ ! -d "$(ETHEREUM_PACKAGE_DIR)" ]; then \
echo "Cloning ethereum-package repository..."; \
git clone --quiet https://github.com/ethpandaops/ethereum-package $(ETHEREUM_PACKAGE_DIR); \
fi
@cd $(ETHEREUM_PACKAGE_DIR) && \
CURRENT_REV=$$(git rev-parse HEAD) && \
if [ "$$CURRENT_REV" != "$(ETHEREUM_PACKAGE_REVISION)" ]; then \
echo "Current HEAD ($$CURRENT_REV) is not the target revision. Checking out $(ETHEREUM_PACKAGE_REVISION)..."; \
git fetch --quiet && \
git checkout --quiet $(ETHEREUM_PACKAGE_REVISION); \
else \
echo "ethereum-package is already at the correct revision."; \
fi
ENCLAVE ?= lambdanet
KURTOSIS_CONFIG_FILE ?= ./fixtures/networks/default.yaml
# If on a Mac, use OrbStack to run Docker containers because Docker Desktop doesn't work well with Kurtosis
localnet: build-image checkout-ethereum-package ## 🌐 Start kurtosis network
@set -e; \
trap 'printf "\nStopping localnet...\n"; $(MAKE) stop-localnet || true; exit 0' INT TERM HUP QUIT; \
cp metrics/provisioning/grafana/dashboards/common_dashboards/ethrex_l1_perf.json ethereum-package/src/grafana/ethrex_l1_perf.json; \
kurtosis run --enclave $(ENCLAVE) ethereum-package --args-file $(KURTOSIS_CONFIG_FILE); \
CID=$$(docker ps -q --filter ancestor=ethrex:local | head -n1); \
if [ -n "$$CID" ]; then docker logs -f $$CID || true; else echo "No ethrex container found; skipping logs."; fi
stop-localnet: ## 🛑 Stop local network
kurtosis enclave stop $(ENCLAVE)
kurtosis enclave rm $(ENCLAVE) --force
HIVE_BRANCH ?= master
setup-hive: ## 🐝 Set up Hive testing framework
if [ -d "hive" ]; then \
cd hive && \
git fetch origin && \
git checkout $(HIVE_BRANCH) && \
git pull origin $(HIVE_BRANCH) && \
go build .; \
else \
git clone --branch $(HIVE_BRANCH) https://github.com/ethereum/hive && \
cd hive && \
git checkout $(HIVE_BRANCH) && \
go build .; \
fi
TEST_PATTERN ?= /
SIM_LOG_LEVEL ?= 3
SIM_PARALLELISM ?= 16
# Runs a Hive testing suite. A web interface showing the results is available at http://127.0.0.1:8080 via the `view-hive` target.
# The endpoints tested can be filtered by supplying a test pattern in the form "/endpoint_1|endpoint_2|..|endpoint_n".
# For example, to run the rpc-compat suites for eth_chainId & eth_blockNumber, you should run:
# `make run-hive SIMULATION=ethereum/rpc-compat TEST_PATTERN="/eth_chainId|eth_blockNumber"`
# The simulation log level can be set using SIM_LOG_LEVEL (from 1 up to 4).
HIVE_CLIENT_FILE := ../fixtures/hive/clients.yaml
run-hive: build-image setup-hive ## 🧪 Run Hive testing suite
- cd hive && ./hive --client-file $(HIVE_CLIENT_FILE) --client ethrex --sim $(SIMULATION) --sim.limit "$(TEST_PATTERN)" --sim.parallelism $(SIM_PARALLELISM) --sim.loglevel $(SIM_LOG_LEVEL)
$(MAKE) view-hive
run-hive-all: build-image setup-hive ## 🧪 Run all Hive testing suites
- cd hive && ./hive --client-file $(HIVE_CLIENT_FILE) --client ethrex --sim ".*" --sim.parallelism $(SIM_PARALLELISM) --sim.loglevel $(SIM_LOG_LEVEL)
$(MAKE) view-hive
run-hive-debug: build-image setup-hive ## 🐞 Run Hive testing suite in debug mode
cd hive && ./hive --sim $(SIMULATION) --client-file $(HIVE_CLIENT_FILE) --client ethrex --sim.loglevel 4 --sim.limit "$(TEST_PATTERN)" --sim.parallelism "$(SIM_PARALLELISM)" --docker.output
# EEST Hive
TEST_PATTERN_EEST ?= .*fork_Paris.*|.*fork_Shanghai.*|.*fork_Cancun.*|.*fork_Prague.*
run-hive-eest: build-image setup-hive ## 🧪 Generic command for running Hive EEST tests. Specify EEST_SIM
- cd hive && ./hive --client-file $(HIVE_CLIENT_FILE) --client ethrex --sim $(EEST_SIM) --sim.limit "$(TEST_PATTERN_EEST)" --sim.parallelism $(SIM_PARALLELISM) --sim.loglevel $(SIM_LOG_LEVEL) --sim.buildarg fixtures=$(shell cat tooling/ef_tests/blockchain/.fixtures_url)
run-hive-eest-engine: ## Run hive EEST Engine tests
$(MAKE) run-hive-eest EEST_SIM=ethereum/eest/consume-engine
run-hive-eest-rlp: ## Run hive EEST RLP tests
$(MAKE) run-hive-eest EEST_SIM=ethereum/eest/consume-rlp
run-hive-eest-blobs: ## Run hive EEST Blobs tests
$(MAKE) run-hive-eest EEST_SIM=ethereum/eest/execute-blobs
clean-hive-logs: ## 🧹 Clean Hive logs
rm -rf ./hive/workspace/logs
view-hive: ## 🛠️ Builds hiveview with the logs from the hive execution
cd hive && go build ./cmd/hiveview && ./hiveview --serve --logdir ./workspace/logs
start-node-with-flamegraph: rm-test-db ## 🚀🔥 Starts an ethrex client used for testing
echo "Running the test-node with LEVM"; \
sudo -E CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph \
--bin ethrex \
-- \
--network fixtures/genesis/l2.json \
--http.port 1729 \
--dev \
--datadir test_ethrex
load-test: ## 🚧 Runs a load-test. Run make start-node-with-flamegraph and in a new terminal make load-node
cargo run --release --manifest-path ./tooling/load_test/Cargo.toml -- -k ./fixtures/keys/private_keys.txt -t eth-transfers
load-test-erc20:
cargo run --release --manifest-path ./tooling/load_test/Cargo.toml -- -k ./fixtures/keys/private_keys.txt -t erc20
load-test-fibonacci:
cargo run --release --manifest-path ./tooling/load_test/Cargo.toml -- -k ./fixtures/keys/private_keys.txt -t fibonacci
load-test-io:
cargo run --release --manifest-path ./tooling/load_test/Cargo.toml -- -k ./fixtures/keys/private_keys.txt -t io-heavy
rm-test-db: ## 🛑 Removes the DB used by the ethrex client used for testing
sudo cargo run --release --bin ethrex -- removedb --force --datadir test_ethrex
fixtures/ERC20/ERC20.bin: ## 🔨 Build the ERC20 contract for the load test
solc ./fixtures/contracts/ERC20/ERC20.sol -o $@
sort-genesis-files:
cd ./tooling/genesis && cargo run
# Using & so make calls this recipe only once per run
mermaid-init.js mermaid.min.js &:
@# Required for mdbook-mermaid to work
@mdbook-mermaid install . \
|| (echo "mdbook-mermaid invocation failed, remember to install docs dependencies first with \`make docs-deps\`" \
&& exit 1)
docs-deps: ## 📦 Install dependencies for generating the documentation
cargo install mdbook mdbook-alerts mdbook-mermaid mdbook-linkcheck mdbook-katex
docs: mermaid-init.js mermaid.min.js ## 📚 Generate the documentation
mdbook build
docs-serve: mermaid-init.js mermaid.min.js ## 📚 Generate and serve the documentation
mdbook serve --open