-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (90 loc) · 3.85 KB
/
Makefile
File metadata and controls
119 lines (90 loc) · 3.85 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
.PHONY: all build release test docs docs-serve testnet-config testnet-reth-recreate testnet-reth-restart testnet-start sync testnet-node-stop testnet-node-restart testnet-stop testnet-clean clean-volumes clean-prometheus spam spam-contract mbt-test mbt-clean
all: build
build:
cargo build
cd custom-reth && cargo build
release:
cargo build --release
test:
cargo test
forge test -vvv
# Docs
docs:
cd docs/operational-docs && mdbook build
docs-serve:
cd docs/operational-docs && mdbook serve --open
# Testnet (local deployment)
RETH_NODES ?= reth0 reth1 reth2 reth3
testnet-config: testnet-clean build
./scripts/generate_testnet_config.sh --nodes $(words $(RETH_NODES)) --testnet-config-dir .testnet
cargo run --bin emerald -- testnet --home nodes --testnet-config .testnet/testnet_config.toml
ls nodes/*/config/priv_validator_key.json | xargs -I{} cargo run --bin emerald show-pubkey {} > nodes/validator_public_keys.txt
cargo run --bin emerald-utils genesis --public-keys-file ./nodes/validator_public_keys.txt --devnet
testnet-reth-recreate:
docker compose down -v $(RETH_NODES)
docker compose up -d $(RETH_NODES)
./scripts/add_peers.sh --nodes $$(docker compose ps --status running --format "{{.Name}}" | grep -c reth)
testnet-reth-restart:
docker compose restart $(RETH_NODES)
./scripts/add_peers.sh --nodes $$(docker compose ps --status running --format "{{.Name}}" | grep -c reth)
testnet-start: testnet-config testnet-reth-recreate
docker compose up -d prometheus grafana otterscan
@echo 👉 Grafana dashboard is available at http://localhost:4000
bash scripts/spawn.bash --nodes $(words $(RETH_NODES)) --home nodes --no-delay
sync: testnet-config testnet-reth-recreate
docker compose up -d prometheus grafana otterscan
@echo 👉 Grafana dashboard is available at http://localhost:4000
cp monitoring/prometheus-syncing.yml monitoring/prometheus.yml
docker compose restart prometheus
bash scripts/spawn.bash --nodes $(words $(RETH_NODES)) --home nodes
NODE ?= 0# default node 0
testnet-node-stop:
@echo "\nStopping node $(NODE) (folder: \"nodes/$(NODE)\")"
./scripts/kill_node.sh $(NODE)
testnet-node-restart: testnet-node-stop
@echo "\nRestarting node $(NODE) (folder: \"nodes/$(NODE)\")"
./scripts/restart_node.sh $(NODE)
testnet-stop:
docker compose down
# Testnet cleanup
testnet-clean: clean-prometheus clean-volumes
rm -rf ./.testnet
rm -rf ./assets/genesis.json
rm -rf ./assets/emerald_genesis.json
rm -rf ./nodes
rm -rf ./monitoring/data-grafana
clean-volumes:
docker volume ls --format '{{.Name}}' | grep -E 'reth' | xargs -r docker volume rm || true
clean-prometheus: testnet-stop
rm -rf ./monitoring/data-prometheus
# Spammer
spam:
cargo run --bin emerald-utils spam --time=60 --rate=1000 --rpc-url=http://127.0.0.1:8645 --chain-id 12345
spam-contract:
@if [ -z "$(CONTRACT)" ]; then \
echo "Error: CONTRACT address is required"; \
echo "Usage: make spam-contract CONTRACT=0x5FbDB... FUNCTION=\"increment()\""; \
echo "Example with args: make spam-contract CONTRACT=0x5FbDB... FUNCTION=\"setNumber(uint256)\" ARGS=\"12345\""; \
exit 1; \
fi; \
if [ -z "$(FUNCTION)" ]; then \
echo "Error: FUNCTION signature is required"; \
echo "Usage: make spam-contract CONTRACT=0x5FbDB... FUNCTION=\"increment()\""; \
echo "Example with args: make spam-contract CONTRACT=0x5FbDB... FUNCTION=\"setNumber(uint256)\" ARGS=\"12345\""; \
exit 1; \
fi; \
cargo run --release --bin emerald-utils spam-contract \
--contract="$(CONTRACT)" \
--function="$(FUNCTION)" \
--args="$(ARGS)" \
--time=60 \
--rate=1000 \
--rpc-url=127.0.0.1:8645
# Model-Based Testing (MBT)
TEST ?=
mbt-test: RETH_NODES=reth0 reth1 reth2
mbt-test: testnet-config
@echo "Running MBT tests..."
@echo "Note: RETH will be automatically started and stopped for each test"
cargo test --package emerald-mbt -- --nocapture --test-threads=1 $(TEST)
mbt-clean: testnet-clean