Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (134 loc) · 4.81 KB
/
Copy pathMakefile
File metadata and controls
150 lines (134 loc) · 4.81 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
.PHONY: setup
# Setup development environment
setup:
bash ./scripts/setup-dev.sh
.PHONY: clean
# Cleanup compilation outputs
clean:
cargo clean
.PHONY: fmt-check fmt format
# Check the code format
fmt-check:
taplo fmt --check
cargo fmt --all -- --check
# Format the code
fmt:
taplo fmt
cargo fmt --all
# Alias for fmt
format: fmt
.PHONY: clippy clippy-release
# Run rust clippy with debug profile
clippy:
SKIP_WASM_BUILD=1 cargo clippy --all --all-targets --features=runtime-benchmarks,skip-proof-verification,try-runtime -- -D warnings
# Run rust clippy with release profile
clippy-release:
SKIP_WASM_BUILD=1 cargo clippy --release --all --all-targets --features=runtime-benchmarks,skip-proof-verification,try-runtime -- -D warnings
.PHONY: check check-release
# Check code with debug profile
check:
cargo check
# Check code with release profile
check-release:
cargo check --release
.PHONY: build build-release
# Build all binaries with debug profile
build:
WASM_BUILD_TYPE=debug cargo build
# Build all binaries with release profile.
#
# FEATURES selects the Hyperbridge deployment the runtime is compiled against, and it is
# not optional for a testnet build: the default targets `Polkadot(3367)` (mainnet), and
# `Polkadot(id)` / `Kusama(id)` are distinct SCALE variants that `is_allowed_proxy`
# compares with `==`. A testnet chain running a mainnet-coprocessor runtime rejects every
# proxied request, and it does so at relay time, not at deploy time.
#
# make build-release # mainnet
# make build-release FEATURES=hyperbridge-testnet # testnet
FEATURES ?=
build-release:
WASM_BUILD_TYPE=release cargo build --release $(if $(FEATURES),--features $(FEATURES),)
.PHONY: test test-release
# Run all unit tests with debug profile
test:
cargo test --lib --all
cargo test --lib --all --features=runtime-benchmarks,skip-proof-verification
# Run all unit tests with release profile
test-release:
cargo test --release --lib --all
cargo test --release --lib --all --features=runtime-benchmarks,skip-proof-verification
.PHONY: integration-test integration-test-lint
# Check code format and lint of integration tests
integration-test-lint:
cd ts-tests && npm install && npm run fmt-check
# Run all integration tests
integration-test: build-release integration-test-lint
cd ts-tests && npm run build && npm run test && npm run test-sql
.PHONY: benchmark benchmark-pallet
# Run all runtime benchmarks. Replaces the interactive vendored script: this one is
# non-interactive, writes each pallet's weights to its real destination, and survives
# the OOM window (see the script's header).
benchmark:
./scripts/benchmarks/run_benchmarks.sh
# Run benchmark for specific pallet (usage: make benchmark-pallet PALLET=pallet-shielded-pool)
benchmark-pallet:
@if [ -z "$(PALLET)" ]; then \
echo "Error: PALLET variable is required. Usage: make benchmark-pallet PALLET=pallet-name"; \
exit 1; \
fi
cargo build --release --features=runtime-benchmarks,skip-proof-verification
./target/release/orbinum-node benchmark pallet --chain=dev --pallet=$(PALLET) --extrinsic='*' --steps=50 --repeat=20 --output=./frame/$(PALLET)/src/weights.rs --template=./scripts/benchmarks/frame-weight-template.hbs
.PHONY: run-dev
run-dev:
./target/release/orbinum-node --dev --tmp \
--max-runtime-instances=32 \
--runtime-cache-size=8
.PHONY: run-dev-persistent
run-dev-persistent:
./target/release/orbinum-node \
--dev \
--base-path ./data/dev \
--max-runtime-instances=32 \
--runtime-cache-size=8
.PHONY: audit
# Run security audit (ignoring known Polkadot SDK transitive dependencies via deny.toml)
audit:
@cargo deny check advisories
.PHONY: deploy-runtime
# Deploy runtime upgrade on-chain (usage: make deploy-runtime WASM=<path> RPC=<ws_url> SEED=<seed>)
deploy-runtime:
@if [ -z "$(WASM)" ]; then \
WASM="target/release/wbuild/orbinum-runtime/orbinum_runtime.compact.compressed.wasm"; \
else \
WASM="$(WASM)"; \
fi; \
bash ./scripts/deploy-runtime.sh "$$WASM" "$(RPC)" "$(SEED)"
.PHONY: rolling-update
# Rolling update node binary on remote servers (usage: make rolling-update VALIDATORS=<ip1,ip2> RPC_NODE=<ip>)
rolling-update:
bash ./scripts/rolling-update.sh \
--binary target/release/orbinum-node \
--validators "$(VALIDATORS)" \
--rpc-node "$(RPC_NODE)"
.PHONY: healthcheck
# Check network health (usage: make healthcheck RPC=<url>)
healthcheck:
bash ./scripts/healthcheck.sh "$(RPC)"
.PHONY: help
# Show help
help:
@echo ''
@echo 'Usage:'
@echo ' make [target]'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^# (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
printf "\033[36m%-30s\033[0m %s\n", helpCommand,helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help