rpc: eth_getProof support MarshalFastJSONTo - #24105
Merged
Merged
Conversation
The stream hex-encodes straight into its own buffer; the tracer logger writes memory words, storage values and return data through it.
…etCode writeResponse streams a MarshalFastJSONTo result into the response, and hexutil.Bytes writes itself with WriteHex.
…ng MarshalFastJSONTo The json/v2 benchmark moves to its own go1.27 file. The transport failure test also covers a MarshalFastJSONTo result that fails before writing.
A result writes one value, so the lazy open guard is not needed yet; responseWriter keeps main's method shape.
… racing the service loop TestBlockServiceQueuesClockBoundaryBlockForRetry called processScheduledBlock while the service's loop could hold the job; the direct call then returned at once and calls was still 1.
…7' into alex/jsonstream_write_hex_37
…to alex/marshal_fast_json_to_37
The transport failure test body stays unchanged behind a helper, and the typed-nil case joins the streaming test.
…nchmark A slice value is boxed and copied by reflect.New on every call, which charged json/v2 two allocations the server path never pays.
writeResponse and streamable methods share writeLazyResponse: the envelope goes first, LazyFieldStream opens "result" on the first value, and an error becomes "error". responseWriter is gone; json.Encoder output reaches the stream through a small io.Writer.
…hrough WriteRawBytes WriteRawBytes appended the value, which already sat in the buffer tail, onto itself.
…to alex/marshal_fast_json_to_37
…n_to_37 # Conflicts: # common/hexutil/bytes.go
Every field name Erigon writes is a source literal or a hex string, so appending it raw is enough; ERIGON_ASSERT catches a name that is not.
runMethod writes the error into the stream, so it returns it too: handleCall counts the failed request and handleCallMsg logs it, as before the lazy response. A typed nil takes the reflection path for every fast-JSON interface.
…alFastJSONTo The stream gains WriteHexUint64 and WriteHexQuantity, so a quantity needs no intermediate buffer.
A []byte hint escapes through the interface call: 1024 storage slots allocated 1024 times.
Lets a field and its value chain: s.WriteObjectField("gas").WriteHex(v).
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Direct RPC response paths still do not propagate errors latched during quoted text encoding.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Balanced
…a latched error to direct responses
…to_37_2' into alex/jsonstream_raw_field_37 # Conflicts: # rpc/jsonstream/lazy_field_stream.go # rpc/jsonstream/stack_stream.go # rpc/jsonstream/stream.go
Reason: Field names are hardcoded in Erigon (or hex) n5, 8 cores: `"gas"` 7.25ns -> 3.47ns, a 66-char hex key 19.1ns -> 4.86ns.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The field-name fast path can emit malformed JSON, and the narrowed pooling API breaks existing callers.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 2
- Review effort level: Balanced
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Text-appender failure recovery can emit malformed buffered JSON-RPC output.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 1
- Review effort level: Balanced
taratorio
approved these changes
Sep 19, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 19, 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.
eth_getProofthroughrpc.Server.ServeHTTP, 9 account-proof nodes and 7 nodes per slot, base #24086 vs this PR (n3, AMD Ryzen 9 5900X, GOMAXPROCS=4, 10 runs):maxGetProofKeys)Replaces #24089: based on #24086 instead of the RPCLogs stack, and without a
JSONAppenderinterface. Quantities go throughWriteQuotedText(encoding.TextAppender), so nohexutiltype needs its own stream method.Stacked on #24086.