Skip to content

Commit 7fd98c6

Browse files
authored
Merge pull request #172 from Sunny6889/feat/replay-tool
feat(tools): add replay — mainnet tx replay HTTP client
2 parents 469a18c + 2f015b4 commit 7fd98c6

11 files changed

Lines changed: 1206 additions & 7 deletions

File tree

.goreleaser.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,24 @@ builds:
2424
- -X github.com/tronprotocol/tron-deployment/cmd.commit={{.Commit}}
2525
- -X github.com/tronprotocol/tron-deployment/cmd.buildTime={{.Date}}
2626

27+
- id: replay
28+
main: ./tools/replay
29+
binary: replay
30+
env:
31+
- CGO_ENABLED=0
32+
goos:
33+
- linux
34+
- darwin
35+
goarch:
36+
- amd64
37+
- arm64
38+
ldflags:
39+
- -s -w
40+
2741
archives:
2842
- id: default
43+
builds:
44+
- trond
2945
formats:
3046
- tar.gz
3147
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
@@ -35,6 +51,17 @@ archives:
3551
- examples/*
3652
- schemas/*
3753

54+
- id: replay
55+
builds:
56+
- replay
57+
formats:
58+
- tar.gz
59+
name_template: "replay_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
60+
files:
61+
- LICENSE*
62+
- src: tools/replay/README.md
63+
dst: README.md
64+
3865
checksum:
3966
name_template: "checksums.txt"
4067
algorithm: sha256
@@ -123,6 +150,12 @@ nfpms:
123150
# path is still the cleaner UX for CLI tools.
124151
brews:
125152
- name: trond
153+
# Scope to the trond archive only — the homebrew tap installs the
154+
# main CLI, not the sibling replay tool. Without ids, goreleaser
155+
# tries to package both archives under the same OS/Arch slot and
156+
# errors with "one tap can handle only one archive".
157+
ids:
158+
- default
126159
repository:
127160
owner: tronprotocol
128161
name: homebrew-tap

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ endif
4141

4242
GOFLAGS ?=
4343

44-
.PHONY: build test lint e2e build-all clean clean-all fmt vet tidy sync-templates sync-schemas snapshot-schema-baseline update-render-golden refresh-builder-pins docs man cover vuln bootstrap-go
44+
.PHONY: build test lint e2e build-all clean clean-all fmt vet tidy sync-templates sync-schemas snapshot-schema-baseline update-render-golden docs man cover vuln bootstrap-go build-replay install-replay
4545

4646
## bootstrap-go: Download + verify the project-local Go toolchain
4747
## (idempotent; safe to re-run; no-op if already current)
@@ -164,9 +164,17 @@ update-render-golden: $(GO_BOOTSTRAP)
164164
TROND_UPDATE_GOLDEN=1 $(GO) test -run TestRenderHOCON_Golden ./internal/render/
165165
@echo "render golden files refreshed under internal/render/testdata/golden/."
166166

167-
## refresh-builder-pins: Re-resolve Eclipse Temurin tags → sha256 digests
168-
## and rewrite internal/build/pins/builder_image_digests.json.
169-
## Run at trond release-prep so the binary ships current
170-
## digests. Requires docker + jq on PATH. spec/002 FR-012.
171-
refresh-builder-pins:
172-
@./scripts/refresh-builder-pins.sh
167+
## build-replay: Build the tools/replay binary into bin/replay.
168+
## replay is a standalone Go binary (no java-tron source
169+
## dependency) that streams mainnet historical transactions
170+
## from TronGrid to a private chain over HTTP. See
171+
## tools/replay/README.md and tools/replay/IMPROVEMENTS.md.
172+
build-replay: $(GO_BOOTSTRAP)
173+
@mkdir -p bin
174+
$(GO) build -ldflags "$(LDFLAGS)" -o bin/replay ./tools/replay
175+
@echo "✓ bin/replay built"
176+
177+
## install-replay: Build + copy bin/replay into $(GOBIN).
178+
install-replay: build-replay
179+
cp bin/replay $(GOBIN)/replay
180+
@echo "✓ replay installed at $(GOBIN)/replay"

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,26 @@ remain at the repo root. `make sync-templates` re-fetches them from
574574
upstream into both the root and the CLI's embedded copy so the two stay
575575
in lockstep.
576576

577+
## Companion Tools
578+
579+
In addition to the `trond` CLI, this repo ships sibling Go tools under
580+
`tools/` for adjacent test/operations workflows. They build into separate
581+
binaries and have separate release tarballs.
582+
583+
| Tool | Path | Purpose |
584+
|---|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
585+
| **`replay`** | [`tools/replay/`](tools/replay/README.md) | Streams mainnet historical transactions from TronGrid HTTP API to a private chain. Pure-Go external HTTP client (no java-tron source dependency). Used for testing setup, stress harness, snapshot validation. |
586+
587+
Build:
588+
589+
```bash
590+
make build-replay # → bin/replay
591+
make install-replay # → $(GOBIN)/replay
592+
```
593+
594+
Each tool ships as its own tarball (`replay_<version>_<os>_<arch>.tar.gz`)
595+
in releases, alongside the main `trond` tarball.
596+
577597
## Configuration Templates
578598

579599
Base java-tron configuration templates rendered into per-node HOCON. The

0 commit comments

Comments
 (0)