Skip to content

feat(reward-caller): automate reward calls via a delegate wallet - #111

Open
rickstaa wants to merge 2 commits into
mainfrom
rs/reward-caller
Open

rickstaa wants to merge 2 commits into
mainfrom
rs/reward-caller

Conversation

@rickstaa

@rickstaa rickstaa commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Adds livepeer reward-caller, a standalone service that calls reward every round for orchestrators that authorized its wallet with livepeer chain orchestrator reward-caller set (LIP-118). This replaces go-livepeer's -reward without keeping the orchestrator key unlocked on a machine.

Like the standalone redeemer, it refuses a registered or active orchestrator wallet, and also any wallet with bonded stake, at startup, every pass, and before every broadcast. It only broadcasts rewardForTranscoder, rechecks each orchestrator's authorization every pass, and reads state from chain so restarts need no database. livepeer chain reward call --orchestrator now checks authorization before simulating. Round initialization and a terminal password prompt for the CLI are left for follow-ups

go-livepeer's -reward kept the orchestrator key unlocked on the serving
machine. The reward caller uses LIP-118 delegation instead: it refuses
orchestrator or staked wallets, only broadcasts rewardForTranscoder,
and rechecks authorization every pass. The CLI now also checks
authorization before simulating a delegated reward call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 12:39
@rickstaa
rickstaa deployed to docker-publish November 30, 2026 12:42 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A rejected broadcast can discard a reserved-nonce transaction and stall rewards for all orchestrators, while failed status reads can incorrectly make /readyz report readiness without confirmed authorization.

2 open issues
What changed in this PR

Adds a standalone delegated reward caller to Livepeer’s component suite, automating per-round rewards without keeping orchestrator keys unlocked.

Changes:

  • Adds sequential reward processing, dedicated-wallet checks, transaction fee replacements, probes, and metrics.
  • Checks delegated authorization before manual reward-call simulation.
  • Integrates the service into builds, packaging, CLI tests, configuration examples, and documentation.
File Description
rewardcaller/​caller.go Implements reward decisions, submission, and broadcast policy.
rewardcaller/​app.go Adds configuration, polling, wallet checks, and monitoring.
rewardcaller/​app_test.go Tests reward outcomes, wallet restrictions, and service behavior.
README.md Lists the new standalone component.
nodeconfig/​config.go Normalizes hyphenated component names in environment prefixes.
Makefile Builds the reward-caller binary.
internal/​test/​redemptionrpc.go Extends the RPC fixture with delegated reward state.
eth/​rewardcaller.go Adds dedicated-wallet validation and reward-status reads.
eth/​rewardcaller_test.go Tests wallet validation and reward-status helpers.
docs/​reward-caller.md Documents setup, operation, probes, and metrics.
docs/​README.md Links the reward-caller guide.
docs/​metrics.md Lists reward-caller metrics.
docs/​configuration.md Documents reward-caller configuration and credentials.
docs/​chain.md Explains authorization checks and automated reward calling.
configs/​reward-caller/​config.example.toml Provides example service settings.
cmd/​livepeer/​testdata/​cli/​reward-caller-help.golden Records expected CLI help output.
cmd/​livepeer/​testdata/​cli/​reward-caller-completion-zsh.golden Records the Zsh completion snapshot.
cmd/​livepeer/​testdata/​cli/​reward-caller-completion-powershell.golden Records the PowerShell completion snapshot.
cmd/​livepeer/​testdata/​cli/​reward-caller-completion-fish.golden Records the Fish completion snapshot.
cmd/​livepeer/​testdata/​cli/​reward-caller-completion-bash.golden Records the Bash completion snapshot.
cmd/​livepeer/​main.go Adds reward-caller dispatch, help, and completion routing.
cmd/​livepeer/​integration_test.go Includes the new binary in CLI integration checks.
cmd/​livepeer/​imports_test.go Enforces the reward-caller component’s import boundary.
cmd/​livepeer-reward-caller/​main.go Adds the standalone executable entry point.
chain/​management_test.go Tests authorization rejection before simulation.
chain/​actions.go Checks authorization for delegated manual rewards.
.github/​workflows/​package.yml Includes the binary in static-link verification.
.github/​scripts/​release-smoke.sh Checks the component in release smoke tests.
.github/​scripts/​docker-smoke.sh Checks the component in container smoke tests.
.dockerignore Includes reward-caller sources in Docker builds.

