-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
158 lines (124 loc) Β· 6.37 KB
/
Makefile
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
.PHONY: build lint test clean run-image build-image download-test-vectors clean-vectors \
setup-hive test-pattern-default run-hive run-hive-debug clean-hive-logs
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
cargo clippy --all-targets --all-features --workspace --exclude ethrex-prover -- -D warnings
SPECTEST_VERSION := v3.0.0
SPECTEST_ARTIFACT := tests_$(SPECTEST_VERSION).tar.gz
SPECTEST_VECTORS_DIR := cmd/ef_tests/ethrex/vectors
CRATE ?= *
test: $(SPECTEST_VECTORS_DIR) ## π§ͺ Run each crate's tests
cargo test -p '$(CRATE)' --workspace --exclude ethrex-prover --exclude ethrex-levm --exclude ef_tests-levm -- --skip test_contract_compilation --skip testito
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 .
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 --http.addr 0.0.0.0
$(SPECTEST_ARTIFACT):
rm -f tests_*.tar.gz # Delete older versions
curl -L -o $(SPECTEST_ARTIFACT) "https://github.com/ethereum/execution-spec-tests/releases/download/$(SPECTEST_VERSION)/fixtures_stable.tar.gz"
$(SPECTEST_VECTORS_DIR): $(SPECTEST_ARTIFACT)
mkdir -p $(SPECTEST_VECTORS_DIR) tmp
tar -xzf $(SPECTEST_ARTIFACT) -C tmp
mv tmp/fixtures/blockchain_tests/* $(SPECTEST_VECTORS_DIR)
download-test-vectors: $(SPECTEST_VECTORS_DIR) ## π₯ Download test vectors
clean-vectors: ## ποΈ Clean test vectors
rm -rf $(SPECTEST_VECTORS_DIR)
ETHEREUM_PACKAGE_REVISION := 5b49d02ee556232a73ea1e28000ec5b3fca1073f
# Shallow clones can't specify a single revision, but at least we avoid working
# the whole history by making it shallow since a given date (one day before our
# target revision).
ethereum-package:
git clone --single-branch --branch ethrex-integration https://github.com/lambdaclass/ethereum-package
checkout-ethereum-package: ethereum-package ## π¦ Checkout specific Ethereum package revision
cd ethereum-package && \
git fetch && \
git checkout $(ETHEREUM_PACKAGE_REVISION)
ENCLAVE ?= lambdanet
localnet: stop-localnet-silent build-image checkout-ethereum-package ## π Start local network
kurtosis run --enclave $(ENCLAVE) ethereum-package --args-file test_data/network_params.yaml
docker logs -f $$(docker ps -q --filter ancestor=ethrex)
localnet-assertoor-blob: stop-localnet-silent build-image checkout-ethereum-package ## π Start local network with assertoor test
kurtosis run --enclave $(ENCLAVE) ethereum-package --args-file .github/config/assertoor/network_params_blob.yaml
docker logs -f $$(docker ps -q --filter ancestor=ethrex)
localnet-assertoor-tx: stop-localnet-silent build-image checkout-ethereum-package ## π Start local network with assertoor test
kurtosis run --enclave $(ENCLAVE) ethereum-package --args-file .github/config/assertoor/network_params_tx.yaml
docker logs -f $$(docker ps -q --filter ancestor=ethrex)
stop-localnet: ## π Stop local network
kurtosis enclave stop $(ENCLAVE)
kurtosis enclave rm $(ENCLAVE) --force
stop-localnet-silent:
@echo "Double checking local net is not already started..."
@kurtosis enclave stop $(ENCLAVE) >/dev/null 2>&1 || true
@kurtosis enclave rm $(ENCLAVE) --force >/dev/null 2>&1 || true
HIVE_REVISION := df7d5103d4ddc772307f9947be4ad1f20ce03ed0
# Shallow clones can't specify a single revision, but at least we avoid working
# the whole history by making it shallow since a given date (one day before our
# target revision).
HIVE_SHALLOW_SINCE := 2024-09-02
QUIET ?= false
hive:
if [ "$(QUIET)" = "true" ]; then \
git clone --quiet --single-branch --branch master --shallow-since=$(HIVE_SHALLOW_SINCE) https://github.com/lambdaclass/hive && \
cd hive && git checkout --quiet --detach $(HIVE_REVISION) && go build .; \
else \
git clone --single-branch --branch master --shallow-since=$(HIVE_SHALLOW_SINCE) https://github.com/lambdaclass/hive && \
cd hive && git checkout --detach $(HIVE_REVISION) && go build .; \
fi
setup-hive: hive ## π Set up Hive testing framework
if [ "$$(cd hive && git rev-parse HEAD)" != "$(HIVE_REVISION)" ]; then \
if [ "$(QUIET)" = "true" ]; then \
cd hive && \
git checkout --quiet master && \
git fetch --quiet --shallow-since=$(HIVE_SHALLOW_SINCE) && \
git checkout --quiet --detach $(HIVE_REVISION) && go build .;\
else \
cd hive && \
git checkout master && \
git fetch --shallow-since=$(HIVE_SHALLOW_SINCE) && \
git checkout --detach $(HIVE_REVISION) && go build .;\
fi \
fi
TEST_PATTERN ?= /
# Runs a hive testing suite
# The endpoints tested may be limited by supplying a test pattern in the form "/endpoint_1|enpoint_2|..|enpoint_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"`
run-hive: build-image setup-hive ## π§ͺ Run Hive testing suite
cd hive && ./hive --client ethrex --sim $(SIMULATION) --sim.limit "$(TEST_PATTERN)"
run-hive-all: build-image setup-hive ## π§ͺ Run all Hive testing suites
cd hive && ./hive --client ethrex --sim $(SIMULATION) --sim.parallelism 4
run-hive-debug: build-image setup-hive ## π Run Hive testing suite in debug mode
cd hive && ./hive --sim $(SIMULATION) --client ethrex --sim.limit "$(TEST_PATTERN)" --docker.output
clean-hive-logs: ## π§Ή Clean Hive logs
rm -rf ./hive/workspace/logs
loc:
cargo run -p loc
loc-stats:
if [ "$(QUIET)" = "true" ]; then \
cargo run --quiet -p loc -- --summary;\
else \
cargo run -p loc -- --summary;\
fi
hive-stats:
make hive QUIET=true
make setup-hive QUIET=true
rm -rf hive/workspace $(FILE_NAME)_logs
make run-hive-all SIMULATION=ethereum/rpc-compat || exit 0
make run-hive-all SIMULATION=devp2p || exit 0
make run-hive-all SIMULATION=ethereum/engine || exit 0
make run-hive-all SIMULATION=ethereum/sync || exit 0
stats:
make loc-stats QUIET=true && echo
cd crates/vm/levm && make download-evm-ef-tests
cd crates/vm/levm && make run-evm-ef-tests QUIET=true && echo
make hive-stats
cargo run --quiet --release -p hive_report