Skip to content

fix(rpc): compute envelope max size arithmetically to avoid OOM#26

Open
Subhasish-Behera wants to merge 1 commit intograndinetech:epbs-devnet-2from
Subhasish-Behera:Subh/OOM_fix
Open

fix(rpc): compute envelope max size arithmetically to avoid OOM#26
Subhasish-Behera wants to merge 1 commit intograndinetech:epbs-devnet-2from
Subhasish-Behera:Subh/OOM_fix

Conversation

@Subhasish-Behera
Copy link
Copy Markdown

  • The previous implementation used SignedExecutionPayloadEnvelope::full() to determine the max SSZ size for RPC limits. This initiated all variable-length fields at maximum capacity, including MAX_TRANSACTIONS_PER_PAYLOAD transactions each at MAX_BYTES_PER_TRANSACTION, causing multi-GB allocations that triggered OOM during libp2p initialization.

  • not preffering ghost value style calculations like SIGNED_BEACON_BLOCK_BELLATRIX_MAX for futrure reference about the calculations

  • Replace with full_gloas_signed_execution_payload_envelope_size<P>() which serializes the envelope with default (empty) transactions and adds the transaction contribution arithmetically: N * (BYTES_PER_LENGTH_OFFSET + max_bytes_per_transaction)

  • This produces the same max size value without allocating the actual transaction bytes.

  • account for block_access_list in max envelope size

  - The previous implementation used `SignedExecutionPayloadEnvelope::full()`
  to determine the max SSZ size for RPC limits. This initiated all
  variable-length fields at maximum capacity, including MAX_TRANSACTIONS_PER_PAYLOAD
  transactions each at MAX_BYTES_PER_TRANSACTION, causing multi-GB allocations
  that triggered OOM during libp2p initialization.

  - not preffering ghost value style calculations like SIGNED_BEACON_BLOCK_BELLATRIX_MAX
  for futrure reference about the calculations

  - Replace with `full_gloas_signed_execution_payload_envelope_size<P>()` which
  serializes the envelope with default (empty) transactions and adds the
  transaction contribution arithmetically:
    N * (BYTES_PER_LENGTH_OFFSET + max_bytes_per_transaction)

  - This produces the same max size value without allocating the actual transaction
  bytes.

- account for `block_access_list` in max envelope size
@hangleang
Copy link
Copy Markdown
Collaborator

pushed your fix to upstream! unfortunately, I can't reproduce the issue, but the fix semantically look correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants