Replace AnyNetwork with AnyNetworkBare to remove WithOtherFields deserialization overhead#6398
Merged
incrypto32 merged 1 commit intomasterfrom Feb 25, 2026
Merged
Conversation
lutter
approved these changes
Feb 24, 2026
| /// | ||
| /// Uses `AnyTxEnvelope` (not `TxEnvelope`) to support non-standard transaction types from | ||
| /// L2s and sidechains. `TransactionRequest` retains `WithOtherFields` because upstream | ||
| /// `From` impls for `AnyTxEnvelope` only exist on `WithOtherFields<TransactionRequest>`. |
Collaborator
There was a problem hiding this comment.
Would it be worth to ask upstream to change that?
Member
Author
There was a problem hiding this comment.
Upstream is right . AnyTxEnvelope can carry unknown tx type fields that a bare TransactionRequest has no place for. Just documenting why this one retains the wrapper.
…ve WithOtherFields overhead AnyNetwork wraps every RPC response (block, transaction, receipt) in WithOtherFields<T>, which uses #[serde(flatten)] to capture unknown JSON keys into a BTreeMap. This forces serde to buffer entire JSON objects into intermediate Value maps and re-serialize them to diff keys on every block and every transaction. graph-node never reads these extra fields. Define AnyNetworkBare, a custom Network impl that uses the same AnyTxEnvelope/AnyReceiptEnvelope types (for L2/sidechain tx support) but without the WithOtherFields wrapper on response types. This eliminates the flatten buffering, BTreeMap allocation, and re-serialization from the deserialization hot path.
072910d to
8666ef9
Compare
incrypto32
added a commit
that referenced
this pull request
Feb 25, 2026
…ve WithOtherFields overhead (#6398) AnyNetwork wraps every RPC response (block, transaction, receipt) in WithOtherFields<T>, which uses #[serde(flatten)] to capture unknown JSON keys into a BTreeMap. This forces serde to buffer entire JSON objects into intermediate Value maps and re-serialize them to diff keys on every block and every transaction. graph-node never reads these extra fields. Define AnyNetworkBare, a custom Network impl that uses the same AnyTxEnvelope/AnyReceiptEnvelope types (for L2/sidechain tx support) but without the WithOtherFields wrapper on response types. This eliminates the flatten buffering, BTreeMap allocation, and re-serialization from the deserialization hot path.
incrypto32
added a commit
that referenced
this pull request
Feb 25, 2026
…ve WithOtherFields overhead (#6398) AnyNetwork wraps every RPC response (block, transaction, receipt) in WithOtherFields<T>, which uses #[serde(flatten)] to capture unknown JSON keys into a BTreeMap. This forces serde to buffer entire JSON objects into intermediate Value maps and re-serialize them to diff keys on every block and every transaction. graph-node never reads these extra fields. Define AnyNetworkBare, a custom Network impl that uses the same AnyTxEnvelope/AnyReceiptEnvelope types (for L2/sidechain tx support) but without the WithOtherFields wrapper on response types. This eliminates the flatten buffering, BTreeMap allocation, and re-serialization from the deserialization hot path.
incrypto32
added a commit
that referenced
this pull request
Feb 25, 2026
…ve WithOtherFields overhead (#6398) AnyNetwork wraps every RPC response (block, transaction, receipt) in WithOtherFields<T>, which uses #[serde(flatten)] to capture unknown JSON keys into a BTreeMap. This forces serde to buffer entire JSON objects into intermediate Value maps and re-serialize them to diff keys on every block and every transaction. graph-node never reads these extra fields. Define AnyNetworkBare, a custom Network impl that uses the same AnyTxEnvelope/AnyReceiptEnvelope types (for L2/sidechain tx support) but without the WithOtherFields wrapper on response types. This eliminates the flatten buffering, BTreeMap allocation, and re-serialization from the deserialization hot path.
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.
AnyNetwork wraps every RPC response (block, transaction, receipt) in
WithOtherFields<T>, which uses#[serde(flatten)]to capture unknown JSON keys into a BTreeMap. This forces serde to buffer entire JSON objects into intermediate Value maps and re-serialize them to diff keys on every block and every transaction. graph-node never reads these extra fields.Define
AnyNetworkBare, a custom Network impl that uses the sameAnyTxEnvelope/AnyReceiptEnvelopetypes (for L2/sidechain tx support) but without the WithOtherFields wrapper on response types. This eliminates the flatten buffering, BTreeMap allocation, and re-serialization from the deserialization hot path.