@@ -63,6 +63,12 @@ const (
6363
6464 // DefaultReturnDataLimit is maximum number of bytes returned from eth_call or similar invocations
6565 DefaultReturnDataLimit = 100000
66+
67+ // DefaultBatchRequestLimit is maximum number of requests in a batch
68+ DefaultBatchRequestLimit = 1000
69+
70+ // DefaultBatchResponseMaxSize maximum number of bytes returned from a batched call
71+ DefaultBatchResponseMaxSize = 25 * 1000 * 1000
6672)
6773
6874var evmTracers = []string {"json" , "markdown" , "struct" , "access_list" }
@@ -126,6 +132,10 @@ type JSONRPCConfig struct {
126132 MetricsAddress string `mapstructure:"metrics-address"`
127133 // ReturnDataLimit defines maximum number of bytes returned from `eth_call` or similar invocations
128134 ReturnDataLimit int64 `mapstructure:"return-data-limit"`
135+ // BatchRequestLimit maximum number of requests in a batch
136+ BatchRequestLimit int64 `mapstructure:"batch-request-limit"`
137+ // BatchResponseMaxSize maximum number of bytes returned from a batched call
138+ BatchResponseMaxSize int64 `mapstructure:"batch-response-max-size"`
129139 // FixRevertGasRefundHeight defines the upgrade height for fix of revert gas refund logic when transaction reverted
130140 FixRevertGasRefundHeight int64 `mapstructure:"fix-revert-gas-refund-height"`
131141}
@@ -231,6 +241,8 @@ func DefaultJSONRPCConfig() *JSONRPCConfig {
231241 EnableIndexer : false ,
232242 MetricsAddress : DefaultJSONRPCMetricsAddress ,
233243 ReturnDataLimit : DefaultReturnDataLimit ,
244+ BatchRequestLimit : DefaultBatchRequestLimit ,
245+ BatchResponseMaxSize : DefaultBatchResponseMaxSize ,
234246 FixRevertGasRefundHeight : DefaultFixRevertGasRefundHeight ,
235247 }
236248}
@@ -343,6 +355,8 @@ func GetConfig(v *viper.Viper) (Config, error) {
343355 MetricsAddress : v .GetString ("json-rpc.metrics-address" ),
344356 ReturnDataLimit : v .GetInt64 ("json-rpc.return-data-limit" ),
345357 FixRevertGasRefundHeight : v .GetInt64 ("json-rpc.fix-revert-gas-refund-height" ),
358+ BatchRequestLimit : v .GetInt64 ("json-rpc.batch-request-limit" ),
359+ BatchResponseMaxSize : v .GetInt64 ("json-rpc.batch-response-max-size" ),
346360 },
347361 TLS : TLSConfig {
348362 CertificatePath : v .GetString ("tls.certificate-path" ),
0 commit comments