Skip to content

Commit ceb0973

Browse files
committed
Implement on-chain payments, remote signer, and chain commands
Port the retained ticket/payment code and focused tests into pm, keep Ethereum RPC, ABI, account, transaction, and redemption logic in eth, and preserve the Python runner signer wire shape in signercompat. Add SQLite state, activity and receipt reconciliation, all approved direct commands, Python compatibility fixtures, and CI gates. Source-Repository: https://github.com/livepeer/go-livepeer Source-Revision: bd645a09266833fb859053445d9ac85846330756 Source-History: b9507d0 Source-History: 95a1988
3 parents c7f9924 + b9507d0 + 95a1988 commit ceb0973

64 files changed

Lines changed: 6383 additions & 204 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: go vet ./...
3737
- name: Staticcheck
3838
run: |
39-
go install honnef.co/go/tools/cmd/staticcheck@v0.7.0
39+
go install honnef.co/go/tools/cmd/staticcheck@v0.8.1
4040
staticcheck ./...
4141
- name: Vulnerability scan
4242
run: |

‎README.md‎

Lines changed: 70 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Livepeer standalone extraction
22

3-
This repository is the **in-progress** standalone Live Runner extraction from
3+
This repository is the standalone Live Runner extraction from
44
`go-livepeer`. The source baseline and scope are recorded in
55
[`docs/source-revision.md`](docs/source-revision.md) and
66
[`docs/scope-matrix.md`](docs/scope-matrix.md).
@@ -9,28 +9,33 @@ This repository is the **in-progress** standalone Live Runner extraction from
99

1010
- `livepeer` dispatches only to bundled sibling or `libexec` executables and
1111
forwards their process status, streams and signals.
12-
- `livepeer-orchestrator` provides an off-chain Live Runner HTTP slice:
12+
- `livepeer-orchestrator` provides Live Runner HTTP routes:
1313
dynamic registration and authenticated heartbeats, static runners,
1414
discovery, capacity-limited persistent sessions, single-shot sessions,
1515
callbacks, generated proxy URLs, generic trickle channels, and HTTP/SSE/
16-
WebSocket reverse proxying.
16+
WebSocket reverse proxying. With payment configuration it issues on-chain
17+
challenges, validates `live` and `fixed` ticket batches, charges sessions,
18+
and queues winning tickets for direct Ethereum redemption.
19+
- `livepeer-signer` serves the retained unversioned signing, payment generation
20+
and discovery routes. SQLite pins signed-state sequence and replay results.
21+
- `livepeer-chain` implements all 17 approved direct Ethereum commands.
22+
State-changing commands simulate and estimate gas first, and require
23+
`--submit` to broadcast. `--wait` waits for a receipt.
1724
- Outbound runner, generated proxy, static health, and chain RPC destinations
1825
have separate exact host:port grants. Private and special-use addresses are
1926
denied by default at dial time.
20-
- `livepeer-chain status` reads and validates the configured chain ID and
21-
block number through JSON-RPC. `livepeer-chain account` reads the configured
22-
sender's ETH balance and pending nonce.
27+
- Ethereum contract calls, transaction signing and account access stay in
28+
`eth`; ticket, sender, recipient and redemption code stays in `pm`.
2329
- All executables expose version, help, and shell completion. Boa loads strict
2430
TOML, component-prefixed environment variables, and exact-byte secret files.
2531

26-
The remote signer payment service, on-chain orchestration, ticket redemption,
27-
and the remaining approved chain commands are **not implemented**. The signer
28-
executable exits with an explicit error if asked to start. Relevant trickle
29-
and ticket authorship is preserved in filtered Git history; see
30-
[`docs/history-extraction.md`](docs/history-extraction.md). Do not use this
31-
build as a replacement for an on-chain or paid deployment.
32+
Relevant trickle and ticket authorship is preserved in filtered Git history;
33+
see [`docs/history-extraction.md`](docs/history-extraction.md). Production
34+
chain cutover still needs deployment-specific staging validation, including
35+
contract addresses, funded accounts, gas behavior and a rollback drill; see
36+
[`docs/cutover.md`](docs/cutover.md).
3237

33-
## Build and try the off-chain orchestrator
38+
## Build and run
3439

3540
Go 1.27.1 or newer is required by the pinned Boa fork.
3641

