Skip to content

Share canonical payment block and round observations - #39

Merged
j0sh merged 74 commits into
mainfrom
ja-codex/payment-31-shared-observer
Nov 6, 2026
Merged

j0sh merged 74 commits into
mainfrom
ja-codex/payment-31-shared-observer

Conversation

@j0sh

@j0sh j0sh commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Depends on #38. Merge after that PR.

Paid signer and orchestrator processes share an immutable, canonical block/round observation across requests and readiness. Warm metadata reads use memory; independent redemption and finality reads continue through the direct chain adapter.

Separates the protocol L1 clock, chain block identity, current round, and initialized round. Freshness checks distinguish contact from head/L1 progress, preserve valid state across verified polling gaps, and invalidate proven reorgs before further reads. Admission and retained-snapshot consumers revalidate locally at their commit boundaries.

Corrects the existing readiness description because its previous expiry wording becomes inaccurate. Source attribution is retained.

Validation: full race suite, vet, Staticcheck, formatting, and diff checks passed; regressions cover stale providers, reorgs, L1 rollback, delayed signing/commit, and readiness recovery.

Closes #31.

yondonfu and others added 30 commits August 8, 2019 15:45
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 0acd88bbd8c555bebbfc4be9775ba32ed6619cf2
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: eb28eb338ab84d4eae7611b4d530a0ea5be98797
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 84c13f8b82cf4103ea55e7088304e1ead78c6156
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 7fefbe878d4540f52c02177ae7b303dae96cf74c
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: e2e86f042034e50c378c5167f3bd36452b6c9da1
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: a0465f78ade5bc4ccbb6afda847d145df6d3dc04
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 5cc2e35221b1fbf1d994d17d6e6a0a128b010d81
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 5b74602591c67645a422b5414d0fb052158248e4
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 30942f652de14e5ac1eea7a7ea7e0ff7c6cc7f7d
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 1799b33eafcb50fa48171dd5509a50d05fb8fab4
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 894b8db2cf0a98a4ed9175e6063dd0dce1114e7a
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 74fc8f4cf6996533392f36b2ab17df320a958849
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…seen block

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 7d21c328e49e0afc2929c7dbb8d42e31ebd6de04
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 2fb674c587760f121695bffb9415fa99b89ec85d
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
… their language to be perceived as not interfering with node operations

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: d857c1b926b38b2a749aa413e382a8abca1bc91d
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…hat watchers for both latest rounds and latest blocks

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: b4605f705bcad5e355bb0c738d784e4503089900
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…loop

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 466185d0f90a1ed6179db8d9ea25834a5f9ec0a5
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 06cdd9176cb4854d4134d9b424647556fa3b4045
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 1b5f53fe907088672522c72a5a1d76634088bc30
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 003029a6cfba61cef7b4222941287fecdc8084e3
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 55b14ac81132831fb85dabfe4493cc72a82aa7c6
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…chronous

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 3aec3aa1628af8307315bd80123632714f9a4044
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 3719aeed2f9dbf05cbba0c0d2873861f160cca73
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: c2c73fa6f24473311766baee83e2762c87ef708d
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 87c6e404c7a8bd5552e66e346d3659d696e17f4f
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: f30819e43a6b0d9272301a402220d7df64d70063
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 39585360f2cd0c0626ad483e9dd677efb6d09387
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 754c1ed203539275332363eb2cd2940a7fa6c72a
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…itialization

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 4b6ede31f040a084ff9e55bd798a0d6fffee1e1b
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…e last initialization round block)

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: a75e8e26d8e3880724c80f212a2568febd243d52
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Rafal Leszko and others added 11 commits November 6, 2026 15:18
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: f30819e43a6b0d9272301a402220d7df64d70063
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 39585360f2cd0c0626ad483e9dd677efb6d09387
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 754c1ed203539275332363eb2cd2940a7fa6c72a
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…itialization

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 4b6ede31f040a084ff9e55bd798a0d6fffee1e1b
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…e last initialization round block)

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: a75e8e26d8e3880724c80f212a2568febd243d52
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 17a93a67b9cf3409b47e4e01797b2416cb6d234c
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
…ent round is 0 (#2362)

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 11b0600fc76595799205a1229614a1dce954d787
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 159deaa162065f933ac472d11b05510f829d1692
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 8c7ec0155c5ba040f7066ab0a30045c37f15be2a
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
* go.mod: Update livepeer-data lib

* server: Fix MetadataQueue type

Type changed on livepeer-data version

* go.mod: Bump go to 1.20

The upgrade indirectly added a module that requires 1.19

* changelog: Change changelog

* Go 1.20 -> 1.20.4

* Get rid of go-version-file

* Bump lint version

* Set go version in another place

* go fmt

* Add glog goroutine to ignored leak ones

* Change order of go mod command

* Bump linter version

---------

Co-authored-by: Thom Shutt <thomshutt@users.noreply.github.com>

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 1b9da7f25fa8c6261e8c465ea7e5c75166d220b6
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
Signed-off-by: studystill <chenghuiyue@outlook.com>

Source-Repository: https://github.com/livepeer/go-livepeer
Original-Commit: 3a69e439b60acbcfb8edfda15896fb1c25039958
Source-Scope: eth/watchers/roundswatcher.go; eth/watchers/roundswatcher_test.go; eth/watchers/timewatcher.go; eth/watchers/timewatcher_test.go; eth/blockwatch/block_watcher.go; eth/blockwatch/block_watcher_test.go
@j0sh
j0sh force-pushed the ja-codex/payment-31-shared-observer branch from 7c864a7 to cd1df2c Compare November 6, 2026 23:18
Copilot AI balanced review requested due to automatic review settings November 6, 2026 23:18
@j0sh
j0sh temporarily deployed to docker-publish November 6, 2026 23:21 — with GitHub Actions Inactive
@j0sh
j0sh temporarily deployed to docker-publish November 6, 2026 23:21 — with GitHub Actions Inactive
@j0sh
j0sh temporarily deployed to docker-publish November 6, 2026 23:21 — with GitHub Actions Inactive
@j0sh
j0sh temporarily deployed to docker-publish November 6, 2026 23:21 — with GitHub Actions Inactive
@j0sh
j0sh temporarily deployed to docker-publish November 6, 2026 23:24 — with GitHub Actions Inactive
@j0sh
j0sh merged commit c6d7411 into main Nov 6, 2026
10 checks passed
@j0sh
j0sh temporarily deployed to docker-publish November 6, 2026 23:24 — with GitHub Actions Inactive
@j0sh
j0sh temporarily deployed to docker-publish November 6, 2026 23:24 — with GitHub Actions Inactive
@j0sh
j0sh deleted the ja-codex/payment-31-shared-observer branch November 6, 2026 23:24

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.

🔵 Needs a closer look

Both watcher packages cannot compile, and unresolved reorg handling, event ordering, concurrency, and atomic publication defects can leave cached observations stale or inconsistent.

No open issues 🎉

What changed in this PR

Adds upstream-derived block and round watcher code toward #31’s goal of sharing payment-chain observations across request checks and readiness.

Changes:

  • Introduces in-memory round and protocol L1 block tracking with subscriptions.
  • Adds block polling, log backfill, and L1 block-number enrichment.
  • Adds watcher lifecycle, event-handling, and backfill test cases.
File Description
eth/​watchers/​timewatcher.go Adds cached round/L1 state and event subscriptions.
eth/​watchers/​timewatcher_test.go Adds cache, round-event, subscription, and lifecycle tests.
eth/​blockwatch/​block_watcher.go Adds block polling, log backfill, and L1 enrichment.
eth/​blockwatch/​block_watcher_test.go Adds polling, backfill, log-query, and enrichment tests.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 6, 2026 23:25
@j0sh
j0sh temporarily deployed to docker-publish November 6, 2026 23:25 — with GitHub Actions Inactive
j0sh added a commit that referenced this pull request Nov 6, 2026
Depends on #39. Merge after that
PR.

Payment observations confirm and retain RoundsManager, TicketBroker, and
BondingManager addresses at their canonical block. Warm payment reads
reuse those addresses without another Controller lookup. Dependent
values are read only after address confirmation; transaction,
redemption, and finalized settlement resolution remain independent.

Uses the shared observer and counting fixture, with coverage for
replacements within a round, simultaneous round/address changes, invalid
registry results, and reorgs. Reused code retains its source
attribution.

Validation: affected payment suites, `go test -race ./...`, `go vet
./...`, and diff checks passed.

Closes #32.

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

Critical gaps in expiry checks and observation revalidation allow expired receipts to commit tickets and credit parameters, and delayed signing or enqueueing to return successful payments after observations expire or are invalidated.

3 open issues

Review effort: Balanced

Comment on lines +283 to +285
if err := snapshot.Validate(); err != nil {
return ethcommon.Address{}, nil, paymentObservation{err, "error"}
}
Comment thread signer/payment.go
Comment on lines +161 to +163
if err := p.snapshot.Validate(); err != nil {
return signedPayment{}, errors.Join(errPaymentService, err)
}
Comment thread signer/payment.go
Comment on lines +185 to +187
if err := p.snapshot.Validate(); err != nil {
return signedPayment{}, errors.Join(errPaymentService, err)
}

This branch was previously deployed

1 inactive deployment
docker-publish — a813d7f7 Deployed Nov 6, 2026 by j0sh via docker-pr / promote #107
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.

Reuse go-livepeer block and round watchers for payment chain state

7 participants