Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
!orchestrator/
!pm/
!redeemer/
!rewardcaller/
!redemption/
!signer/
!trickle/
2 changes: 1 addition & 1 deletion .github/scripts/docker-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ docker run --rm --network none --read-only --cap-drop=ALL \
cd /tmp
expected="livepeer $1 ($2)"
test "$(livepeer version)" = "$expected"
for component in orchestrator signer chain discovery redeemer; do
for component in orchestrator signer chain discovery redeemer reward-caller; do
test "$("livepeer-$component" --version)" = "livepeer-$component version $expected"
test "$(livepeer "$component" --version)" = "livepeer-$component version $expected"
"livepeer-$component" --help > direct-help
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/release-smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export PATH=/tmp/install/bin:/usr/bin:/bin
unset GOROOT GOPATH GOTOOLCHAIN GOENV GOWORK GOFLAGS

test "$(livepeer version)" = "livepeer $version ($commit)"
for component in orchestrator signer chain discovery redeemer; do
for component in orchestrator signer chain discovery redeemer reward-caller; do
"livepeer-$component" --version | grep -F "livepeer $version ($commit)"
livepeer "$component" --version | grep -F "livepeer $version ($commit)"
"livepeer-$component" --help > direct-help
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
cache-from: type=gha,scope=docker-${{ matrix.arch }}
- name: Verify static binaries
run: |
for binary in livepeer livepeer-orchestrator livepeer-signer livepeer-chain livepeer-discovery livepeer-redeemer; do
for binary in livepeer livepeer-orchestrator livepeer-signer livepeer-chain livepeer-discovery livepeer-redeemer livepeer-reward-caller; do
path="$RUNNER_TEMP/bin/$binary"
# A static ELF must have neither an interpreter nor shared-library dependencies.
readelf --program-headers "$path" > "$RUNNER_TEMP/program-headers"
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build:
$(GO) build -ldflags '$(LDFLAGS)' -o bin/livepeer-chain ./cmd/livepeer-chain
$(GO) build -ldflags '$(LDFLAGS)' -o bin/livepeer-discovery ./cmd/livepeer-discovery
$(GO) build -ldflags '$(LDFLAGS)' -o bin/livepeer-redeemer ./cmd/livepeer-redeemer
$(GO) build -ldflags '$(LDFLAGS)' -o bin/livepeer-reward-caller ./cmd/livepeer-reward-caller

test:
$(GO) test -race ./...
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ protocol commands for the Livepeer network.
| `livepeer` | Runs the bundled component commands. |
| `livepeer-orchestrator` | Registers runners, reserves sessions, proxies traffic, and redeems payment tickets. |
| `livepeer-redeemer` | Accepts winning tickets from orchestrators and redeems them using a dedicated wallet. |
| `livepeer-reward-caller` | Calls reward every round for orchestrators that authorized its dedicated wallet. |
| `livepeer-discovery` | Collects and caches orchestrator runner inventories without running an orchestrator. |
| `livepeer-signer` | Signs identities and payments, discovers orchestrators, and optionally publishes accounting events. |
| `livepeer-chain` | Inspects accounts and contracts, manages wallets, staking, earnings, funds, and governance, and signs files locally. |
Expand Down
7 changes: 7 additions & 0 deletions chain/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,13 @@ func (p RewardParams) actions() ([]action, error) {
if target == from {
return contractAction("bondingManager", "reward"), nil
}
caller, err := s.Call(ctx, "bondingManager", "transcoderToRewardCaller", target)
if err != nil {
return nil, err
}
if caller[0].(common.Address) != from {
return nil, fmt.Errorf("%s is not the reward caller for %s; the orchestrator must run 'livepeer chain orchestrator reward-caller set %s --submit'", from.Hex(), target.Hex(), from.Hex())
}
return contractAction("bondingManager", "rewardForTranscoder", target), nil
}), nil
}
Expand Down
7 changes: 6 additions & 1 deletion chain/management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,13 @@ func TestNoOpsAndPrerequisiteErrors(t *testing.T) {
})
}
f := newManagementFixture(t)
f.failSimulation = "rewardForTranscoderWithHint"
_, err := f.run(t, "reward", "call", "--orchestrator", "0x0000000000000000000000000000000000001234")
require.ErrorContains(t, err, "is not the reward caller for 0x0000000000000000000000000000000000001234")
require.Empty(t, f.simulations, "an unauthorized caller is refused before simulation")
f = newManagementFixture(t)
f.reads["transcoderToRewardCaller"] = []any{common.HexToAddress(testAccount)}
f.failSimulation = "rewardForTranscoderWithHint"
_, err = f.run(t, "reward", "call", "--orchestrator", "0x0000000000000000000000000000000000001234")
require.ErrorContains(t, err, "simulation failed")
}

