forked from ordinals/ord
-
Notifications
You must be signed in to change notification settings - Fork 38
/
justfile
229 lines (186 loc) Β· 6.51 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
set positional-arguments
watch +args='test':
cargo watch --clear --exec '{{args}}'
ci: clippy forbid
cargo fmt -- --check
cargo test --all
cargo test --all -- --ignored
forbid:
./bin/forbid
fmt:
cargo fmt --all
clippy:
cargo clippy --all --all-targets -- -D warnings
deploy branch remote chain domain:
ssh root@{{domain}} "mkdir -p deploy \
&& apt-get update --yes \
&& apt-get upgrade --yes \
&& apt-get install --yes git rsync"
rsync -avz deploy/checkout root@{{domain}}:deploy/checkout
ssh root@{{domain}} 'cd deploy && ./checkout {{branch}} {{remote}} {{chain}} {{domain}}'
deploy-mainnet-balance branch="master" remote="ordinals/ord": (deploy branch remote "main" "balance.ordinals.net")
deploy-mainnet-equilibrium branch="master" remote="ordinals/ord": (deploy branch remote "main" "equilibrium.ordinals.net")
deploy-mainnet-stability branch="master" remote="ordinals/ord": (deploy branch remote "main" "stability.ordinals.net")
deploy-signet branch="master" remote="ordinals/ord": (deploy branch remote "signet" "signet.ordinals.net")
deploy-testnet branch="master" remote="ordinals/ord": (deploy branch remote "test" "testnet.ordinals.net")
deploy-regtest branch="master" remote="ordinals/ord": (deploy branch remote "regtest" "regtest.ordinals.net")
save-ord-dev-state domain="ordinals-dev.com":
$EDITOR ./deploy/save-ord-dev-state
scp ./deploy/save-ord-dev-state root@{{domain}}:~
ssh root@{{domain}} "./save-ord-dev-state"
log unit="ord" domain="ordinals.net":
ssh root@{{domain}} 'journalctl -fu {{unit}}'
test-deploy:
ssh-keygen -f ~/.ssh/known_hosts -R 192.168.56.4
vagrant up
ssh-keyscan 192.168.56.4 >> ~/.ssh/known_hosts
rsync -avz \
--delete \
--exclude .git \
--exclude target \
--exclude .vagrant \
--exclude index.redb \
. [email protected]:ord
ssh [email protected] 'cd ord && ./deploy/setup'
time-tests:
cargo +nightly test -- -Z unstable-options --report-time
profile-tests:
cargo +nightly test -- -Z unstable-options --report-time \
| sed -n 's/^test \(.*\) ... ok <\(.*\)s>/\2 \1/p' | sort -n \
| tee test-times.txt
fuzz:
#!/usr/bin/env bash
set -euxo pipefail
cd fuzz
while true; do
cargo +nightly fuzz run transaction-builder -- -max_total_time=60
cargo +nightly fuzz run runestone-decipher -- -max_total_time=60
cargo +nightly fuzz run varint-decode -- -max_total_time=60
cargo +nightly fuzz run varint-encode -- -max_total_time=60
done
decode txid:
bitcoin-cli getrawtransaction {{txid}} | xxd -r -p - | cargo run decode
open:
open http://localhost
doc:
cargo doc --all --open
prepare-release revision='master':
#!/usr/bin/env bash
set -euxo pipefail
git checkout {{ revision }}
git pull origin {{ revision }}
echo >> CHANGELOG.md
git log --pretty='format:- %s' >> CHANGELOG.md
$EDITOR CHANGELOG.md
$EDITOR Cargo.toml
VERSION=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1`
cargo check
git checkout -b release-$VERSION
git add -u
git commit -m "Release $VERSION"
gh pr create --web
publish-release revision='master':
#!/usr/bin/env bash
set -euxo pipefail
rm -rf tmp/release
git clone https://github.com/ordinals/ord.git tmp/release
cd tmp/release
git checkout {{ revision }}
cargo publish
cd ../..
rm -rf tmp/release
publish-tag-and-crate revision='master':
#!/usr/bin/env bash
set -euxo pipefail
rm -rf tmp/release
git clone [email protected]:ordinals/ord.git tmp/release
cd tmp/release
git checkout {{revision}}
VERSION=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1`
git tag -a $VERSION -m "Release $VERSION"
git push [email protected]:ordinals/ord.git $VERSION
cargo publish
cd ../..
rm -rf tmp/release
list-outdated-dependencies:
cargo outdated -R
cd test-bitcoincore-rpc && cargo outdated -R
update-modern-normalize:
curl \
https://raw.githubusercontent.com/sindresorhus/modern-normalize/main/modern-normalize.css \
> static/modern-normalize.css
download-log unit='ord' host='ordinals.net':
ssh root@{{host}} 'mkdir -p tmp && journalctl -u {{unit}} > tmp/{{unit}}.log'
rsync --progress --compress root@{{host}}:tmp/{{unit}}.log tmp/{{unit}}.log
download-index unit='ord' host='ordinals.net':
rsync --progress --compress root@{{host}}:/var/lib/{{unit}}/index.redb tmp/{{unit}}.index.redb
graph log:
./bin/graph $1
flamegraph dir=`git branch --show-current`:
./bin/flamegraph $1
benchmark index height-limit:
./bin/benchmark $1 $2
benchmark-revision rev:
ssh [email protected] "mkdir -p benchmark \
&& apt-get update --yes \
&& apt-get upgrade --yes \
&& apt-get install --yes git rsync"
rsync -avz benchmark/checkout [email protected]:benchmark/checkout
ssh [email protected] 'cd benchmark && ./checkout {{rev}}'
benchmark-branch branch:
#/usr/bin/env bash
# rm -f master.redb
rm -f {{branch}}.redb
# git checkout master
# cargo build --release
# time ./target/release/ord --index master.redb index update
# ll master.redb
git checkout {{branch}}
cargo build --release
time ./target/release/ord --index {{branch}}.redb index update
ll {{branch}}.redb
build-snapshots:
#!/usr/bin/env bash
set -euxo pipefail
rm -rf tmp/snapshots
mkdir -p tmp/snapshots
cargo build --release
cp ./target/release/ord tmp/snapshots
cd tmp/snapshots
for start in {0..750000..50000}; do
height_limit=$((start+50000))
if [[ -f $start.redb ]]; then
cp -c $start.redb index.redb
fi
a=`date +%s`
time ./ord --data-dir . --height-limit $height_limit index
b=`date +%s`
mv index.redb $height_limit.redb
printf "$height_limit\t$((b - a))\n" >> time.txt
done
serve-docs: build-docs
open http://127.0.0.1:8080
python3 -m http.server --directory docs/build/html --bind 127.0.0.1 8080
build-docs:
#!/usr/bin/env bash
mdbook build docs -d build
for lang in "de" "fr" "es" "pt" "ru" "zh" "ja" "ko" "fil" "ar" "hi" "it"; do
MDBOOK_BOOK__LANGUAGE=$lang \
mdbook build docs -d build/$lang
mv docs/build/$lang/html docs/build/html/$lang
done
update-changelog:
echo >> CHANGELOG.md
git log --pretty='format:- %s' >> CHANGELOG.md
preview-examples:
cargo run preview examples/*
convert-logo-to-favicon:
convert -background none -resize 256x256 logo.svg static/favicon.png
update-mdbook-theme:
curl https://raw.githubusercontent.com/rust-lang/mdBook/v0.4.35/src/theme/index.hbs > docs/theme/index.hbs
audit-cache:
cargo run --package audit-cache
coverage:
cargo llvm-cov
benchmark-server:
cargo bench --bench server