Commit 6704730
authored
chore: integrate Fibre into Talis (#194)
## Overview
Closes #185
<details>
<summary>Claude generated PR. Initial impelmentation plan but the
implementation changed a bit from it with time</summary>
# Plan: Add Fibre Client Support to Talis
## Context
Talis (`./tools/talis`) needs fibre DA tooling equivalent to its
existing `txsim` command. Three new talis commands plus a standalone
binary:
1. `setup-fibre` -- post-deploy step: SSH into each validator to
register its fibre host address + fund its escrow account
2. `fibre-txsim` -- start the standalone `fibre-txsim` binary on remote
validators via SSH + tmux
3. `fibre-throughput` -- run locally: monitor blocks in real-time,
decode `MsgPayForFibre` and `MsgPayForBlobs` txs, print throughput per
block, optionally write JSONL traces
Additionally, a standalone load-generation binary:
4. `tools/fibre-txsim/` -- connects to a validator's gRPC endpoint and
submits blobs via the Fibre protocol
No proto changes, no module changes, no genesis modifiers. Registration
and escrow funding happen at runtime via SSH after deploy.
## Port Layout
- App gRPC: `0.0.0.0:9091` (fibre server + tx submission + valaddr
queries)
- CometBFT RPC: `0.0.0.0:26657` (block queries)
---
## New Files
### 1. `tools/talis/fibre_setup.go` -- Post-deploy Fibre Setup
New `setup-fibre` command. SSHes into each validator and runs two txs:
register fibre host + fund escrow. Uses `runScriptInTMux` with parallel
workers.
**Flags:**
- `--directory` (string, default `.`)
- `--ssh-key-path` (string)
- `--escrow-amount` (string, default `200000000000000utia`)
- `--fibre-port` (int, default `9091`)
- `--fees` (string, default `5000utia`)
- `--workers` (int, default `10`)
**Script per validator:**
```bash
celestia-appd tx valaddr set-host dns:///<public_ip>:<fibre_port> \
--from validator --keyring-backend=test --home .celestia-app \
--chain-id <chain_id> --fees <fees> --yes; \
sleep 20; \
celestia-appd tx fibre deposit-to-escrow <escrow_amount> \
--from validator --keyring-backend=test --home .celestia-app \
--chain-id <chain_id> --fees <fees> --yes
```
Each validator runs its own script via `runScriptInTMux` with session
name `"setup-fibre"`. Workers run in parallel via a semaphore +
WaitGroup. Waits ~40 seconds after all workers complete for transactions
to finalize.
### 2. `tools/talis/fibre_txsim.go` -- Remote Fibre Blob Spammer
Launcher
New `fibre-txsim` command. SSHes into validators and starts the
`fibre-txsim` binary (already deployed via `make build-talis-bins`)
inside tmux sessions.
**Flags:**
- `--directory` (string, default `.`)
- `--ssh-key-path` (string)
- `--instances` (int, default `1`) -- number of validators to start on
- `--concurrency` (int, default `1`) -- concurrent blob submissions per
instance
- `--blob-size` (int, default `1000000`)
- `--interval` (duration, default `0` = no delay)
- `--duration` (duration, default `0` = until killed)
- `--key-name` (string, default `validator`)
**Logic:**
1. Load config, select first N validators based on `--instances`
2. Build the remote command string with all flags
3. Start tmux sessions via `runScriptInTMux` with session name
`"fibre-txsim"`
4. Print summary with session name, log file path, and validator list
### 3. `tools/talis/fibre_throughput.go` -- Real-time Throughput Monitor
New `fibre-throughput` command. Runs locally, polls blocks from a
validator's RPC. Tracks both `MsgPayForFibre` (PFF) and `MsgPayForBlobs`
(PFB) transactions. Optionally writes structured JSONL traces.
**Flags:**
- `--directory` (string, default `.`)
- `--rpc-endpoint` (string) -- defaults to first validator IP:26657
- `--duration` (duration, default `0` = until Ctrl+C)
- `--start-height` (int64, default `0` = latest + 1) -- block height to
start from
- `--with-traces` (bool, default `false`) -- enable JSONL trace file
output
- `--traces-dir` (string, default `traces/throughput`) -- directory for
trace files
**Trace record struct:**
```go
type blockTrace struct {
Height int64 `json:"height"`
Timestamp string `json:"timestamp"`
BlockTimeSec float64 `json:"block_time_sec"`
PFFCount int `json:"pff_count"`
PFBCount int `json:"pfb_count"`
TotalPFFBytes int64 `json:"total_pff_bytes"`
TotalPFBBytes int64 `json:"total_pfb_bytes"`
PFFThroughputMBs float64 `json:"pff_throughput_mbs"`
PFBThroughputMBs float64 `json:"pfb_throughput_mbs"`
}
```
**Logic:**
1. Load config, resolve RPC endpoint (first validator IP:26657)
2. Create CometBFT HTTP client + tx decoder via
`encCfg.TxConfig.TxDecoder()`
3. If `--start-height > 0`, start from that height; otherwise query
latest height + 1
4. If `--with-traces`, create traces directory via `os.MkdirAll`, open
timestamped JSONL file (e.g. `throughput_2026-02-18T20:59:35Z.jsonl`),
create `json.NewEncoder`
5. Poll for new blocks (1s interval)
6. For each block: decode all txs, type-assert for
`*fibretypes.MsgPayForFibre` (sum `PaymentPromise.BlobSize`) and
`*blobtypes.MsgPayForBlobs` (sum `BlobSizes`)
7. Compute per-block throughput: `bytes / blockTimeDelta / (1024 *
1024)` for both PFF and PFB
8. Print one line per block: `height=N pff_txs=N pfb_txs=N pff_bytes=NMB
pfb_bytes=NMB block_time=Ns pff_throughput=NMB/s pfb_throughput=NMB/s`
9. If traces enabled, encode `blockTrace` struct via
`encoder.Encode(trace)`
10. On exit: print summary (avg throughput, total bytes, total blocks),
close trace file
### 4. `tools/fibre-txsim/main.go` -- Standalone Fibre Blob Spammer
Standalone binary that runs on validator nodes. Connects to a
validator's gRPC endpoint, creates random blobs, and submits them via
`fibre.Client.Put()`.
**Flags:**
- `--chain-id` (string, required)
- `--grpc-endpoint` (string, default `localhost:9091`)
- `--keyring-dir` (string, default `.celestia-app`)
- `--key-name` (string, default `validator`)
- `--blob-size` (int, default `1000000`)
- `--concurrency` (int, default `1`)
- `--interval` (duration, default `0` = no delay)
- `--duration` (duration, default `0` = until killed)
**Logic:**
1. Set up fibre client:
- `encoding.MakeConfig(app.ModuleEncodingRegisters...)`
- `keyring.New(app.Name, keyring.BackendTest, keyringDir, nil,
encCfg.Codec)`
- `grpc.NewClient(endpoint, insecure, maxMsgSize)`
- `fibregrpc.NewSetGetter(coregrpc.NewBlockAPIClient(grpcConn))`
- `fibregrpc.NewHostRegistry(valaddrtypes.NewQueryClient(grpcConn))`
- `user.SetupTxClient(ctx, kr, grpcConn, encCfg,
user.WithDefaultAccount(keyName))`
- `fibre.NewClient(txClient, kr, valGet, hostReg, clientCfg)`
2. Spam loop: bounded concurrency via semaphore, optional ticker-based
pacing via `--interval`, random namespace + random blob data
3. Print each result to stdout as it completes (height, tx hash,
latency, error)
4. On Ctrl+C / timeout: print summary (total sent, successes, failures,
avg latency)
Built for Linux via `make build-talis-bins` and deployed to validators
in the payload.
---
## Modified Files
### 5. `tools/talis/main.go`
Add three new commands:
```go
setupFibreCmd(),
fibreTxsimCmd(),
fibreThroughputCmd(),
```
---
## Documentation
### 6. `tools/fibre-txsim/README.md`
Documents the standalone `fibre-txsim` binary: what it does, how to
build, all flags, how it works, and typical deployment via `talis
fibre-txsim`.
### 7. `tools/talis/fibre.md`
End-to-end guide for fibre experiments. References the main `README.md`
for network setup, then documents the three fibre-specific steps:
1. `talis setup-fibre` -- with flag table
2. `talis fibre-txsim` -- with flag table
3. `talis fibre-throughput` -- with flag table, trace file format
documentation (JSONL schema), and `--start-height` for replaying past
blocks
---
## Key Reference Files
- `tools/fibre-txsim/main.go` -- fibre client setup pattern (grpc,
keyring, fibre.NewClient, Put)
- `tools/talis/txsim.go` -- cobra command pattern + `runScriptInTMux`
usage
- `tools/talis/execution.go` -- `runScriptInTMux()` implementation
- `tools/talis/status.go` -- CometBFT RPC client pattern
- `scripts/single-node-fibre.sh` -- `set-host` + sleep pattern
- `fibre/client.go` + `fibre/client_put.go` -- `NewClient()` and `Put()`
API
- `x/fibre/types/tx.pb.go` -- `MsgPayForFibre` with
`PaymentPromise.BlobSize`
- `x/blob/types/tx.pb.go` -- `MsgPayForBlobs` with `BlobSizes []uint32`
## Workflow
```
1. talis init
2. talis add
3. talis up
4. talis genesis
5. talis deploy
6. talis setup-fibre -- registers hosts + funds escrow
7. talis fibre-txsim -- starts fibre-txsim on remote validators
8. talis fibre-throughput -- monitors throughput (with optional JSONL traces)
9. talis download / talis upload-data
10. talis down
```
## Verification
1. Build talis: `go build ./tools/talis/`
2. Build fibre-txsim: `go build ./tools/fibre-txsim/`
3. Run throughput without traces: `talis fibre-throughput --directory
<dir>` -- prints PFF + PFB stats per block
4. Run throughput with traces: `talis fibre-throughput --directory <dir>
--with-traces` -- creates
`traces/throughput/throughput_<timestamp>.jsonl`
5. Run throughput from specific height: `talis fibre-throughput
--directory <dir> --start-height 100`
6. Verify JSONL: each line is valid JSON with all `blockTrace` fields
</detail>1 parent a748d29 commit 6704730
File tree
10 files changed
+905
-1
lines changed- tools
- fibre-txsim
- talis
10 files changed
+905
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
| 363 | + | |
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
369 | 370 | | |
370 | 371 | | |
371 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
0 commit comments