Expand Down
15 changes: 15 additions & 0 deletions cmd/livepeer-reward-caller/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import (
"fmt"
"os"

"github.com/livepeer/node/rewardcaller"
)

func main() {
if err := rewardcaller.Root(os.Stdout, os.Stderr).Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
}
}
5 changes: 3 additions & 2 deletions cmd/livepeer/imports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ func forbiddenImport(file, dep string) string {
if local == "discovery/shared" {
return ""
}
for _, component := range []string{"orchestrator", "signer", "chain", "discovery", "redeemer"} {
// Package directory -> component command name.
for component, command := range map[string]string{"orchestrator": "orchestrator", "signer": "signer", "chain": "chain", "discovery": "discovery", "redeemer": "redeemer", "rewardcaller": "reward-caller"} {
if local == component || strings.HasPrefix(local, component+"/") {
if strings.HasPrefix(file, "cmd/livepeer-"+component+"/") || strings.HasPrefix(file, component+"/") {
if strings.HasPrefix(file, "cmd/livepeer-"+command+"/") || strings.HasPrefix(file, component+"/") {
continue
}
return "cross-component or shared-to-component import"
Expand Down
4 changes: 2 additions & 2 deletions cmd/livepeer/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestRealBinaryOffchainFlow(t *testing.T) {
require.True(t, ok)
root := filepath.Clean(filepath.Join(filepath.Dir(file), "../.."))
install := t.TempDir()
for _, name := range []string{"livepeer", "livepeer-orchestrator", "livepeer-signer", "livepeer-chain", "livepeer-discovery", "livepeer-redeemer"} {
for _, name := range []string{"livepeer", "livepeer-orchestrator", "livepeer-signer", "livepeer-chain", "livepeer-discovery", "livepeer-redeemer", "livepeer-reward-caller"} {
build := exec.Command("go", "build", "-o", filepath.Join(install, name), "./cmd/"+name)
build.Dir = root
output, err := build.CombinedOutput()
Expand All @@ -56,7 +56,7 @@ func TestRealBinaryOffchainFlow(t *testing.T) {
completion, err := exec.Command(dispatcher, "completion", "orchestrator", "bash").CombinedOutput()
require.NoError(t, err, string(completion))
require.Contains(t, string(completion), "bash completion")
for _, component := range []string{"orchestrator", "signer", "chain", "discovery", "redeemer"} {
for _, component := range []string{"orchestrator", "signer", "chain", "discovery", "redeemer", "reward-caller"} {
direct := filepath.Join(install, "livepeer-"+component)
for _, arguments := range [][]string{{"--help"}, {"completion", "bash"}, {"completion", "zsh"}, {"completion", "fish"}, {"completion", "powershell"}} {
actual, err := exec.Command(direct, arguments...).CombinedOutput()
Expand Down
8 changes: 4 additions & 4 deletions cmd/livepeer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func run(args []string) int {
return 0
case "completion":
if len(args) < 2 {
fmt.Fprintln(os.Stderr, "usage: livepeer completion <orchestrator|signer|chain|discovery|redeemer> <bash|zsh|fish|powershell>")
fmt.Fprintln(os.Stderr, "usage: livepeer completion <orchestrator|signer|chain|discovery|redeemer|reward-caller> <bash|zsh|fish|powershell>")
return 2
}
return dispatch(args[1], append([]string{"completion"}, args[2:]...))
case "orchestrator", "signer", "chain", "discovery", "redeemer":
case "orchestrator", "signer", "chain", "discovery", "redeemer", "reward-caller":
return dispatch(args[0], args[1:])
default:
fmt.Fprintf(os.Stderr, "unknown livepeer command %q\n", args[0])
Expand All @@ -43,7 +43,7 @@ func run(args []string) int {
}

func usage() {
fmt.Fprintln(os.Stdout, "Usage: livepeer <orchestrator|signer|chain|discovery|redeemer|completion|version> [args...]")
fmt.Fprintln(os.Stdout, "Usage: livepeer <orchestrator|signer|chain|discovery|redeemer|reward-caller|completion|version> [args...]")
fmt.Fprintln(os.Stdout)
fmt.Fprintln(os.Stdout, "Run 'livepeer help <component>' for component options.")
}
Expand All @@ -68,7 +68,7 @@ func bundledExecutable(component string) (string, error) {

func dispatch(component string, args []string) int {
switch component {
case "orchestrator", "signer", "chain", "discovery", "redeemer":
case "orchestrator", "signer", "chain", "discovery", "redeemer", "reward-caller":
default:
fmt.Fprintf(os.Stderr, "unknown livepeer component %q\n", component)
return 2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
626c93e08f0cb1bc7e392315dabaf3c8be4d1b0ad02608bc0c6c9e525fd8a550
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
724beb5c5f6f0dc7e5b8001dca422a3ce1dc70d7344e844a59495d81a3f629b2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
93772964f1e2f435a9dd454ce0c21a0ac0a74dd8f2bc7c228948cee2061bf10f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3a2d03ae3df69f2d59495c5ce4e82b7068e5e3c61c43e4341d200ea6328f328c
28 changes: 28 additions & 0 deletions cmd/livepeer/testdata/cli/reward-caller-help.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Standalone delegated reward caller

Usage:
livepeer-reward-caller [flags]

Flags:
-c, --config string Configuration file; empty disables discovery (env: LIVEPEER_REWARD_CALLER_CONFIG) (default "config.toml")
-n, --network string Network name (custom networks require explicit chain settings) (env: LIVEPEER_REWARD_CALLER_NETWORK) (default "arbitrum-one-mainnet")
-d, --data-dir string Component data directory; defaults to ~/.lpData/<network>/<component> (env: LIVEPEER_REWARD_CALLER_DATA_DIR) (default "$HOME/.lpData/arbitrum-one-mainnet/reward-caller")
-m, --metrics-listen string Metrics and probe listener (env: LIVEPEER_REWARD_CALLER_METRICS_LISTEN) (default "127.0.0.1:8943")
-a, --account string Dedicated reward caller wallet; must not be an orchestrator or hold bonded stake (env: LIVEPEER_REWARD_CALLER_ACCOUNT)
-o, --orchestrators strings Orchestrator addresses that authorized this wallet as their reward caller (env: LIVEPEER_REWARD_CALLER_ORCHESTRATORS)
-k, --keystore-file string Encrypted geth reward caller account JSON file (env: LIVEPEER_REWARD_CALLER_KEYSTORE_FILE)
--keystore-password-file string Owner-only file containing exact password bytes (env: LIVEPEER_REWARD_CALLER_KEYSTORE_PASSWORD_FILE)
--rpc-url-file string (env: LIVEPEER_REWARD_CALLER_RPC_URL_FILE)
--chain-id uint (env: LIVEPEER_REWARD_CALLER_CHAIN_ID)
--controller-address string (env: LIVEPEER_REWARD_CALLER_CONTROLLER_ADDRESS)
-p, --poll-interval duration Interval between reward checks (env: LIVEPEER_REWARD_CALLER_POLL_INTERVAL) (default 1m0s)
--reward-tx-timeout duration Transaction inclusion timeout (env: LIVEPEER_REWARD_CALLER_REWARD_TX_TIMEOUT) (default 5m0s)
--reward-max-tx-replacements int Maximum fee replacements per transaction (env: LIVEPEER_REWARD_CALLER_REWARD_MAX_TX_REPLACEMENTS) (default 1)
--reward-max-fee-per-gas string Optional maximum fee in wei per gas (env: LIVEPEER_REWARD_CALLER_REWARD_MAX_FEE_PER_GAS)
--print-config[=true|false] Print audited redacted TOML configuration
-h, --help[=true|false] help for livepeer-reward-caller
-v, --version[=true|false] version for livepeer-reward-caller

Environment Variables:
LIVEPEER_REWARD_CALLER_KEYSTORE_PASSWORD Keystore decryption password
LIVEPEER_REWARD_CALLER_RPC_URL
18 changes: 18 additions & 0 deletions configs/reward-caller/config.example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use a dedicated wallet: not a registered or active orchestrator, with no bonded stake.
# Each orchestrator authorizes it once from its own wallet:
# livepeer chain orchestrator reward-caller set 0xYOUR_DEDICATED_WALLET --submit
Network = "arbitrum-one-mainnet"
MetricsListen = "127.0.0.1:8943"
# DataDir = "/var/lib/livepeer/reward-caller"
# Account = "0xYOUR_DEDICATED_WALLET" # Select among shared keystore accounts.
KeystoreFile = "/run/secrets/livepeer-reward-caller-keystore.json"
KeystorePasswordFile = "/run/secrets/livepeer-reward-caller-password"
RPCURLFile = "/run/secrets/livepeer-rpc-url"
Orchestrators = ["0xYOUR_ORCHESTRATOR"]
# Files containing credentials must be owner-only. Password bytes are exact.
# ChainID = 42161
# Controller = "0xD8E8328501E9645d16Cf49539efC04f734606ee4"
PollInterval = "1m"
RewardTxTimeout = "5m"
RewardMaxTxReplacements = 1
# RewardMaxFeePerGas = "1000000000" # Optional ceiling, wei per gas.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Start with [installation](../README.md#install) and the
| [Configuration and secrets](configuration.md) | Set TOML, environment variables, flags, and credentials. |
| [Orchestrator](orchestrator.md) | Register runners, configure networking and proxies, and enable payments. |
| [Standalone redeemer](redeemer.md) | Redeem winning tickets using a dedicated wallet and configure orchestrator forwarding. |
| [Reward caller](reward-caller.md) | Call reward every round for orchestrators from a dedicated, delegated wallet. |
| [Discovery](discovery.md) | Collect and advertise orchestrator inventories without local runners or payments. |
| [Signer](signer.md) | Configure price limits, authorization, discovery, and Kafka accounting. |
| [Chain commands](chain.md) | Inspect accounts, manage stake and funds, and submit transactions. |
Expand Down
5 changes: 4 additions & 1 deletion docs/chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ governance proposal vote ID against|for|abstain [--reason TEXT]
Claims default to the current round, which must be initialized. Unbonding and
fee withdrawal claim earnings automatically. Fee withdrawals default to the
configured account as recipient. Reward calls also default to the configured
account; the target must be active and the caller authorized.
account; the target must be active and the caller authorized, which is checked
before simulation. To call reward every round, run a
[reward caller](reward-caller.md) with a dedicated wallet rather than scheduling
this command with the orchestrator wallet.

## Sign files locally

Expand Down
9 changes: 5 additions & 4 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ commands read only their relevant settings. Use the
[orchestrator](../configs/orchestrator/config.example.toml),
[signer](../configs/signer/config.example.toml),
[discovery](../configs/discovery/config.example.toml),
[redeemer](../configs/redeemer/config.example.toml), and
[redeemer](../configs/redeemer/config.example.toml),
[reward caller](../configs/reward-caller/config.example.toml), and
[chain](../configs/chain/config.example.toml) examples as starting points.

## Select configuration and storage
Expand All @@ -15,7 +16,7 @@ are ignored. Select a file with `--config FILE` or the component's `CONFIG`
environment variable. An explicit config can set `Network` and `DataDir`.
`--config=""` disables config discovery.

`Network` defaults to `arbitrum-one-mainnet` for chain, signer, redeemer, and the
`Network` defaults to `arbitrum-one-mainnet` for chain, signer, redeemer, reward caller, and the
orchestrator's `redemptions` and `migrate` commands. The orchestrator service
defaults to `offchain`. Arbitrum supplies chain, Controller, and ETH/USD feed
defaults. Custom networks require explicit chain and Controller settings.
Expand Down Expand Up @@ -96,7 +97,7 @@ Redeemer webhook URL and headers files must be owner-only regular files.

## Ethereum keystores

Chain, signer, redeemer, and orchestrators redeeming locally discover geth
Chain, signer, redeemer, reward caller, and orchestrators redeeming locally discover geth
accounts in the keystore directory described above. A sole account is selected automatically;
use `Account` / `--account` to select among accounts or `KeystoreFile` /
`--keystore-file` to bypass discovery.
Expand All @@ -110,7 +111,7 @@ Keystore and password files must be regular files readable only by their owner;
target files meet these requirements. Password files follow the exact-byte
rules above; supply an empty file for a keystore without a password.

Signer, redeemer, and orchestrators redeeming locally require these credentials
Signer, redeemer, reward caller, and orchestrators redeeming locally require these credentials
at startup; chain needs them for submissions and local signing. Credential
changes require a restart or a new chain invocation.

Expand Down
1 change: 1 addition & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ gauges; timestamps use Unix seconds. Most event families appear on first use.
| Payments | `payment_operations_total{operation,outcome}` for challenge/receive/refresh/charge; `payment_operation_duration_seconds{operation}` for challenge/receive/refresh; `payment_tickets_total{kind="accepted\|winning"}`, `payment_credit_eth_total`, `payment_charge_eth_total`, `payment_billed_seconds_total`, `payment_fixed_charges_total`, with app identity. Credit is accepted expected ticket value; charges are successfully debited service usage. |
| Signer | `signer_payments_total{type,outcome}`, `signer_payment_duration_seconds{type}`, `signer_tickets_total{type}`, `signer_sign_operations_total{kind,outcome}`. Signing kinds are ticket, segment, state, and orchestrator_info. Partial signing before a failed request remains visible. Successful payment/ticket totals follow required outbox persistence, even if response delivery is interrupted. |
| Authorization | `signer_auth_webhook_requests_total{status,outcome}`, `signer_auth_webhook_duration_seconds`, `signer_auth_cache_hits_total`. Status zero means no webhook response; outcomes distinguish success, denied, and error. |
| Reward caller | `reward_caller_checks_total{orchestrator,outcome}`, `reward_caller_last_reward_round{orchestrator}`, `reward_caller_authorized{orchestrator}`, `reward_caller_gas_balance_eth`, `reward_caller_last_pass_timestamp_seconds`; see [reward caller](reward-caller.md#probes-and-metrics). |
| Redeemer authorization | `redeemer_auth_webhook_requests_total{status,outcome}`, `redeemer_auth_webhook_duration_seconds`. Status is the upstream HTTP status, or zero without a response; outcomes are `success`, `denied`, and `error`. |
| Outbox | Existing `signer_kafka_pending_events`, `signer_kafka_pending_bytes`, `signer_kafka_oldest_event_age_seconds`, `signer_kafka_outbox_healthy`, `signer_kafka_publish_errors_total`, `signer_kafka_enqueue_errors_total`, and `signer_kafka_storage_errors_total`. New `signer_kafka_delivered_events_total` and `signer_kafka_last_delivery_timestamp_seconds` follow successful local acknowledgement; delivery remains at least once. |
| Redemption queue | `redemption_queue_tickets{state}`, `redemption_oldest_ticket_timestamp_seconds{state}`: parameter-expiry `waiting`, clock-eligible `eligible`, `in_flight`, `awaiting_finality`, rejected remote submissions (`rejected`), invalid or reverted local attempts (`blocked`), or `unknown` without a fresh clock observation. Each logical ticket counts once, regardless of signatures or replacements. |
Expand Down
Loading
Loading