Skip to content

Steps 1 & 2: Probe signal quality + majorityBaseline protection#2297

Draft
Tomelia1999 wants to merge 1 commit into
mainfrom
epochFloor-implementation
Draft

Steps 1 & 2: Probe signal quality + majorityBaseline protection#2297
Tomelia1999 wants to merge 1 commit into
mainfrom
epochFloor-implementation

Conversation

@Tomelia1999

Copy link
Copy Markdown
Contributor

Summary

Implements roadmap steps 1 and 2 for the consumer's probing mechanism and block-height safety.

  • Step 1 — Probe Signal Quality: providers populate latest_block_fetch_latency_ms and latest_block_change_age_ms in ProbeReply. Consumer uses them for staleness rejection (ProbeStalenessMultiplier × averageBlockTime) and combined-latency endpoint sorting.
  • Step 2 — majorityBaseline Protection: new chainstate package + probe-driven consensus loop in consumer_session_manager.go Phase 2b. Writes to seenBlock and latestSyncData.Block are gated by IsOutlier(majorityBaseline + threshold). Outlier providers are blocked from routing.

Docs

  • Roadmap: protocol/rpcconsumer/docs/probing/improvements-proposals/roadmap.md
  • Detailed proposal: protocol/rpcconsumer/docs/consumer-latestblock-managment/majorityBaseline-protection-mechanism.md
  • Progress: protocol/rpcconsumer/docs/probing/improvements-proposals/fixes-progress.md (Steps 1–2)

Test plan

  • `go test ./protocol/... ./ecosystem/cache/...` green
  • PR has conflicts with `main` (37 commits of drift since branch-off) — resolve before merge

Stacked PR

Base of a 3-PR stack. PR #2 (Step 3) and PR #3 (Step 4) target this branch.

🤖 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 "Steps 1 & 2: Probe signal quality + majorityBaseline protection". 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

Step 1 — Probe Signal Quality:
- Add latest_block_fetch_latency_ms and latest_block_change_age_ms fields
  to ProbeReply. Provider populates them from chainTracker.GetLatestFetchLatency()
  and time-since-last-block-change.
- Consumer uses them for probe staleness rejection (ProbeStalenessMultiplier ×
  averageBlockTime) and combined-latency endpoint sorting.
- Add GetAverageBlockTime() helper on ProviderOptimizer.

Step 2 — majorityBaseline Protection:
- New chainstate package: ChainState struct with majorityBaseline/outlierThreshold
  + IsOutlier guard, ComputeMajorityBaseline consensus algorithm.
- probeProviders restructured into Phase 1 (concurrent probes) -> Phase 2a
  (per-provider scoring) -> Phase 2b (consensus + outlier blocking).
- Writes to seenBlock and latestSyncData.Block now guarded by IsOutlier.
- Outlier providers blocked from routing via blockOutlierProviders.

See protocol/rpcconsumer/docs/probing/improvements-proposals/roadmap.md
for the broader four-step plan.
@Tomelia1999 Tomelia1999 force-pushed the epochFloor-implementation branch from c01a747 to 77d496b Compare May 27, 2026 09:24
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.49289% with 268 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
protocol/metrics/consumer_metrics_manager.go 4.21% 91 Missing ⚠️
protocol/lavasession/consumer_session_manager.go 41.48% 74 Missing and 5 partials ⚠️
x/pairing/types/relay.pb.go 0.00% 48 Missing ⚠️
protocol/rpcconsumer/rpcconsumer.go 0.00% 15 Missing ⚠️
protocol/rpcprovider/rpcprovider_server.go 0.00% 13 Missing ⚠️
protocol/rpcsmartrouter/rpcsmartrouter.go 0.00% 11 Missing ⚠️
protocol/metrics/consumer_metrics_manager_inf.go 0.00% 3 Missing ⚠️
protocol/rpcsmartrouter/rpcsmartrouter_server.go 0.00% 3 Missing ⚠️
protocol/chaintracker/dummy_chain_tracker.go 0.00% 2 Missing ⚠️
protocol/metrics/smartrouter_metrics_manager.go 0.00% 2 Missing ⚠️
... and 1 more
Flag Coverage Δ
consensus 8.95% <0.00%> (-0.01%) ⬇️
protocol 35.59% <41.17%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
protocol/chainstate/chain_state.go 100.00% <100.00%> (ø)
protocol/chaintracker/chain_tracker.go 60.59% <100.00%> (-0.77%) ⬇️
protocol/common/cobra_common.go 0.00% <ø> (ø)
protocol/lavasession/consumer_types.go 77.90% <ø> (+0.66%) ⬆️
protocol/provideroptimizer/provider_optimizer.go 57.66% <100.00%> (+1.95%) ⬆️
protocol/relaycore/consistency.go 66.66% <100.00%> (+7.20%) ⬆️
protocol/relaycore/relay_processor.go 60.13% <100.00%> (+0.08%) ⬆️
protocol/rpcconsumer/rpcconsumer_server.go 32.10% <66.66%> (+0.07%) ⬆️
protocol/chaintracker/dummy_chain_tracker.go 0.00% <0.00%> (ø)
protocol/metrics/smartrouter_metrics_manager.go 27.35% <0.00%> (-0.08%) ⬇️
... and 8 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
7 files   ±0   0 ❌ ±0 

Results for commit 77d496b. ± Comparison against base commit 8fae505.

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