proxyd: skip consensus polling for forced candidate backends - #608
Open
jcortejoso wants to merge 155 commits into
Open
jcortejoso wants to merge 155 commits into
jcortejoso wants to merge 155 commits into
Conversation
Upstream rebase
Fix `missing trie node` error
- Introduced a new TOML configuration file for sequencer and network settings. - Added support for multiple sequencer configurations with specific URLs and voting options. - Updated the Python version to 3.12.7 in the project.
…delete Python version specification
…ll workflow files
Add configuration for sequencers and networks
…ling - Introduced a new test function `TestContainsArchiveRequiredError` to validate various scenarios for detecting archive required errors in RPC responses. - Enhanced the `containsArchiveRequiredError` function to check for additional error messages related to state availability for blocks.
- Added checks for new error messages related to the maximum proof window and distance to target block in the `containsArchiveRequiredError` function to improve error handling for RPC responses.
- Updated the `rewriteParam` function to improve error handling for out-of-range block requests. - Introduced `handleRewriteTagResult` to manage responses based on error conditions. - Modified tests to validate that out-of-range block requests return null instead of an error. - Enhanced the `TestRewriteRequest` and `TestConsensus` tests to reflect the new behavior for `eth_getBlockByNumber` requests.
- Added checks for new error messages related to data availability in the `containsArchiveRequiredError` function to improve error handling for RPC responses.
- Added .gocache and .gomodcache to the .gitignore file to prevent caching files from being tracked in the repository.
- Added additional checks for error messages related to pruned state blocks in the `containsArchiveRequiredError` function to further improve error handling for RPC responses.
Proxyd: return `null` for out-of-range block requests
Update workflow name
- Added logic to set `archiveRequired` to true for any RPC requests with methods that start with "debug_". This ensures that the necessary archive nodes are utilized for these requests.
Add a new `watched_addresses` config option that accepts a list of Ethereum addresses. When a transaction's `from` or `to` field matches any watched address, all available transaction details are logged (hash, from, to, nonce, value, gas, gasPrice, gasTipCap, gasFeeCap, chainId, txType, data, blobGas, etc.). Supports eth_sendRawTransaction (full decoded tx details), eth_sendTransaction, eth_call, and eth_estimateGas (call object fields). Integrated into both HTTP RPC and WebSocket request paths.
When backends with limited archive retention return "no transactions snapshot file" errors, proxyd now automatically retries with backends that have fuller archive data (e.g., Alchemy with full chain history). Changes: - Added "no transactions snapshot file" pattern to containsArchiveRequiredError() - Checks both Error.Message and Error.Data fields for the pattern - Added unit tests verifying the error detection works correctly This leverages the existing two-phase retry logic in ForwardRequestToBackendGroup, which automatically tries archive backends when archive-required errors are detected. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ting Route eth_getBlockReceipts to archive backends based on block age to prevent non-archive nodes returning empty receipt arrays for old blocks. Make the archive block threshold configurable (archive_block_threshold) instead of hardcoded at 128 blocks, defaulting to 128 when unset. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Non-archive backends return "result": [] (valid JSON-RPC success) for eth_getBlockReceipts on pruned blocks instead of an error. This causes op-node to fail with "got 0 receipts but expected N". Detect empty receipt arrays and retry on other backends including archive nodes, reusing the existing archive retry infrastructure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Proxyd latest changes
Returns 200 OK when all backend groups have at least one healthy backend, and 503 when any group has no healthy backends. This enables GCP load balancers to detect proxyd instances that cannot serve requests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add /readyz readiness endpoint to proxyd
Change ConsensusMaxBlockLag from uint64 to *uint64 so that an explicit 0 in config is distinguishable from "not set" (which falls back to the default of 8). This enables zero-tolerance block lag for testnet environments.
…ck-lag proxyd: allow consensus_max_block_lag to be set to 0
Backends with consensus_forced_candidate=true are now excluded from the consensus polling loop. They remain in the consensus group for request routing (including archive requests) but generate zero health check traffic (eth_syncing, net_peerCount, eth_getBlockByNumber). This is useful for paid backends like Alchemy that should serve archive requests but shouldn't be flooded with polling requests when idle. Changes: - Skip forced candidates in the primary and fallback polling loops - Skip forced candidates in consensus block number calculations - Skip forced candidates in block hash verification - Skip forced candidates in the block lag filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
consensus_forced_candidate = trueare now excluded from the consensus polling loop entirely — zero health check requests (eth_syncing,net_peerCount,eth_getBlockByNumber)restrict_archive_node_traffic = trueMotivation
When paid backends like Alchemy are in a consensus-aware group, the consensus poller sends ~5 RPC requests/second/backend for health checks — even when the proxyd instance receives zero frontend traffic. This generates unnecessary costs.
With this change, configuring a backend with
consensus_forced_candidate = truemeans it participates in routing (especially archive request routing) without any polling overhead.Example config
Test plan
TestConsensusForcedCandidateintegration tests verify:TestConsensustests pass (38/38)