Skip to content

Step 4: Unify seenBlock and latestSyncData.Block into a chain-wide tracker#2299

Draft
Tomelia1999 wants to merge 1 commit into
step-3-sync-score-from-probesfrom
unify-seenBlock-globalLatestBlock
Draft

Step 4: Unify seenBlock and latestSyncData.Block into a chain-wide tracker#2299
Tomelia1999 wants to merge 1 commit into
step-3-sync-score-from-probesfrom
unify-seenBlock-globalLatestBlock

Conversation

@Tomelia1999

Copy link
Copy Markdown
Contributor

Summary

Collapses two parallel "latest block on chain" stores into one chain-wide ChainState.latestBlock:

  • Per-user seenBlock (ristretto cache, 5-min TTL, keyed by dappId__consumerIp) — gone.
  • Per-chain latestSyncData.Block (no TTL, in ProviderOptimizer) — gone.

Sample-fresh sync scoring (providerData.SyncBlock field deleted; outlier samples drop ALL scoring), atomic SetLatestBlock returning (block, time, advanced), race-window detection between IsOutlier and SetLatestBlock, pathological-value guard. WS subscription update lifted out of the per-dappKey fan-out loop. sharedStateId collapses to a chain-wide cache key (mixed-version compat preserved). Phase A/B/C/D + 7 Prometheus observability metrics + tier-A chaos test harness.

Docs

  • Design doc: protocol/rpcconsumer/docs/consumer-latestblock-managment/unify-seenBlock-latestSyncData.md (12 formal decisions in §11, implementation task list in §14)
  • Demo scenarios: protocol/rpcconsumer/docs/consumer-latestblock-managment/testing-process/unification-demo-scenarios.md
  • Env setup + validation: protocol/rpcconsumer/docs/consumer-latestblock-managment/testing-process/unification-demo-env-setup.md (§8 covers the 7 Prometheus metrics)
  • Chaos test harness: scripts/test/chaos/tier_a_poisoning/
  • Progress: protocol/rpcconsumer/docs/probing/improvements-proposals/fixes-progress.md (Step 4)

Test plan

  • `go test ./protocol/... ./ecosystem/cache/...` green
  • Live validation against local Lava + 3 providers + cache + 2 consumers (scenarios A2, B1, B2, C3, D2, E1 — see env setup doc)
  • 7 Prometheus metrics confirmed live (M1–M7)
  • Tier-A chaos suite shipped (5 poisoning scenarios + smoke + run-all)

Stacked PR

Depends on #2297 (Steps 1+2) and #2298 (Step 3). Targets `step-3-sync-score-from-probes`.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented May 25, 2026

Copy link
Copy Markdown

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Step 4: Unify seenBlock and latestSyncData.Block into a chain-wide tracker". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

Squashed from 4 commits (077d068, 15c1f71, a387fa0, 3762b2b).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Tomelia1999 Tomelia1999 force-pushed the unify-seenBlock-globalLatestBlock branch from 3762b2b to 1250710 Compare May 27, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant