forked from 0xFacet/facet-kona
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
210 lines (171 loc) · 7.08 KB
/
Justfile
File metadata and controls
210 lines (171 loc) · 7.08 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
set positional-arguments
alias t := tests
alias la := lint-all
alias l := lint-native
alias lint := lint-native
alias f := fmt-native-fix
alias b := build-native
alias h := hack
# default recipe to display help information
default:
@just --list
# Run all tests (excluding online tests)
tests: test test-docs
# Test for the native target with all features. By default, excludes online tests.
test *args="-E '!test(test_online)'":
cargo nextest run --workspace --all-features {{args}}
# Run all online tests
test-online:
just test "-E 'test(test_online)'"
# Runs the tests with llvm-cov
llvm-cov-tests:
cargo llvm-cov nextest --locked --workspace --lcov \
--output-path lcov.info --all-features \
--exclude kona-node --exclude kona-p2p --exclude kona-sources \
--ignore-run-fail --profile ci -E '!test(test_online)'
# Runs benchmarks
benches:
cargo bench --no-run --workspace --features test-utils --exclude example-gossip --exclude example-discovery
# Lint the workspace for all available targets
lint-all: lint-native lint-cannon lint-asterisc lint-docs
# Runs `cargo hack check` against the workspace
hack:
cargo hack check --feature-powerset --no-dev-deps
# Fixes the formatting of the workspace
fmt-native-fix:
cargo +nightly fmt --all
# Check the formatting of the workspace
fmt-native-check:
cargo +nightly fmt --all -- --check
# Lint the workspace
lint-native: fmt-native-check lint-docs
cargo clippy --workspace --all-features --all-targets -- -D warnings
# Lint the workspace (mips arch). Currently, only the `kona-std-fpvm` crate is linted for the `cannon` target, as it is the only crate with architecture-specific code.
lint-cannon:
docker run \
--rm \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/op-rs/kona/cannon-builder:0.1.0 cargo clippy -p kona-std-fpvm --all-features -Zbuild-std=core,alloc -- -D warnings
# Lint the workspace (risc-v arch). Currently, only the `kona-std-fpvm` crate is linted for the `asterisc` target, as it is the only crate with architecture-specific code.
lint-asterisc:
docker run \
--rm \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/op-rs/kona/asterisc-builder:0.1.0 cargo clippy -p kona-std-fpvm --all-features -Zbuild-std=core,alloc -- -D warnings
# Lint the Rust documentation
lint-docs:
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
# Test the Rust documentation
test-docs:
cargo test --doc --workspace --locked
# Build for the native target
build-native *args='':
cargo build --workspace $@
# Build target for the `kona-node` docker image.
build-node:
docker build \
--progress plain \
-f docker/apps/kona_app_generic.dockerfile \
--build-arg "BIN_TARGET=kona-node" \
--build-arg "TAG=$(git rev-parse HEAD)" \
-t ghcr.io/op-rs/kona/kona-node:latest \
.
# Build `kona-client` for the `cannon` target.
build-cannon-client:
docker run \
--rm \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/op-rs/kona/cannon-builder:0.1.0 cargo build -Zbuild-std=core,alloc -p kona-client --bin kona --profile release-client-lto
# Build `kona-client` for the `asterisc` target.
build-asterisc-client:
docker run \
--rm \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/op-rs/kona/asterisc-builder:0.1.0 cargo build -Zbuild-std=core,alloc -p kona-client --bin kona --profile release-client-lto
# Check for unused dependencies in the crate graph.
check-udeps:
cargo +nightly udeps --workspace --all-features --all-targets
# Updates the pinned version of the monorepo
update-monorepo:
#!/bin/bash
[ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo
cd monorepo && \
git fetch origin && \
git checkout develop && \
git rev-parse HEAD > ../.config/monorepo
# Clones the Optimism monorepo and checks out the pinned commit
monorepo:
#!/bin/bash
([ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo)
(cd monorepo && git checkout "$(cat ../.config/monorepo)")
# Remove the monorepo directory
clean-monorepo:
rm -rf monorepo/
# Installs the optimism-package repository
optimism-package:
#!/bin/bash
OPTIMISM_PACKAGE_REPO=$(jq -r '.repository' .config/optimism_package.json)
OPTIMISM_PACKAGE_BRANCH=$(jq -r '.branch' .config/optimism_package.json)
([ ! -d optimism-package ] && git clone ${OPTIMISM_PACKAGE_REPO} optimism-package)
(cd optimism-package && git fetch origin && git checkout ${OPTIMISM_PACKAGE_BRANCH})
# Remove the optimism-package directory
clean-optimism-package:
rm -rf optimism-package/
# Spins up kurtosis with the `kona-node` docker image
kurtosis-up:
#!/bin/bash
# Check if the optimism-package directory exists
if [ ! -d optimism-package ]; then
echo "optimism-package directory not found. Installing with `just optimism-package`."
just optimism-package
fi
# Check if the kurtosis command is available
if ! command -v kurtosis &> /dev/null; then
echo "kurtosis command not found. Please install kurtosis."
exit 1
fi
# Run the kurtosis test
(cd optimism-package && kurtosis run . --args-file ../.config/kurtosis_network_params.yaml)
# Winds down kurtosis, cleaning up the network
kurtosis-down:
kurtosis clean -a
# Run action tests for the single-chain client program on the native target
action-tests-single test_name='Test_ProgramAction' *args='':
#!/bin/bash
echo "Setting up monorepo"
just monorepo
echo "Building contract artifacts for the monorepo"
(cd monorepo/packages/contracts-bedrock && forge build)
echo "Building host program for the native target"
just build-native --bin kona-host
export KONA_HOST_PATH="{{justfile_directory()}}/target/debug/kona-host"
# GitHub actions patch - do not print logs.
# https://github.com/gotestyourself/gotestsum/blob/b4b13345fee56744d80016a20b760d3599c13504/testjson/format.go#L442-L444
echo "Running action tests for the client program on the native target"
cd monorepo/op-e2e/actions/proofs && \
GITHUB_ACTIONS=false gotestsum --format=testname -- -run "{{test_name}}" {{args}} -count=1 ./...
# Run action tests for the interop client program on the native target
action-tests-interop test_name='TestInteropFaultProofs' *args='':
#!/bin/bash
echo "Setting up monorepo"
just monorepo
echo "Building contract artifacts for the monorepo"
(cd monorepo/packages/contracts-bedrock && forge build)
echo "Building host program for the native target"
just build-native --bin kona-host
export KONA_HOST_PATH="{{justfile_directory()}}/target/debug/kona-host"
# GitHub actions patch - do not print logs.
# https://github.com/gotestyourself/gotestsum/blob/b4b13345fee56744d80016a20b760d3599c13504/testjson/format.go#L442-L444
echo "Running action tests for the client program on the native target"
cd monorepo/op-e2e/actions/interop && \
GITHUB_ACTIONS=false gotestsum --format=testname -- -run "{{test_name}}" {{args}} -count=1 ./...
# Updates the `superchain-registry` git submodule source
source-registry:
@just --justfile ./crates/protocol/registry/Justfile source
# Generate file bindings for super-registry
bind-registry:
@just --justfile ./crates/protocol/registry/Justfile bind