-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (70 loc) · 3.94 KB
/
Copy pathMakefile
File metadata and controls
85 lines (70 loc) · 3.94 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
.PHONY: help fmt lint docker-build shadow-build shadow-docker-build run-devnet test docs docs-deps docs-serve
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}'
fmt: ## 🎨 Format all code using rustfmt
cargo fmt --all
lint: ## 🔍 Run clippy on all workspace crates
cargo clippy --workspace --all-targets -- -D warnings
test: leanSpec/fixtures ## 🧪 Run all tests
# Tests need to be run on release to avoid stack overflows during signature verification/aggregation
cargo test --workspace --release
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
DOCKER_TAG?=local
docker-build: ## 🐳 Build the Docker image
docker build \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg GIT_BRANCH=$(GIT_BRANCH) \
-t ghcr.io/lambdaclass/ethlambda:$(DOCKER_TAG) .
@echo
shadow-build: ## 👻 Build a Shadow-simulator-compatible binary (single-threaded, no jemalloc)
./shadow/build.sh cargo build --release --no-default-features --features shadow-integration --bin ethlambda
shadow-docker-build: ## 👻🐳 Build a Shadow-compatible Docker image
docker build \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg GIT_BRANCH=$(GIT_BRANCH) \
--build-arg SHADOW=1 \
--build-arg FEATURES=shadow-integration \
--build-arg NO_DEFAULT_FEATURES=--no-default-features \
--build-arg LOCKED= \
-t ghcr.io/lambdaclass/ethlambda:$(DOCKER_TAG)-shadow .
@echo
LEAN_SPEC_FIXTURES_URL ?= https://github.com/leanEthereum/leanSpec/releases/latest/download/fixtures-prod-scheme.tar.gz
LEAN_SPEC_FIXTURES_SHA_URL ?= $(LEAN_SPEC_FIXTURES_URL).sha256
leanSpec/fixtures:
tmpdir=$$(mktemp -d); \
trap 'rm -rf "$$tmpdir"' EXIT; \
curl -L -f -o "$$tmpdir/fixtures-prod-scheme.tar.gz" "$(LEAN_SPEC_FIXTURES_URL)"; \
curl -L -f -o "$$tmpdir/fixtures-prod-scheme.tar.gz.sha256" "$(LEAN_SPEC_FIXTURES_SHA_URL)"; \
expected=$$(cut -d' ' -f1 "$$tmpdir/fixtures-prod-scheme.tar.gz.sha256"); \
actual=$$(sha256sum "$$tmpdir/fixtures-prod-scheme.tar.gz" | awk '{print $$1}'); \
if [ "$$expected" != "$$actual" ]; then \
echo "SHA256 mismatch: expected $$expected, got $$actual" >&2; \
exit 1; \
fi; \
rm -rf leanSpec/fixtures; \
mkdir -p leanSpec/fixtures; \
tar -xzf "$$tmpdir/fixtures-prod-scheme.tar.gz" -C leanSpec/fixtures --strip-components=1
lean-quickstart:
git clone https://github.com/blockblaz/lean-quickstart.git --depth 1 --single-branch
run-devnet: docker-build lean-quickstart ## 🚀 Run a local devnet using lean-quickstart
@# Remove local devnet data folder to avoid stale data
@# NOTE: --cleanData flag in spin-node.sh doesn't work
@rm -rf lean-quickstart/local-devnet/data/
@echo "Starting local devnet with ethlambda client (\"$(DOCKER_TAG)\" tag). Logs will be dumped in devnet.log, and metrics served in http://localhost:3000"
@echo
@echo "Devnet will be using the current configuration. For custom configurations, modify lean-quickstart/local-devnet/genesis/validator-config.yaml and restart the devnet."
@echo
@# Use temp file instead of sed -i for macOS/GNU portability
@sed 's|ghcr.io/lambdaclass/ethlambda:[^ ]*|ghcr.io/lambdaclass/ethlambda:$(DOCKER_TAG)|' lean-quickstart/client-cmds/ethlambda-cmd.sh > lean-quickstart/client-cmds/ethlambda-cmd.sh.tmp \
&& mv lean-quickstart/client-cmds/ethlambda-cmd.sh.tmp lean-quickstart/client-cmds/ethlambda-cmd.sh
@echo "Starting local devnet. Press Ctrl+C to stop all nodes."
@cd lean-quickstart \
&& NETWORK_DIR=local-devnet ./spin-node.sh --node all --generateGenesis --metrics > ../devnet.log 2>&1
docs-deps: ## 📦 Install dependencies for generating the documentation
cargo install --version 0.5.2 --locked mdbook
cargo install --version 0.12.0 --locked mdbook-linkcheck2
docs: ## 📚 Generate the documentation site under ./book
mdbook build
docs-serve: ## 📖 Serve the documentation locally with live reload
mdbook serve --open