-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
120 lines (96 loc) · 3.91 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
default:
@just --list
alias r := run-debug
alias rr := run-release
alias db := docker-build
alias ds := docker-save
alias dl := docker-load
alias dr := docker-run
alias b := build-debug
alias br := build-release
alias f := fmt
alias c := clean
# Bash, fail with undefined vars
set shell := ["bash", "-cu"]
set quiet := true
set dotenv-path := ".env"
env-settings := ".env"
# SP1 just recipies
sp1 *args:
@just --justfile ./zkVM/sp1/justfile {{ args }}
# Install SP1 tooling & more
initial-config-installs:
@just sp1 initial-config-installs
_pre-build:
@just sp1 build-elf
_pre-run:
echo "just pre-run TODO"
# Run in release mode, with optimizations AND debug logs
run-release *FLAGS: _pre-build _pre-run
RUST_LOG=pda_proxy=debug cargo r -r -- {{ FLAGS }}
# Run in debug mode, with extra pre-checks, no optimizations
run-debug *FLAGS: _pre-build _pre-run
# TODO :Check DA node up with some healthcheck endpoint
RUST_LOG=pda_proxy=debug cargo r -- {{ FLAGS }}
# Build docker image & tag
docker-build:
docker build --build-arg BUILDKIT_INLINE_CACHE=1 --tag "$DOCKER_CONTAINER_NAME" --progress=plain .
# Save docker image to a tar.gz
docker-save:
docker save "$DOCKER_CONTAINER_NAME" | gzip > "/tmp/$DOCKER_CONTAINER_NAME-docker.tar.gz"
# Load docker image from tar.gz
docker-load:
gunzip -c "/tmp/$DOCKER_CONTAINER_NAME-docker.tar.gz" | docker load
# Run a pre-built docker image
docker-run:
mkdir -p $PDA_DB_PATH
# Note socket assumes running "normally" with docker managed by root
# TODO: support docker rootless!
# FIXME: better way to share files accross .env file!
docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ./service/static:/app/static \
-v $PDA_DB_PATH:$PDA_DB_PATH \
--env-file {{ env-settings }} \
--env TLS_CERTS_PATH=/app/static/sample.pem --env TLS_KEY_PATH=/app/static/sample.rsa \
--env RUST_LOG=pda_proxy=debug \
--network=host -p $PDA_PORT:$PDA_PORT \
"$DOCKER_CONTAINER_NAME"
# Build in debug mode, no optimizations
build-debug: _pre-build
cargo b
# Build in release mode, includes optimizations
build-release: _pre-build
cargo b -r
# Scrub build artifacts
clean:
cargo clean
# Format source code (Rust, Justfile, and TOMLs)
fmt:
cargo fmt # *.rs
just --quiet --unstable --fmt > /dev/null # justfile
taplo format > /dev/null 2>&1 # *.toml
# Build & open Rustdocs for the workspace
doc:
RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --no-deps --workspace
firefox {{ justfile_directory() }}/target/doc/index.html
# TODO fix snadbox issues with flatpak
# xdg-open {{ justfile_directory() }}/target/doc/index.html
# Launch a local Celestia testnet: Mocha
mocha:
# Assumes you already did init for this & configured
# If not, see https://docs.celestia.org/tutorials/node-tutorial#setting-up-dependencies
celestia light start --core.ip rpc-mocha.pops.one --p2p.network mocha
# Setup and print to stdout, needs to be set in env to be picked up
# See also ./scripts/init_celestia_docker.sh
mocha-local-auth:
celestia light auth admin --p2p.network mocha
# Test blob.Get
curl-blob-get:
curl -H "Content-Type: application/json" -H "Authorization: Bearer $CELESTIA_NODE_WRITE_TOKEN" -X POST --data '{"id": 1,"jsonrpc": "2.0", "method": "blob.Get", "params": [ 42, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAMJ/xGlNMdE=", "aHlbp+J9yub6hw/uhK6dP8hBLR2mFy78XNRRdLf2794=" ] }' 127.0.0.1:3001
# Test blob.Submit
curl-blob-submit:
curl -H "Content-Type: application/json" -H "Authorization: Bearer $CELESTIA_NODE_WRITE_TOKEN" -X POST \
--data '{ "id": 1, "jsonrpc": "2.0", "method": "blob.Submit", "params": [ [ { "namespace": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAMJ/xGlNMdE=", "data": "DEADB33F", "share_version": 0, "commitment": "aHlbp+J9yub6hw/uhK6dP8hBLR2mFy78XNRRdLf2794=", "index": -1 } ], { } ] }' \
https://127.0.0.1:26657 \
--insecure -v