fix: Unified Witness RPC with Cloudflare Fallback#100
Merged
Conversation
This reverts commit c7c8e4b.
Troublor
approved these changes
Mar 13, 2026
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
RpcClientwitness fetching by extracting shared fetch-and-decode logic into a privatefetch_witness_from_providermethod, used by both the primaryget_witnessand the newget_witness_from_cloudflarepaths.mega_getBlockWitnessmethod withWitnessRequestKeys, returning a"v0:<base64(zstd(bincode))>"encoded response.Changes
crates/validator-core/src/rpc_client.rscloudflare_witness_providerfield toRpcClient; addnew_with_configparametercloudflare_witness_api; extractfetch_witness_from_provider; addhas_cloudflare_provider()andget_witness_from_cloudflare()public methods; move metrics reporting toget_witness; improve error/trace messages with source tag; add unit testsbin/stateless-validator/src/main.rsNonefor Cloudflare fallback in validator construction; update test mock to match unified RPC formatbin/debug-trace-server/src/main.rsNonefor Cloudflare fallback in trace server constructionTest Plan
test_new_with_valid_url— verifies default client has no Cloudflare providertest_new_with_cloudflare_provider— verifies Cloudflare provider is present when configuredtest_new_with_invalid_cloudflare_url— verifies invalid URL returns errortest_skip_block_verificationupdated for new signature