Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
175 lines (130 loc) · 5.34 KB
/
Copy pathjustfile
File metadata and controls
175 lines (130 loc) · 5.34 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
# === Config ===
integration_test_dir := justfile_directory() / ".scratch/integration_tests"
integration_test_base_url := "https://tycho-test.broxus.cc"
local_network_dir := justfile_directory() / ".temp"
# === Simple commands ===
default:
@just --choose
# Installs the node.
install:
./scripts/install.sh
# Installs the required version of `rustfmt`.
install_fmt:
rustup component add rustfmt --toolchain nightly
# Installs the required version of links checker. See https://github.com/lycheeverse/lychee.
install_lychee:
cargo install lychee
# Creates venv and installs all required script dependencies.
install_python_deps:
./scripts/install-python-deps.sh
# Formats the whole project.
fmt: install_fmt
cargo +nightly fmt --all
# CI checks.
ci: check_dev_docs check_format lint test test_docs
# Checks links in the `/docs` directory.
check_dev_docs:
lychee {{ justfile_directory() }}/docs
# Checks whether the code is formatted.
check_format: install_fmt
cargo +nightly fmt --all -- --check
# Clippy go brr.
lint:
cargo clippy --all-targets --workspace $(cargo metadata --format-version=1 | jq -r '.packages[] | select(.source == null) | . as $pkg | .features | to_entries[] | select((.key | test("default|deadlock-detection")) | not) | "-F \($pkg.name)/\(.key)"' | tr '\n' ' ') -- -D warnings
# Generates cargo docs.
docs:
export RUSTDOCFLAGS=-D warnings
cargo doc --no-deps --document-private-items --workspace $(cargo metadata --format-version=1 | jq -r '.packages[] | select(.source == null) | . as $pkg | .features | to_entries[] | select((.key | test("default|deadlock-detection")) | not) | "-F \($pkg.name)/\(.key)"' | tr '\n' ' ')
# Runs all tests.
test:
cargo nextest run --workspace --features test,s3
# Tests documentation examples.
test_docs:
cargo test --doc --workspace
test_cov:
#!/usr/bin/env bash
set -euo pipefail
export RUSTC_WRAPPER=scripts/coverage.py
export RUST_LOG=warn
if [ -n "${CI:-}" ]; then
# Running in GitHub Actions
cargo llvm-cov nextest --codecov --output-path codecov.json --workspace --features test
else
# Running locally
cargo llvm-cov nextest --open --workspace --features test
fi
check_dashboard:
./scripts/run-py.sh ./scripts/check-metrics.py
# Generates a Grafana panel JSON.
gen_dashboard:
#!/usr/bin/env bash
if ! [ -d ".venv" ]; then
./scripts/install-python-deps.sh
fi
/usr/bin/env python ./scripts/gen-dashboard.py
fmt_py:
./scripts/run-py.sh -m ruff format .
check_format_py:
./scripts/run-py.sh -m ruff format --check .
update_rpc_proto:
cargo run -p tycho-gen-protos
update_cli_reference:
CI=true cargo run --bin tycho -- util markdown-help > docs/cli-reference.md
# Runs fuzzing for external message validation. Example: just fuzz_ext_msg -- -max_total_time=60
fuzz_ext_msg *flags:
cargo +nightly fuzz run ext_msg --fuzz-dir block-util/fuzz {{ flags }}
# === Integration tests stuff ===
# Runs all tests including ignored. Will take a lot of time to run.
run_integration_tests: prepare_integration_tests
./scripts/run-integration-tests.sh
# Synchronizes files for integration tests.
prepare_integration_tests:
./scripts/prepare-integration-tests.sh \
--dir {{ integration_test_dir }} \
--base-url {{ integration_test_base_url }}
# Repacks files for integration tests.
repack_heavy_archives:
./scripts/repack-heavy-archives.sh \
--dir {{ integration_test_dir }}
# Removes all files for integration tests.
clean_integration_tests:
rm -rf {{ integration_test_dir }}
# === Local network stuff ===
# Builds the node and prints a path to the binary. Use `TYCHO_BUILD_PROFILE` env to explicitly set cargo profile.
build *flags:
./scripts/build-node.sh {{ flags }}
# Creates a node config template with all defaults. Use `--force` to overwrite.
init_node_config *flags:
./scripts/init-node-config.sh {{ flags }}
# Creates a zerostate config template with all defaults. Use `--force` to overwrite.
init_zerostate_config *flags:
./scripts/init-zerostate-config.sh {{ flags }}
# Creates a network of `N` nodes. Use `--force` to reset the state.
gen_network *flags:
./scripts/gen-network.sh --dir {{ local_network_dir }} {{ flags }}
# Runs the node `N`.
# Use `--mempool-start-round {round_id} --from-mc-block-seqno {seqno}`
# to define last applied mc block and processed to anchor id.
node *flags:
./scripts/run-node.sh --dir {{ local_network_dir }} {{ flags }}
# Participates in elections from the node `N`.
elect *flags:
./scripts/elect-node.sh --dir {{ local_network_dir }} {{ flags }}
# Runs only mempool part of the node `N`.
# Use `--mempool-start-round {round_id}`
# to define new mempool genesis at non-default round
mempool *flags:
./scripts/run-mempool.sh --dir {{ local_network_dir }} {{ flags }}
# Dumps necessary part 01 of test data from the local running network:
# zerostate, initial state of shard 0:80,
# first empty master block and it's queue diff
dump_test_data_01:
./scripts/dump-test-data-01.sh
# Dumps necessary part 02 of test data from the local running network under load:
# not empty block from shard 0:80
dump_test_data_02:
./scripts/dump-test-data-02.sh
# Dumps necessary part 03 of test data from the local running network under load:
# first 3 archives
dump_test_data_03:
./scripts/dump-test-data-03.sh