|
1 | 1 | VERSION = $(shell git describe --tags --abbrev=8 2>/dev/null) |
2 | 2 |
|
3 | | -LDFLAGS += -X eth2-monitor/cmd.version=${VERSION} |
| 3 | +LDFLAGS += -X github.com/stakefish/eth2-monitor/internal/cli.version=${VERSION} |
4 | 4 |
|
5 | | -.PHONY: all build eth2-monitor |
| 5 | +.PHONY: all build eth2-monitor lint test test-e2e refresh-fixtures refresh-scenario |
6 | 6 | all: build |
7 | 7 |
|
8 | 8 | build: eth2-monitor |
9 | 9 |
|
10 | 10 | eth2-monitor: |
11 | 11 | -@mkdir -p bin |
12 | 12 | -@rm -f bin/$@ |
13 | | - go build -ldflags '$(LDFLAGS)' -o bin/$@ . |
| 13 | + go build -ldflags '$(LDFLAGS)' -o bin/$@ ./cmd/eth2-monitor |
| 14 | + |
| 15 | +lint: |
| 16 | + golangci-lint run ./... |
| 17 | + |
| 18 | +test: |
| 19 | + go test -cover ./... |
| 20 | + |
| 21 | +test-e2e: |
| 22 | + go test -tags=e2e -count=1 -timeout=5m ./internal/beaconchain/... ./internal/monitoring/... |
| 23 | + |
| 24 | +# Scenarios captured by tools/fixturegen. Each scenario gets its own |
| 25 | +# subdirectory under internal/beaconchain/testdata/beacon/<chain>/<scenario>/ |
| 26 | +# (plus internal/monitoring/testdata/mev/ for the chain-agnostic mev |
| 27 | +# scenario). The head-stream-driven capture flow waits for live head |
| 28 | +# events on the configured BEACON_CHAIN_API endpoint — see |
| 29 | +# tools/fixturegen/main.go. |
| 30 | +SCENARIOS = _shared happy_path missed_proposal empty_block delayed_attestation cross_epoch_attestation mev |
| 31 | + |
| 32 | +# CHAIN selects the chain subdirectory under testdata/beacon/. Defaults |
| 33 | +# to hoodi (the chain configured in test-env/.env). Set explicitly to |
| 34 | +# capture against a different network: |
| 35 | +# make refresh-fixtures CHAIN=sepolia |
| 36 | +CHAIN ?= hoodi |
| 37 | + |
| 38 | +# Refresh every scenario sequentially. The head-stream selectors each |
| 39 | +# wait up to ~10 minutes for a matching head event, so a full |
| 40 | +# refresh-fixtures run can take 30-60 minutes on a normal-finality |
| 41 | +# testnet. Use refresh-scenario for targeted refreshes during |
| 42 | +# development. Reads $BEACON_CHAIN_API or test-env/.env. |
| 43 | +refresh-fixtures: |
| 44 | + @for s in $(SCENARIOS); do \ |
| 45 | + echo "==> capturing scenario: $$s (chain=$(CHAIN))"; \ |
| 46 | + go run ./tools/fixturegen --scenario=$$s --chain=$(CHAIN) || exit 1; \ |
| 47 | + done |
| 48 | + |
| 49 | +# Refresh a single scenario. Pass `SCENARIO=<name>` (e.g. |
| 50 | +# `make refresh-scenario SCENARIO=missed_proposal`). Honors CHAIN. |
| 51 | +refresh-scenario: |
| 52 | + @if [ -z "$(SCENARIO)" ]; then echo "usage: make refresh-scenario SCENARIO=<name> [CHAIN=<chain>]"; exit 2; fi |
| 53 | + go run ./tools/fixturegen --scenario=$(SCENARIO) --chain=$(CHAIN) |
0 commit comments