Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
133 lines (108 loc) · 4.03 KB
/
Copy pathjustfile
File metadata and controls
133 lines (108 loc) · 4.03 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
# COMEBACKHERE-contracts task runner
# Compile all contracts
build:
cargo build
# Run all tests
test:
cargo test
# Run scoped mutation testing for treasury settlement math
mutants-treasury:
cargo mutants --package comebackhere-treasury --timeout 60 --test-threads 1 --in-place --no-shuffle --list-test-cases --exclude "contracts/treasury/tests/" || true
# Run only cross-contract integration tests (tests/ workspace package)
test-integration:
cargo test -p tests
# Format all code
fmt:
cargo fmt --all
# Run clippy lints
lint:
cargo clippy -- -D warnings
# Assert no contract error enum repeats a discriminant within its own ABI namespace
check-error-codes:
scripts/check-error-code-uniqueness.sh
# Run settlement workflow fuzz target
fuzz-settlement-workflow:
cd contracts/settlement-workflow/fuzz && cargo fuzz run execute_with_compliance
# Run invoice amount precision fuzz target
fuzz-invoice-amount:
cd contracts/invoice/fuzz && cargo fuzz run amount_precision
# List the available cargo-fuzz targets
fuzz-list:
@echo "settlement-workflow: execute_with_compliance"
@echo "invoice: amount_precision"
# Check dependencies for vulnerabilities and license issues
deny:
cargo deny check
# Check event schema docs against published event symbols in source
check-event-schema:
python3 scripts/check-event-schema-drift.py
# Verify every mod x; declaration has a corresponding source file
check-mod-files:
scripts/check-mod-files.sh
# Audit dependencies for known security vulnerabilities
audit:
cargo audit
# Run format and lint checks (for CI)
check: fmt lint test deny
@echo "✓ All checks passed"
# Run all quality gates before pushing
check-all: fmt lint test audit check-mod-files
@echo "✓ All quality gates passed"
# Literal mirror of the Pre-commit CI job's command sequence (see .github/workflows/pre-commit.yml
# and .pre-commit-config.yaml) — run this before pushing for an authoritative local answer to
# "will Pre-commit pass".
precommit:
cargo fmt --all -- --check
cargo clippy -- -D warnings
scripts/check-enum-ordering.sh
scripts/check-enum-doc-comments.sh
@echo "✓ Pre-commit checks passed"
# Run the invoice refund-math fuzz target for a bounded duration (seconds).
# Requires nightly + cargo-fuzz: cargo install cargo-fuzz
fuzz-net-refund seconds="300":
cd contracts/invoice/fuzz && cargo +nightly fuzz run net_refund -- -max_total_time={{seconds}}
# Deploy all three contracts to testnet.
#
# Required env vars:
# STELLAR_ACCOUNT — signing identity (key name or secret key), e.g. "alice"
# STELLAR_NETWORK — network alias configured in the Stellar CLI, e.g. "testnet"
#
# Optional env vars (override when using a custom RPC):
# STELLAR_RPC_URL — RPC endpoint (defaults to the CLI network alias)
# STELLAR_NETWORK_PASSPHRASE — network passphrase (defaults to the CLI network alias)
#
# Example:
# STELLAR_ACCOUNT=alice STELLAR_NETWORK=testnet just deploy
deploy:
#!/usr/bin/env bash
set -euo pipefail
: "${STELLAR_ACCOUNT:?STELLAR_ACCOUNT must be set}"
: "${STELLAR_NETWORK:?STELLAR_NETWORK must be set}"
cargo build --target wasm32-unknown-unknown --release
WASM_DIR="target/wasm32-unknown-unknown/release"
deploy_contract() {
local name="$1"
local id
id=$(stellar contract deploy \
--wasm "$WASM_DIR/${name}.wasm" \
--source "$STELLAR_ACCOUNT" \
--network "$STELLAR_NETWORK")
echo "$name contract ID: $id"
}
deploy_contract compliance
deploy_contract invoice
deploy_contract treasury
# Default target
default: check
# Test a single contract by short name (invoice, treasury, compliance, workflow)
test-contract name:
#!/usr/bin/env bash
set -euo pipefail
case "{{name}}" in
invoice) pkg=comebackhere-invoice ;;
treasury) pkg=comebackhere-treasury ;;
compliance) pkg=comebackhere-compliance ;;
workflow) pkg=comebackhere-settlement-workflow ;;
*) pkg="{{name}}" ;;
esac
cargo test -p "$pkg"