Review effort: Balanced

Comment thread rewardcaller/caller.go Resolved
Comment thread rewardcaller/app.go Resolved
@rickstaa
rickstaa deployed to docker-publish November 30, 2026 12:43 — with GitHub Actions Active
@rickstaa
rickstaa deployed to docker-publish November 30, 2026 12:43 — with GitHub Actions Active
@rickstaa
rickstaa deployed to docker-publish November 30, 2026 12:43 — with GitHub Actions Active
Prepare reserves the next nonce locally, so a transaction the node
never received left a gap that blocked every later reward until
restart. After a failed send the reward caller now takes the nonce
from the node's pending count again. Readiness also ignores failed
status reads, which confirm no authorization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 12:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the new delegated reward-caller service.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@j0sh

j0sh commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this! It seems good to me. Ran this through my Codex; findings 2 and 4 seem minor and can probably be ignored if the needed fix is disproportionate to the change (esp for the second)


The main blocker is transaction recovery across polls. The binary, dispatcher, and packaging changes look proportionate to adding a standalone service.

Review

  1. [P1] Keep unresolved reward transactions on the same nonce. I reproduced two submissions for the same reward at nonces 0 and 1 after either a confirmation timeout or an accepted send whose RPC response was lost. Resetting the local reservation lets the pending nonce advance while the original transaction is still outstanding. Later rewards can queue behind it, and duplicate calls can spend gas reverting. Track the outstanding hash and nonce until their outcome is known, keep replacements on that nonce, and check for an outstanding wallet nonce on restart. Preserve the retry path for a send the node definitively rejected. Transaction submission

  2. [P2] Recheck delegation before replacing a transaction. I reproduced a fee replacement after the target revoked authorization. The broadcast hook checks the wallet’s eligibility, destination, and method, but skips the target’s current authorization. The contract rejects the call if mined after revocation, which can cost gas. Recheck the target before each replacement and cover revocation while a transaction is pending. Broadcast policy, BondingManager authorization check

  3. [P2] Let an authorized orchestrator through startup when another lookup fails. I confirmed that one failed lookup aborts startup even after the service has verified another orchestrator’s authorization. Startup only needs one successful authorization lookup. Report individual read failures, start once one authorization is confirmed, and let the polling loop check every target. If every lookup fails, report the RPC failure so the operator knows what to fix. Startup authorization

  4. [P2] Make the setup steps work with a fresh wallet. The guide’s bare account create command fails without a configured password. Link directly to the existing keystore setup command, which supplies --keystore-password-file, and show how to select the orchestrator account for the authorization transaction. Setup guide

Where I’d cut lines

  • Implementation, roughly 35–50 lines before the retry fix. Use an authorization-only lookup at startup and let polling own per-target diagnostics. In the polling loop, publish each result immediately and accumulate a readiness boolean there. That removes the results slice, the second traversal, and authorizedCount. Parse and validate configured addresses once. Keep the last-reward gauge tied to the round observed on chain, since a transaction can land in a later round than the one read before submission. Polling loop
  • Tests, roughly 80–110 lines. Fold a small canonical-block assertion into the existing eth tests and drop the new 110-line duplicate RPC fixture. The service tests already exercise the registered, active, and bonded-wallet cases. Use the shared RPC fixture for one lifecycle test that mines a reward, polls again in the same round, advances the round, then revokes and restores authorization. The current test marks the reward on send and sleeps, so it misses the distinction between submission and mining. Keep the rejected-send case and add the accepted-but-unconfirmed cases alongside it. Duplicate fixture, Service lifecycle test
  • Docs and example config, roughly 30–40 lines. Organize the guide around setup and troubleshooting. Keep the dedicated-wallet, gas, and external round-initialization requirements. Put metric definitions in one place, link to Chain commands for manual rewards, and strip repeated defaults and the preset Controller address from the example. Replace the internal failure-stage list with operator actions for missing authorization, low gas, and a stuck transaction. Operator guide, Example config

This branch was successfully deployed

1 active deployment
docker-publish — ef01cc5f Deployed Nov 30, 2026 by rickstaa via docker-pr / promote #224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants