-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathjustfile
242 lines (202 loc) · 8.19 KB
/
justfile
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
# display a help message about available commands
default:
@just --list --unsorted
# run tests in all packages or a specific package
test package='':
@if [[ "{{package}}" == "" ]]; then \
just _test-package bolt-cli; \
just _test-package bolt-boost; \
just _test-package bolt-sidecar; \
else \
just _test-package {{package}}; \
fi
# run tests in a specific package using nextest
_test-package package:
cd {{ package }} && cargo nextest run
# lint all packages
lint:
@just clippy bolt-cli
@just clippy bolt-boost
@just clippy bolt-sidecar
# lint a package by name
clippy package:
cd {{ package }} && cargo clippy --all-targets --all-features -- -D warnings
# spin up the bolt devnet
up:
chmod +x ./scripts/start-devnet.sh
./scripts/start-devnet.sh
# turn down the bolt devnet and remove the enclave
down:
kurtosis enclave rm -f bolt-devnet
# remove all kurtosis data and stop the engine
clean:
kurtosis clean --all
kurtosis engine stop
# restart the bolt devnet with updated docker images
restart:
@just down
@just build-images
@just up
# show the running containers and port mappings for the bolt devnet
inspect:
kurtosis enclave inspect bolt-devnet
# format a rust crate. Must be run from the root of the crate's cargo directory
fmt crate:
rustup toolchain install nightly-2024-10-03 > /dev/null 2>&1 && \
cd $(git rev-parse --show-toplevel)/{{crate}} && \
cargo +nightly-2024-10-03 fmt
[private]
bash service:
@id=$(docker ps -n 100 | grep {{ service }} | awk -F' ' '{print $1}') && \
docker exec -it $id bash
[private]
log service:
@id=$(docker ps -n 100 | grep {{ service }} | awk -F' ' '{print $1}') && \
docker logs -f $id
[private]
dump service:
@id=$(docker ps -n 100 | grep {{ service }} | awk -F' ' '{print $1}') && \
docker logs $id 2>&1 | tee {{ service }}_dump.log
# show the logs for the bolt devnet relay
relay-logs:
@just log helix-relay
# show the logs for the bolt devnet builder
builder-logs:
@just log bolt-builder
# show the logs for the bolt devnet bolt-boost sidecar
boost-logs:
@just log bolt-boost
# show the logs for the bolt devnet mev-boost sidecar
mev-boost-logs:
@just log bolt-mev-boost
# show the logs for the bolt devnet bolt-sidecar
sidecar-logs:
@just log sidecar
# show the logs for the bolt devnet for beacon node
beacon-logs:
@just log 'cl-1-lighthouse-geth'
# dump the logs for the bolt devnet for beacon node to a _dump.log file
beacon-dump:
@just dump 'cl-1-lighthouse-geth'
# dump the logs for the bolt devnet relay to a _dump.log file
relay-dump:
@just dump mev-relay-api
# dump the logs for the bolt devnet builder to a _dump.log file
builder-dump:
@just dump bolt-builder
# dump the logs for the bolt devnet mev-boost sidecar to a _dump.log file
boost-dump:
@just dump bolt-mev-boost
# dump the logs for the bolt devnet bolt-sidecar to a _dump.log file
sidecar-dump:
@just dump sidecar
# stop the bolt devnet builder container, useful for testing reliability
kill-builder:
@id=$(docker ps -n 100 | grep bolt-builder | awk -F' ' '{print $1}') && \
docker stop $id
# show the dora explorer in the browser. NOTE: works only for Linux and MacOS
dora:
@url=$(just inspect | grep 'dora\s*http' | awk -F'-> ' '{print $2}' | awk '{print $1}') && \
if [ "$(uname)" = "Darwin" ]; then \
open "$url"; \
else \
xdg-open "$url"; \
fi
# show the grafana dashboard in the browser. NOTE: works only for Linux and MacOS
grafana:
@url=$(just inspect | grep 'grafana\s*http' | awk -F'-> ' '{print $2}' | awk '{print $1}') && \
if [ "$(uname)" = "Darwin" ]; then \
open "$url"; \
else \
xdg-open "$url"; \
fi
# manually send a preconfirmation to the bolt devnet
send-preconf count='1':
cd bolt-cli && RUST_LOG=info cargo run -- send \
--devnet \
--devnet.execution_url $(kurtosis port print bolt-devnet el-1-geth-lighthouse rpc) \
--devnet.beacon_url $(kurtosis port print bolt-devnet cl-1-lighthouse-geth http) \
--devnet.sidecar_url http://$(kurtosis port print bolt-devnet bolt-sidecar-1-lighthouse-geth api) \
--private-key 53321db7c1e331d93a11a41d16f004d7ff63972ec8ec7c25db329728ceeb1710 \
--max-fee 4 \
--priority-fee 3 \
--count {{count}}
send-preconf-rpc count='1' rpc='http://127.0.0.1:8015/rpc':
cd bolt-cli && RUST_LOG=info cargo run -- send \
--devnet \
--devnet.execution_url $(kurtosis port print bolt-devnet el-1-geth-lighthouse rpc) \
--devnet.beacon_url $(kurtosis port print bolt-devnet cl-1-lighthouse-geth http) \
--devnet.sidecar_url {{ rpc }} \
--private-key 53321db7c1e331d93a11a41d16f004d7ff63972ec8ec7c25db329728ceeb1710 \
--max-fee 4 \
--priority-fee 3 \
--count {{count}}
# manually send a blob preconfirmation to the bolt devnet
send-blob-preconf count='1':
cd bolt-cli && RUST_LOG=info cargo run -- send \
--devnet \
--devnet.execution_url $(kurtosis port print bolt-devnet el-1-geth-lighthouse rpc) \
--devnet.beacon_url $(kurtosis port print bolt-devnet cl-1-lighthouse-geth http) \
--devnet.sidecar_url http://$(kurtosis port print bolt-devnet bolt-sidecar-1-lighthouse-geth api) \
--private-key 53321db7c1e331d93a11a41d16f004d7ff63972ec8ec7c25db329728ceeb1710 \
--blob \
--max-fee 4 \
--priority-fee 3 \
--count {{count}}
send-blob-preconf-rpc count='1' rpc='http://127.0.0.1:8015/rpc':
cd bolt-cli && RUST_LOG=info cargo run -- send \
--devnet \
--devnet.execution_url $(kurtosis port print bolt-devnet el-1-geth-lighthouse rpc) \
--devnet.beacon_url $(kurtosis port print bolt-devnet cl-1-lighthouse-geth http) \
--devnet.sidecar_url {{ rpc }} \
--private-key 53321db7c1e331d93a11a41d16f004d7ff63972ec8ec7c25db329728ceeb1710 \
--blob \
--max-fee 4 \
--priority-fee 3 \
--count {{count}}
# build all the docker images locally
build-local-images:
@just build-local-sidecar
@just build-local-bolt-boost
# build the docker image for the bolt sidecar
[private]
build-local-sidecar:
cd bolt-sidecar && docker build -t ghcr.io/chainbound/bolt-sidecar:0.1.0 . --load
# build the docker image for bolt-boost
[private]
build-local-bolt-boost:
cd bolt-boost && docker build -t ghcr.io/chainbound/bolt-boost:0.1.0 . --load
# Cross platform compilation with cargo cross.
# Install cross with: `cargo install cross --git https://github.com/cross-rs/cross`.
#
# Troubleshooting tips:
# * We have to clean the target directory before building for different targets because
# of a rustc incremental compilation bug. See: https://github.com/cross-rs/cross/issues/724#issuecomment-1484065725
# * If incurring into issues related to building `aws-lc-rs`, check this out:
# https://github.com/cross-rs/cross/issues/1565#issuecomment-2483968180
# * If incurring into issues related to building `sha2-asm`, make sure the "sha2-asm" feature
# is disabled in the `Cargo.toml` file you are trying to build.
#
# build the cross platform binaries for a package by name. available: "bolt-sidecar", "bolt-boost".
[private]
cross-compile package target_arch release_dir:
cd {{package}} && cargo clean && cross build --release --target {{target_arch}}
mkdir -p dist/bin/{{release_dir}}
cp {{package}}/target/{{target_arch}}/release/{{package}} dist/bin/{{release_dir}}
# build and push multi-platform docker images to GHCR for a package. available: "bolt-sidecar", "bolt-boost".
build-and-push-image package tag:
@just cross-compile {{package}} x86_64-unknown-linux-gnu amd64
@just cross-compile {{package}} aarch64-unknown-linux-gnu arm64
docker buildx build \
--build-arg BINARY={{package}} \
--file ./{{package}}/Cross.Dockerfile \
--platform linux/amd64,linux/arm64 \
--tag ghcr.io/chainbound/{{package}}:{{tag}} \
--push .
# build and push all the available packages to GHCR with the provided tag
build-and-push-all-images tag='latest':
@just build-and-push-image bolt-sidecar {{tag}}
@just build-and-push-image bolt-boost {{tag}}
# Create tarballs for the bolt-cli binaries for all the supported platforms
create-bolt-cli-tarballs:
chmod +x ./scripts/bolt-cli-tarballs.sh && ./scripts/bolt-cli-tarballs.sh