Skip to content

fix(ws): pin near-tip getBlock to EvmLeaderUpstream - #14

Merged
shpookas merged 3 commits into
feat/websocket-supportfrom
fix/pin-near-tip-getblock-to-evm-leader
Jul 31, 2026
Merged

fix(ws): pin near-tip getBlock to EvmLeaderUpstream#14
shpookas merged 3 commits into
feat/websocket-supportfrom
fix/pin-near-tip-getblock-to-evm-leader

Conversation

@shpookas

@shpookas shpookas commented Jul 31, 2026

Copy link
Copy Markdown

Summary

  • In Network.Forward, after partitionUpstreamsByLatestBlock, pin near-tip eth_getBlockByNumber (bn in [leader, leader+1]) to EvmLeaderUpstream via UseUpstream when unset.
  • Same idea as PR11 tip re-fetch pin, earlier in the path so the first attempt hits the tip owner instead of a lagging sibling.

Notes

  • ~14 lines in networks.go only. No escape-hatch / SkipFallbackEscape changes.
  • Tradeoff: tip getBlock concentrates on the leader.

Test plan

  • Existing TestHttpServer_GetBlockByNumberLatest_RefetchPinsEvmLeaderUpstream still passes
  • Canary: tip getBlock should prefer leader WS upstream; Infura escape rate should drop

Direct tip/tip+1 getBlock reads set UseUpstream to the primary leader
(typically the WS ingress advanced by SuggestLatestBlock) on first
forward — same idea as PR11 tip re-fetch pin, so the lagging sibling is
not tried first.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
File Lines Key changes Risk
🔵 networks.go +40/-0 pinNearTipGetBlockToLeader
1 test files +135

xray — see through AI slop with deterministic architecture PR diff reviews

shpookas and others added 2 commits July 31, 2026 14:00
Drop helper + dedicated HTTP test; keep only the small UseUpstream pin
next to partitionUpstreamsByLatestBlock.

Co-authored-by: Cursor <cursoragent@cursor.com>
Flatten nested Forward pin into early-return helper; assert lagging
sibling gets zero hits on concrete tip getBlock.

Co-authored-by: Cursor <cursoragent@cursor.com>
@shpookas
shpookas merged commit 9e39885 into feat/websocket-support Jul 31, 2026
2 of 3 checks passed
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.

2 participants