-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
254 lines (209 loc) · 7.84 KB
/
Justfile
File metadata and controls
254 lines (209 loc) · 7.84 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# On macOS, skip risc0-sys kernel compilation for check/clippy commands.
# The kernels require Xcode (Metal) on macOS but are only needed for linking
# (cargo build), not for type-checking (cargo check/clippy). CI builds run
# on Linux where CPU kernels compile without issue.
_skip_kernels := if os() == "macos" { "RISC0_SKIP_BUILD_KERNELS=1" } else { "" }
set positional-arguments := true
mod tee 'crates/proof/tee'
mod actions 'actions'
# Docker-based local devnet management
mod devnet 'etc/docker'
# Load testing for networks
mod load-test 'crates/infra/load-tests'
alias t := test
alias f := fix
alias b := build
alias be := benches
alias c := clean
alias h := hack
alias u := check-udeps
alias wt := watch-test
alias wc := watch-check
# Default to display help menu
default:
@just --list --list-submodules
# Runs the specs docs locally
specs:
cd docs/specs && bun ci && bun dev
# One-time project setup: installs tooling and builds test contracts
setup:
#!/usr/bin/env bash
set -euo pipefail
OS="$(uname -s)"
ARCH="$(uname -m)"
# ── Install fast linker ──
if [[ "$OS" == "Darwin" ]]; then
if ! brew list lld &>/dev/null; then
echo "Installing lld linker for faster builds..."
brew install lld
fi
# Verify lld is reachable at the path .cargo/config.toml expects
if [[ "$ARCH" == "arm64" ]]; then
LLD="/opt/homebrew/opt/lld/bin/ld64.lld"
else
LLD="/usr/local/opt/lld/bin/ld64.lld"
fi
if [[ ! -x "$LLD" ]]; then
echo "ERROR: lld not found at $LLD"
echo "Try: brew install lld"
exit 1
fi
echo "Found lld at $LLD"
elif [[ "$OS" == "Linux" ]]; then
if ! command -v mold &>/dev/null; then
echo "mold not found. Install it for faster builds:"
echo " Ubuntu/Debian: sudo apt-get install -y mold"
echo " Fedora: sudo dnf install mold"
echo " Arch: sudo pacman -S mold"
exit 1
fi
echo "Found mold at $(command -v mold)"
fi
just build-contracts
echo "Setup complete!"
# Runs all ci checks
ci: fix check lychee zepter check-no-std check-no-std-proof
# Runs ci checks with tests scoped to crates affected by changes
pr: fix check-format check-udeps check-clippy check-deny lychee zepter check-no-std check-no-std-proof test-affected
# Performs lychee checks, installing the lychee command if necessary
lychee:
@command -v lychee >/dev/null 2>&1 || cargo install lychee
lychee --config ./lychee.toml .
# Checks formatting, udeps, clippy, and tests
check: check-format check-udeps check-clippy test check-deny
# Runs cargo deny to check dependencies
check-deny:
@command -v cargo-deny >/dev/null 2>&1 || cargo install cargo-deny
cargo deny check bans --hide-inclusion-graph
# Fixes formatting and clippy issues
fix: build-contracts format-fix clippy-fix zepter-fix
# Runs zepter feature checks, installing zepter if necessary
zepter:
@command -v zepter >/dev/null 2>&1 || cargo install zepter
zepter --version
zepter format features
zepter
# Fixes zepter feature formatting.
zepter-fix:
@command -v zepter >/dev/null 2>&1 || cargo install zepter
zepter format features --fix
# Installs cargo-nextest if not present
install-nextest:
@command -v cargo-nextest >/dev/null 2>&1 || cargo install cargo-nextest
# Runs tests across workspace with all features enabled (excludes devnet)
test: install-nextest build-contracts
cargo nextest run --workspace --all-features --exclude devnet --no-fail-fast
# Runs tests only for crates affected by changes vs main (excludes devnet)
test-affected base="main": install-nextest build-contracts
#!/usr/bin/env bash
set -euo pipefail
affected=$(python3 etc/scripts/local/affected-crates.py {{ base }} --exclude devnet)
if [ -z "$affected" ]; then
echo "No affected crates to test."
exit 0
fi
pkg_args=""
while IFS= read -r crate; do
pkg_args="$pkg_args -p $crate"
done <<< "$affected"
echo "Testing affected crates:$pkg_args"
cargo nextest run --all-features $pkg_args
# Runs tests with ci profile for minimal disk usage
test-ci: install-nextest build-contracts
cargo nextest run --locked --workspace --all-features --exclude devnet --cargo-profile ci
# Runs tests only for affected crates with ci profile (for PRs)
test-affected-ci base="main": install-nextest build-contracts
#!/usr/bin/env bash
set -euo pipefail
affected=$(python3 etc/scripts/local/affected-crates.py {{ base }} --exclude devnet)
if [ -z "$affected" ]; then
echo "No affected crates to test."
exit 0
fi
pkg_args=""
while IFS= read -r crate; do
pkg_args="$pkg_args -p $crate"
done <<< "$affected"
echo "Testing affected crates:$pkg_args"
cargo nextest run --locked --all-features --cargo-profile ci $pkg_args || {
code=$?
if [ $code -eq 4 ]; then
echo "No tests to run."
exit 0
fi
exit $code
}
# Checks that no_std crates compile without std
check-no-std:
./etc/scripts/ci/check-no-std.sh
# Checks that proof crates compile for a bare-metal FPVM target using nightly
# -Zbuild-std=core,alloc. Requires: rustup toolchain install nightly &&
# rustup component add rust-src --toolchain nightly
check-no-std-proof:
./etc/scripts/ci/check-no-std-proof.sh
# Runs cargo hack against the workspace
hack:
cargo hack check --feature-powerset --no-dev-deps
# Checks formatting
check-format:
cargo +nightly fmt --all -- --check
# Fixes any formatting issues
format-fix:
{{_skip_kernels}} cargo fix --allow-dirty --allow-staged --workspace
cargo +nightly fmt --all
# Checks clippy
check-clippy: build-contracts
{{_skip_kernels}} cargo clippy --workspace --all-targets -- -D warnings
# Checks clippy with ci profile for minimal disk usage
check-clippy-ci: build-contracts
{{_skip_kernels}} cargo clippy --locked --workspace --all-targets --profile ci -- -D warnings
# Fixes any clippy issues
clippy-fix:
{{_skip_kernels}} cargo clippy --workspace --all-targets --fix --allow-dirty --allow-staged
# Builds the workspace with release
build:
cargo build --workspace --release
# Builds all targets in debug mode
build-all-targets: build-contracts
cargo build --workspace --all-targets
# Builds all targets with ci profile (minimal disk usage for CI)
build-ci: build-contracts
cargo build --locked --workspace --all-targets --profile ci
# Builds the workspace with maxperf
build-maxperf:
cargo build --workspace --profile maxperf --features jemalloc
# Builds the base node binary
build-node:
cargo build --bin base-reth-node
# Build the contracts used for tests
build-contracts:
cd crates/utilities/test-utils/contracts && forge soldeer install && forge build
# Cleans the workspace
clean:
cargo clean
# Checks if there are any unused dependencies
check-udeps: build-contracts
@command -v cargo-udeps >/dev/null 2>&1 || cargo install cargo-udeps
{{_skip_kernels}} cargo +nightly udeps --locked --workspace --all-features --all-targets
# Checks crate dependency boundary rules
check-crate-deps:
./etc/scripts/ci/check-crate-deps.sh
# Watches tests
watch-test: build-contracts
cargo watch -x test
# Watches checks
watch-check:
cargo watch -x "fmt --all -- --check" -x "clippy --all-targets -- -D warnings" -x test
# Runs all benchmarks
benches:
@just bench-flashblocks
@just bench-proof-mpt
# Runs flashblocks pending state benchmarks
bench-flashblocks:
cargo bench -p base-flashblocks --bench pending_state
# Runs MPT trie node benchmarks
bench-proof-mpt:
cargo bench -p base-proof-mpt --bench trie_node
# Run basectl with specified config (mainnet, sepolia, devnet, or path)
basectl config="mainnet":
cargo run -p basectl --release -- -c {{config}}