Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
122 lines (94 loc) · 4.87 KB
/
Copy pathjustfile
File metadata and controls
122 lines (94 loc) · 4.87 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
set shell := ["bash", "-euo", "pipefail", "-c"]
# Nested justfiles as modules: `just watchdog <r>`, `just canonical <r>`,
# `just bench <r>` (also `just <mod> --list`). The curated recipes below are
# top-level shortcuts for the common cross-cutting operations.
mod watchdog 'watchdog/justfile'
mod canonical 'examples/canonical-app/justfile'
mod bench 'tests/benchmarks/justfile'
# ── Devnet dependency pins ───────────────────────────────────────────
# The pre-deployed Anvil state published by the rollups-contracts release,
# plus the forge-built MockERC20 fixture. Consumed by tests/harness — and
# through it e2e, benchmarks, and the watchdog compare harness — so the
# setup recipe lives here at the root; the versions come from toolchain-pins.env.
rollups_contracts_version := `grep '^ROLLUPS_CONTRACTS_VERSION=' toolchain-pins.env | cut -d= -f2`
anvil_version := `sed -n 's/^FOUNDRY_VERSION=v//p' toolchain-pins.env`
anvil_dump_name := "cartesi-rollups-contracts-" + rollups_contracts_version + "-anvil-" + anvil_version
anvil_dump_dir := "tests/.deps/" + anvil_dump_name
anvil_dump_tar := "tests/.deps/" + anvil_dump_name + ".tar.gz"
anvil_dump_url := "https://github.com/cartesi/rollups-contracts/releases/download/v" + rollups_contracts_version + "/" + anvil_dump_name + ".tar.gz"
root_anvil_dump_tar := anvil_dump_name + ".tar.gz"
# The release publishes no checksum file, so the hash is pinned here
# (trust-on-first-use, same model as toolchain-pins.env) to catch a
# replaced/corrupted release asset.
anvil_dump_sha256 := "fb38dc6e1faf238a152453dfd351ae5899d99fd35e9c675b4dce97cd6b05a68b"
default:
@just --list
check:
cargo check --workspace
check-all-targets:
cargo check --workspace --all-targets
test:
cargo test --workspace
test-watchdog:
just watchdog test
test-watchdog-e2e:
just watchdog test-e2e
# Build the watchdog's vendored native Lua modules (lcurl, lfs) into .deps/lua.
watchdog-lua-deps:
@just watchdog lua-deps
# Anvil + rollups + wallet-sequencer-devnet; prints CARTESI_WATCHDOG_* exports until Ctrl+C.
devnet-for-watchdog: setup ensure-machine-image
cargo build -p wallet-sequencer --bin wallet-sequencer-devnet
cargo build -p rollups-e2e --bin devnet-stack
cargo run -p rollups-e2e --bin devnet-stack
test-watchdog-compare-harness: setup watchdog-lua-deps ensure-machine-image
cargo build -p wallet-sequencer --bin wallet-sequencer-devnet -p rollups-e2e --bin rollups-e2e
cargo run -p rollups-e2e --bin rollups-e2e -- watchdog_genesis_compare_test --exact --nocapture
# Run the sequencer crate's tests.
test-sequencer:
cargo test -p sequencer
test-rollups-e2e: setup ensure-machine-image ensure-sepolia-machine-image
cargo build -p wallet-sequencer --bin wallet-sequencer-devnet -p c-wallet-engine --bin c-wallet-genesis -p c-wallet-sequencer --bin c-wallet-sequencer -p rollups-e2e --bin rollups-e2e
cargo run -p rollups-e2e --bin rollups-e2e
ensure-machine-image:
@test -d examples/canonical-app/out/canonical-machine-image || just canonical build-machine-image
ensure-sepolia-machine-image:
@test -d examples/canonical-app/out/canonical-machine-image-sepolia || just canonical build-machine-image-sepolia
# Rollups-contracts anvil dump (SHA256-verified) + tests/contracts fixtures.
setup-devnet-deps:
@mkdir -p tests/.deps
@if [[ ! -f {{anvil_dump_tar}} ]]; then if [[ -f {{root_anvil_dump_tar}} ]]; then cp {{root_anvil_dump_tar}} {{anvil_dump_tar}}; else wget {{anvil_dump_url}} -O {{anvil_dump_tar}}; fi; fi
@echo "{{anvil_dump_sha256}} {{anvil_dump_tar}}" | shasum -a 256 -c - >/dev/null || { echo "SHA256 mismatch for {{anvil_dump_tar}} — delete it and re-run 'just setup'"; exit 1; }
@if [[ ! -f {{anvil_dump_dir}}/state.json ]]; then rm -rf {{anvil_dump_dir}}; mkdir -p {{anvil_dump_dir}}; tar -xzf {{anvil_dump_tar}} -C {{anvil_dump_dir}}; fi
forge build --root tests/contracts
setup:
just canonical download-deps
just setup-devnet-deps
just watchdog-lua-deps
doctor:
just watchdog doctor
canonical-build-machine-image:
just canonical build-machine-image
canonical-build-machine-image-sepolia:
just canonical build-machine-image-sepolia
canonical-test-guest:
just canonical test-guest
canonical-print-build-hashes:
just canonical print-build-hashes
clean:
cargo clean
rm -rf sequencer-data
rm -rf tests/.deps
rm -rf tests/contracts/out tests/contracts/cache
just canonical clean
just bench clean
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all --check
clippy:
cargo clippy --workspace --all-targets --all-features -- -D warnings
verify: fmt-check check test clippy
run addr="127.0.0.1:3000" data_dir="sequencer-data":
rm -rf {{data_dir}}
CARTESI_SEQUENCER_HTTP_ADDR={{addr}} CARTESI_SEQUENCER_DATA_DIR={{data_dir}} cargo run -p wallet-sequencer --release