-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
200 lines (169 loc) · 6.36 KB
/
Justfile
File metadata and controls
200 lines (169 loc) · 6.36 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
# 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.
[private]
_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'
# Formatting, clippy, udeps, and deny checks
mod check 'etc/just/check.just'
# Cargo build targets and contract compilation
mod build 'etc/just/build.just'
# SP1 / succinct ELF builds and proving helpers
mod succinct 'etc/just/succinct.just'
# ZK prover gRPC request helpers
mod zk-prover 'etc/just/zk-prover.just'
alias t := test
alias f := fix
alias be := benches
alias c := clean
alias h := hack
alias wt := watch-test
alias wc := watch-check
alias ldc := load-test-continuous
# Default to display help menu
default:
@just --list
# Load test a network in continuous mode (Ctrl-C to stop)
load-test-continuous network='devnet':
just load-test continuous {{ network }}
# 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::all test 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 .
# 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 --locked
# Runs tests across workspace with all features enabled (excludes devnet)
test: install-nextest build::contracts build::elfs
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 build::elfs
#!/usr/bin/env bash
set -euo pipefail
pkg_args_output="$(python3 etc/scripts/local/affected-crates.py {{ base }} --exclude devnet --cargo-args)"
pkg_args=()
while IFS= read -r line; do
[ -n "$line" ] && pkg_args+=("$line")
done <<< "$pkg_args_output"
if [ "${#pkg_args[@]}" -eq 0 ]; then
echo "No affected crates to test."
exit 0
fi
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 -P ci --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
pkg_args_output="$(python3 etc/scripts/local/affected-crates.py {{ base }} --exclude devnet --cargo-args)"
pkg_args=()
while IFS= read -r line; do
[ -n "$line" ] && pkg_args+=("$line")
done <<< "$pkg_args_output"
if [ "${#pkg_args[@]}" -eq 0 ]; then
echo "No affected crates to test."
exit 0
fi
echo "Testing affected crates:${pkg_args[*]}"
cargo nextest run -P ci --locked --all-features --cargo-profile ci "${pkg_args[@]}" || {
code=$?
if [ $code -eq 4 ]; then
echo "No tests to run."
exit 0
fi
exit $code
}
# Runs cargo hack against the workspace
hack:
cargo hack check --feature-powerset --no-dev-deps
# Fixes any formatting issues
format-fix:
{{ _skip_kernels }} BASE_SUCCINCT_ELF_STUB=1 cargo fix --allow-dirty --allow-staged --workspace
cargo +nightly fmt --all
# Fixes any clippy issues
clippy-fix:
{{ _skip_kernels }} BASE_SUCCINCT_ELF_STUB=1 cargo clippy --workspace --all-features --all-targets --fix --allow-dirty --allow-staged
# Cleans the workspace
clean:
cargo clean
# Watches tests
watch-test: build::contracts
cargo watch -x test
# Watches checks
watch-check:
cargo watch -x "fmt --all -- --check" -x "clippy --all-features --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 TUI dashboard
basectl:
cargo run -p basectl --release