@@ -41,10 +46,12 @@ bin/livepeer orchestrator --help
4146
bin/livepeer completion orchestrator bash
4247
```
4348

44-
Copy `configs/orchestrator/config.example.toml`, set its paths, and start:
49+
Copy the component examples in `configs/`, set their paths, and start:
4550

4651
```sh
4752
bin/livepeer orchestrator --config /absolute/path/to/orchestrator.toml
53+
bin/livepeer signer --config /absolute/path/to/signer.toml
54+
bin/livepeer chain status --config /absolute/path/to/chain.toml
4855
```
4956

5057
Use `--print-config` to inspect an audited TOML view. It omits direct secrets,
@@ -68,22 +75,53 @@ listener remains loopback and serves only `/metrics`, `/healthz`, and
6875
`/readyz`.
6976

7077
Custom CA bundles can be assigned independently to runner traffic, generated
71-
session proxies, static health checks, and chain RPC. Each bundle extends the
78+
session proxies, static health checks, signer discovery and chain RPC. Each bundle extends the
7279
system trust roots for only that destination purpose; certificate verification
7380
remains enabled.
7481

75-
## Current command surface
82+
## Paid operation
83+
84+
The orchestrator payment key is the ticket recipient. Its SQLite file holds
85+
challenges, balances, nonce replay protection, winning tickets and redemption
86+
attempts. The signer key is the ticket sender and has its own SQLite state
87+
file. Configure signer RPC, chain ID and controller together to check sender
88+
deposit and reserve before issuing tickets. Both SQLite files must be
89+
owner-only. Set the orchestrator's
90+
`wei_per_usd` from an operator-managed rate source; the process uses that
91+
static rate when a runner registers. Runner prices use USD per hour (`hour`)
92+
or per request (`fixed`).
93+
94+
Winning tickets are claimed in SQLite before broadcasting once. The background
95+
worker checks submitted transaction receipts and records confirmation or
96+
revert. An uncertain RPC result is recorded for operator reconciliation,
97+
without implicit retry.
98+
Back up the component SQLite files before migration. The database tables are
99+
created on first start; this initial version has no cross-version migration
100+
tool.
101+
102+
## Chain management
103+
104+
The approved commands are:
105+
106+
```text
107+
status account
108+
orchestrator get orchestrator activate
109+
orchestrator set-config orchestrator reward
110+
stake bond stake unbond
111+
stake rebond stake withdraw
112+
earnings claim earnings withdraw-fees
113+
ticketbroker fund ticketbroker unlock
114+
ticketbroker cancel-unlock ticketbroker withdraw
115+
round initialize
116+
```
76117

77-
| Command | State |
78-
| --- | --- |
79-
| `livepeer orchestrator` | Off-chain slice implemented; on-chain payments pending |
80-
| `livepeer signer` | CLI/configuration only; service pending |
81-
| `livepeer chain status` and `account` | Implemented read-only JSON-RPC commands |
82-
| Other approved `livepeer chain ...` commands | Pending |
118+
Run a state change without `--submit` to review its simulation,
119+
gas estimate and call data. Add `--submit` and an owner-only
120+
`private_key_file` to broadcast; add `--wait` for confirmation. The sender
121+
must match the key and the configured chain ID must match RPC. No command
122+
starts an HTTP server. Exit status is 0 on success and 2 on command failure.
83123

84-
The 17 listed chain operations from the extraction plan are approved for the
85-
initial surface. Payment, ticket, signer and chain-watcher state will use SQLite in
86-
each component. The on-chain schema and migration model are still design work.
124+
TODO: add a richer terminal UI after the direct command surface is stable.
87125

88126
## Test
89127

@@ -92,8 +130,10 @@ go test -race ./...
92130
go vet ./...
93131
```
94132

95-
The included architecture test checks source-level import boundaries. The
96-
real-process integration test exercises pinned Go and Python SDK revisions
97-
when their checkouts and dependencies are available; CI checks out both
98-
revisions explicitly. Signer fixtures, a test chain, fuzz, load and broader
99-
security suites remain in the migration plan.
133+
The architecture test checks source-level import boundaries. Real-process and
134+
HTTP integration tests exercise pinned Go and Python SDK revisions when their
135+
checkouts and dependencies are available; CI checks out both revisions.
136+
Payment tests cover Python `live` and `fixed` calls, GPU-filtered discovery,
137+
a Go paid session, and ticket receipt against a deterministic Ethereum interface. The Protobuf
138+
fixture is generated by the pinned Python runner. An external EVM staging
139+
test remains necessary before production cutover.

‎architecture/imports_test.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ func forbiddenImport(file, dep string) string {
6666
return ""
6767
}
6868
local := strings.TrimPrefix(dep, module)
69+
// A real HTTP compatibility test may compose component handlers without
70+
// creating a production dependency between those components.
71+
if file == "orchestrator/payment_test.go" && local == "signer" {
72+
return ""
73+
}
6974
if strings.HasPrefix(file, "cmd/livepeer/") && local != "version" {
7075
return "dispatcher imports component implementation"
7176
}

0 commit comments

Comments
 (0)