-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathMakefile
More file actions
235 lines (174 loc) · 9.26 KB
/
Makefile
File metadata and controls
235 lines (174 loc) · 9.26 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
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# -- variables --------------------------------------------------------------------------------------
ALL_FEATURES_EXCEPT_ROCKSDB="concurrent executable internal serde std"
MIDEN_STARK_TEST_PACKAGES=-p miden-lifted-air -p miden-lifted-stark -p miden-stateful-hasher -p miden-stark-transcript
WARNINGS=RUSTDOCFLAGS="-D warnings"
# -- linting --------------------------------------------------------------------------------------
.PHONY: clippy
clippy: ## Run Clippy with configs (alias for xclippy)
cargo xclippy
.PHONY: xclippy
xclippy: ## Run Clippy with the curated workspace lint set
cargo xclippy
.PHONY: fix
fix: ## Run Fix with configs (alias for xclippy-fix)
cargo xclippy-fix
.PHONY: xclippy-fix
xclippy-fix: ## Run Clippy with --fix using the same lint set as xclippy
cargo xclippy-fix
.PHONY: format
format: ## Run Format using nightly toolchain
cargo +nightly fmt --all
.PHONY: format-check
format-check: ## Run Format using nightly toolchain but only in check mode
cargo +nightly fmt --all --check
.PHONY: shear
shear: ## Runs cargo-shear to find unused or misplaced dependencies
cargo shear --deny-warnings
.PHONY: toml
toml: ## Runs Format for all TOML files
taplo fmt
.PHONY: toml-check
toml-check: ## Runs Format for all TOML files but only in check mode
taplo fmt --check --verbose
.PHONY: typos-check
typos-check: ## Runs spellchecker
typos
.PHONY: workspace-check
workspace-check: ## Runs a check that all packages have `lints.workspace = true`
cargo workspace-lints
.PHONY: cargo-deny
cargo-deny: ## Run cargo-deny to check dependencies for security vulnerabilities and license compliance
cargo deny check
.PHONY: zeroize-audit
zeroize-audit: ## Run Zeroize audit using rustdoc JSON
cargo +nightly rustdoc -p miden-crypto --all-features -- -Zunstable-options --output-format json --document-private-items
@target_dir="$${CARGO_TARGET_DIR:-target}"; \
if [ "$$target_dir" = "/" ]; then target_dir=target; fi; \
cargo run --quiet --manifest-path tools/zeroize-audit/Cargo.toml -- "$$target_dir/doc/miden_crypto.json"
.PHONY: lint
lint: clippy fix format toml typos-check shear cargo-deny ## Run all linting tasks at once (Clippy, fixing, formatting, cargo-shear, cargo-deny)
# --- docs ----------------------------------------------------------------------------------------
.PHONY: doc
doc: ## Generate and check documentation for workspace crates only
rm -rf "${CARGO_TARGET_DIR:-target}/doc"
RUSTDOCFLAGS="--enable-index-page -Zunstable-options -D warnings" cargo +nightly doc --all-features --keep-going --release --no-deps
# --- testing -------------------------------------------------------------------------------------
.PHONY: test-default
test-default: ## Run tests with default features
cargo nextest run --profile default --cargo-profile test-release --features ${ALL_FEATURES_EXCEPT_ROCKSDB}
.PHONY: test-no-std
test-no-std: ## Run tests with `no-default-features` (std)
cargo nextest run --profile default --cargo-profile test-release --no-default-features
.PHONY: test-smt-concurrent
test-smt-concurrent: ## Run only concurrent SMT tests
cargo nextest run --profile smt-concurrent --cargo-profile test-release
.PHONY: test-docs
test-docs:
cargo test --doc --all-features --profile test-release
.PHONY: test-p3-parallel
test-p3-parallel: ## Run Miden STARK crate tests with the parallel feature enabled
cargo test $(MIDEN_STARK_TEST_PACKAGES) -F miden-lifted-stark/parallel
.PHONY: test-large-smt
test-large-smt: ## Run large SMT unit tests and RocksDB integration tests
cargo nextest run --success-output immediate --profile large-smt --cargo-profile test-release --features rocksdb
.PHONY: test
test: test-default test-no-std test-docs test-large-smt ## Run all tests except concurrent SMT tests
# --- checking ------------------------------------------------------------------------------------
.PHONY: check
check: ## Check all targets and features for errors without code generation
cargo check --all-targets --all-features
.PHONY: check-features
check-features: ## Check curated feature combinations across the integrated workspace
./scripts/check-features.sh
.PHONY: check-fuzz
check-fuzz: ## Check fuzz crate compilation
cd miden-crypto-fuzz && cargo check --locked
cd miden-serde-utils/fuzz && cargo check --locked
# --- building ------------------------------------------------------------------------------------
.PHONY: build
build: ## Build with default features enabled
cargo build --release
.PHONY: build-no-std
build-no-std: ## Build without the standard library
cargo build --release --no-default-features --target wasm32-unknown-unknown
.PHONY: build-target-miden
build-target-miden: ## Build `miden-field` for wasm32-wasip2 with `--cfg miden`
RUSTFLAGS="$${RUSTFLAGS:+$$RUSTFLAGS }--cfg miden" cargo build --release -p miden-field --target wasm32-wasip2
.PHONY: build-avx2
build-avx2: ## Build with avx2 support
RUSTFLAGS="-C target-feature=+avx2" cargo build --release
.PHONY: build-avx512
build-avx512: ## Build with avx512 support
RUSTFLAGS="-C target-feature=+avx512f,+avx512dq" cargo build --release
.PHONY: build-sve
build-sve: ## Build with sve support
RUSTFLAGS="-C target-feature=+sve" cargo build --release
# --- benchmarking --------------------------------------------------------------------------------
.PHONY: bench
bench: ## Run crypto benchmarks
cargo bench --features concurrent
.PHONY: bench-smt-concurrent
bench-smt-concurrent: ## Run SMT benchmarks with concurrent feature
cargo run --bin miden-crypto --release --features concurrent,executable -- --size 1000000
.PHONY: bench-large-smt-memory
bench-large-smt-memory: ## Run large SMT benchmarks with memory storage
cargo run --bin miden-crypto --release --features concurrent,executable -- --size 1000000
.PHONY: bench-large-smt-rocksdb
bench-large-smt-rocksdb: ## Run large SMT benchmarks with rocksdb storage
cargo run --bin miden-crypto --release --features concurrent,rocksdb,executable -- --storage rocksdb --size 1000000
.PHONY: bench-large-smt-rocksdb-open
bench-large-smt-rocksdb-open: ## Run large SMT benchmarks with rocksdb storage and open existing database
cargo run --bin miden-crypto --release --features concurrent,rocksdb,executable -- --storage rocksdb --open
# --- fuzzing --------------------------------------------------------------------------------
.PHONY: fuzz-smt
fuzz-smt: ## Run fuzzing for SMT (sequential vs parallel consistency)
cargo +nightly fuzz run smt --release --fuzz-dir miden-crypto-fuzz -- -max_len=10485760
.PHONY: fuzz-word
fuzz-word: ## Run fuzzing for Word serialization
cargo +nightly fuzz run word --release --fuzz-dir miden-crypto-fuzz
.PHONY: fuzz-merkle
fuzz-merkle: ## Run fuzzing for Merkle tree serialization
cargo +nightly fuzz run merkle --release --fuzz-dir miden-crypto-fuzz
.PHONY: fuzz-merkle-store
fuzz-merkle-store: ## Run fuzzing for MerkleStore deserialization
cargo +nightly fuzz run merkle_store --release --fuzz-dir miden-crypto-fuzz
.PHONY: fuzz-smt-serde
fuzz-smt-serde: ## Run fuzzing for SMT serialization
cargo +nightly fuzz run smt_serde --release --fuzz-dir miden-crypto-fuzz
.PHONY: fuzz-partial-smt
fuzz-partial-smt: ## Run fuzzing for PartialSmt deserialization
cargo +nightly fuzz run partial_smt --release --fuzz-dir miden-crypto-fuzz
.PHONY: fuzz-mmr
fuzz-mmr: ## Run fuzzing for MMR structures serialization
cargo +nightly fuzz run mmr --release --fuzz-dir miden-crypto-fuzz
.PHONY: fuzz-crypto
fuzz-crypto: ## Run fuzzing for cryptographic types serialization
cargo +nightly fuzz run crypto --release --fuzz-dir miden-crypto-fuzz
.PHONY: fuzz-aead
fuzz-aead: ## Run fuzzing for AEAD decryption paths
cargo +nightly fuzz run aead --release --fuzz-dir miden-crypto-fuzz
.PHONY: fuzz-signatures
fuzz-signatures: ## Run fuzzing for DSA signature deserialization
cargo +nightly fuzz run signatures --release --fuzz-dir miden-crypto-fuzz
# --- installing ----------------------------------------------------------------------------------
.PHONY: check-tools
check-tools: ## Checks if development tools are installed
@echo "Checking development tools..."
@command -v typos >/dev/null 2>&1 && echo "[OK] typos is installed" || echo "[MISSING] typos is not installed (run: make install-tools)"
@command -v cargo nextest >/dev/null 2>&1 && echo "[OK] nextest is installed" || echo "[MISSING] nextest is not installed (run: make install-tools)"
@command -v taplo >/dev/null 2>&1 && echo "[OK] taplo is installed" || echo "[MISSING] taplo is not installed (run: make install-tools)"
@command -v cargo-shear >/dev/null 2>&1 && echo "[OK] cargo-shear is installed" || echo "[MISSING] cargo-shear is not installed (run: make install-tools)"
@command -v cargo deny >/dev/null 2>&1 && echo "[OK] cargo-deny is installed" || echo "[MISSING] cargo-deny is not installed (run: make install-tools)"
.PHONY: install-tools
install-tools: ## Installs development tools required by the Makefile (typos, nextest, taplo, cargo-shear, cargo-deny)
@echo "Installing development tools..."
cargo install typos-cli --locked
cargo install cargo-nextest --locked
cargo install taplo-cli --locked
cargo install cargo-shear --locked
cargo install cargo-deny --locked
@echo "Development tools installation complete!"