diff --git a/docs/dev/read/overview.md b/docs/dev/read/overview.md index 08b90de..630a339 100644 --- a/docs/dev/read/overview.md +++ b/docs/dev/read/overview.md @@ -117,6 +117,19 @@ All available methods are subject to rate limiting based on two criteria: User limits are dynamically updated in response to individual behavior. +## Request Body Limits + +The public RPC endpoint caps the size of the request body, and the cap depends on the method being called: + +| Method class | Maximum body size | +| --------------------------------------------------------------------------------------------------- | ----------------- | +| Transaction submission (`eth_sendRawTransaction`, `realtime_sendRawTransaction`) | 2.5 MiB | +| Large reads and simulations (`eth_call`, `eth_callMany`, `eth_createAccessList`, `eth_estimateGas`) | 1.5 MiB | +| All other methods | 128 KiB | + +The higher limits for simulation methods let you estimate gas for or simulate large contract deployments, whose initcode can exceed the 128 KiB default. +A request whose body exceeds the applicable limit is rejected with HTTP `413` and RPC error `-32099` (`payload too large`) — see [Error Codes](rpc/error-codes.md). + ## Related Pages - [Realtime API](realtime-api.md) — use-case guide for streaming data and instant receipts diff --git a/docs/dev/read/rpc/error-codes.md b/docs/dev/read/rpc/error-codes.md index 69ee03f..5a323c0 100644 --- a/docs/dev/read/rpc/error-codes.md +++ b/docs/dev/read/rpc/error-codes.md @@ -4,15 +4,16 @@ description: MegaETH JSON-RPC error codes — HTTP status codes, RPC error codes # Error Codes -| HTTP Error Code | RPC Error Code | Error Message | Explanation | Mitigation | -| --------------- | -------------- | -------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| 400 | -32700 | `parse error` | The request body contains invalid JSON. | Check the request format and ensure valid JSON syntax. | -| 403 | -32601 | `rpc method is not whitelisted` | The requested RPC method is not allowed by the proxy configuration. | Use only whitelisted RPC methods. Contact MegaETH if you need access to additional methods. | -| 400 | -32019 | `block is out of range` | The requested block number is out of range. | Check the block number and ensure it's within the valid range. | -| 500 | -32020 | `backend response too large` | The backend response is too large. | Reduce the scope of the request or contact MegaETH for assistance. | -| 429 | -32021 | `over network traffic limit, retry in X seconds` | The user is incurring too much network traffic. | Wait for the specified number of seconds before retrying. Reduce the number of requests sent per second. | -| 429 | -32022 | `over compute unit limit, retry in X seconds` | The user is incurring too much computation on the backend RPC server. | Wait for the specified number of seconds before retrying. Reduce the number of requests sent per second. | -| 200 | -32000 | `permanent error forwarding request context deadline exceeded` | The API proxy cannot connect to the backend RPC server. | Pause for a while and retry. Notify MegaETH if the error persists. | +| HTTP Error Code | RPC Error Code | Error Message | Explanation | Mitigation | +| --------------- | -------------- | -------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| 400 | -32700 | `parse error` | The request body contains invalid JSON. | Check the request format and ensure valid JSON syntax. | +| 413 | -32099 | `payload too large` | The request body exceeds the size limit for the method being called. | Stay within the body-size limit for the method class. See [Request Body Limits](../overview.md#request-body-limits). | +| 403 | -32601 | `rpc method is not whitelisted` | The requested RPC method is not allowed by the proxy configuration. | Use only whitelisted RPC methods. Contact MegaETH if you need access to additional methods. | +| 400 | -32019 | `block is out of range` | The requested block number is out of range. | Check the block number and ensure it's within the valid range. | +| 500 | -32020 | `backend response too large` | The backend response is too large. | Reduce the scope of the request or contact MegaETH for assistance. | +| 429 | -32021 | `over network traffic limit, retry in X seconds` | The user is incurring too much network traffic. | Wait for the specified number of seconds before retrying. Reduce the number of requests sent per second. | +| 429 | -32022 | `over compute unit limit, retry in X seconds` | The user is incurring too much computation on the backend RPC server. | Wait for the specified number of seconds before retrying. Reduce the number of requests sent per second. | +| 200 | -32000 | `permanent error forwarding request context deadline exceeded` | The API proxy cannot connect to the backend RPC server. | Pause for a while and retry. Notify MegaETH if the error persists. | ## Related Pages diff --git a/docs/dev/send-tx/gas-estimation.md b/docs/dev/send-tx/gas-estimation.md index 67bd93f..11938e7 100644 --- a/docs/dev/send-tx/gas-estimation.md +++ b/docs/dev/send-tx/gas-estimation.md @@ -75,6 +75,13 @@ There are two workarounds: For reference, standard Ethereum node software (geth, reth) defaults to 50M, and providers like Alchemy support up to 550M. See the [RPC Providers](../tooling.md#rpc-providers) table for providers that support MegaETH. +### Request Body Size for Large Deployments + +Estimating gas for a large contract deployment sends the full initcode in the request body. +To accommodate this, the public RPC endpoint allows `eth_call`, `eth_callMany`, `eth_createAccessList`, and `eth_estimateGas` bodies up to **1.5 MiB** — well above the 128 KiB limit applied to ordinary read methods. +A request that exceeds this limit is rejected with HTTP `413` / `-32099` (`payload too large`). +See [Request Body Limits](../read/overview.md#request-body-limits) for the full breakdown. + ## Toolchain Configuration ### Foundry