Skip to content

perf(rpc): expand ArrayPoolList<byte> coverage across raw-bytes RPC results #11603

@svlachakis

Description

@svlachakis

Context

#11578 introduced ArrayPoolList<byte> as the carrier for eth_signTransaction's raw field, eliminating two heap allocations per call.

The serialize-only ArrayPoolListByteHexConverter is now globally registered in EthereumJsonSerializer, so any RPC type can use ArrayPoolList<byte> without per-property attributes.

This follow-up extends the pattern to:

  1. Request-side deserialization
  2. The other "raw bytes" RPC results that still allocate byte[]

Scope

1. Support reads in ArrayPoolListByteHexConverter

Today, Read throws NotSupportedException.

Implement it so RPC request parameters can also be ArrayPoolList<byte>, allowing us to skip the per-call byte[] allocation currently performed by ByteArrayConverter.

Requirements

  • Parse hex directly into a pool-rented buffer.
    • No intermediate byte[] allocation.
    • Otherwise, this becomes strictly worse than the existing path.
  • Document the lifecycle contract:
    • The caller (the RPC method body) owns disposal of the returned ArrayPoolList<byte>.

2. Convert other raw-bytes RPC results

Audit and switch the following from byte[] (or ResultWrapper<byte[]>) to ArrayPoolList<byte>, applying the same disposal-chain pattern as SignTransactionResult:

  • debug_getRawBlock
  • debug_getRawHeader
  • debug_getRawReceipts
  • debug_getRawTransaction
  • debug_getRawTransactionByHash (if separate)
  • eth_getRawTransactionByHash
  • eth_getRawTransactionByBlockHashAndIndex
  • eth_getRawTransactionByBlockNumberAndIndex
  • Any other byte[]-returning RPC method discovered during the audit

#11587 (comment)
#11587 (comment)
#11587 (comment)

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions