Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,50 @@ type EVMConfig struct {
WorkerPoolSize int `toml:"worker_pool_size"`
WorkerQueueSize int `toml:"worker_queue_size"`

MaxFilters uint64 `toml:"max_filters"`
MaxBlockFilterHashes uint64 `toml:"max_block_filter_hashes"`
MaxSubscriptionsLogs uint64 `toml:"max_subscriptions_logs"`
MaxLogBytes int64 `toml:"max_log_bytes"`

EnableSimulation bool `toml:"enable_simulation"`
MaxEstimateGasCalls int `toml:"max_estimate_gas_calls"`
MaxStateOverrideAccounts int `toml:"max_state_override_accounts"`
MaxStateOverrideSlots int `toml:"max_state_override_slots"`

MaxTraceStructLogBytes uint64 `toml:"max_trace_struct_log_bytes"`
TraceAllowedTracers []string `toml:"trace_allowed_tracers"`
TraceAllowJSTracers bool `toml:"trace_allow_js_tracers"`
EnableParallelizedBlockTrace bool `toml:"enable_parallelized_block_trace"`

// Trace baking re-executes each committed block in the background and
// caches the trace output so debug_trace* can serve from cache.
TraceBakeEnabled bool `toml:"trace_bake_enabled"`
TraceBakeWorkers int `toml:"trace_bake_workers"`
TraceBakeQueueSize int `toml:"trace_bake_queue_size"`
TraceBakeTracers []string `toml:"trace_bake_tracers"`
TraceBakeWindowBlocks int64 `toml:"trace_bake_window_blocks"`
TraceBakeUseSnapshot bool `toml:"trace_bake_use_snapshot"`
TraceBakeSnapshotWindow int64 `toml:"trace_bake_snapshot_window"`

// Per-IP rate limiting and request admission on the EVM HTTP plane.
RateLimitingEnabled bool `toml:"rate_limiting_enabled"`
IPRateLimitRPS float64 `toml:"ip_rate_limit_rps"`
IPRateLimitBurst int `toml:"ip_rate_limit_burst"`
TrustedProxyCIDRs []string `toml:"trusted_proxy_cidrs"`

BatchRequestLimit int `toml:"batch_request_limit"`
BatchResponseMaxSize int `toml:"batch_response_max_size"`
MaxRequestBodyBytes int64 `toml:"max_request_body_bytes"`
MaxConcurrentRequestBytes int64 `toml:"max_concurrent_request_bytes"`
BodyReadIdleTimeout Duration `toml:"body_read_idle_timeout"`
WSAdmissionTimeout Duration `toml:"ws_admission_timeout"`
MaxOpenConnections int `toml:"max_open_connections"`

// RPCMethodTimeouts entries are "method=duration" (e.g. "eth_call=60s");
// a method ending in "*" matches every method with that prefix.
RPCDefaultTimeout Duration `toml:"rpc_default_timeout"`
RPCMethodTimeouts []string `toml:"rpc_method_timeouts"`

Query EVMQueryConfig `toml:"query"`
Replay EVMReplayConfig `toml:"replay"`
BlockTest EVMBlockTestConfig `toml:"block_test"`
Expand Down Expand Up @@ -586,3 +630,18 @@ func defaultConcurrencyWorkers() int {
func defaultEVMWorkerPoolSize() int {
return min(64, runtime.NumCPU()*2)
}

// nativeTraceTracers are the native geth tracer names seid accepts in
// evm.trace_allowed_tracers and evm.trace_bake_tracers.
var nativeTraceTracers = map[string]bool{
"4byteTracer": true,
"callTracer": true,
"flatCallTracer": true,
"muxTracer": true,
"noopTracer": true,
"prestateTracer": true,
}

func defaultTraceAllowedTracers() []string {
return []string{"callTracer", "prestateTracer", "flatCallTracer", "4byteTracer", "noopTracer", "muxTracer"}
}
27 changes: 27 additions & 0 deletions defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,33 @@ func baseDefaults() *SeiConfig {
RPCStatsInterval: Dur(10 * time.Second),
WorkerPoolSize: defaultEVMWorkerPoolSize(),
WorkerQueueSize: 1000,
MaxFilters: 1000,
MaxBlockFilterHashes: 1000,
MaxSubscriptionsLogs: 1000,
MaxLogBytes: 64 << 20, // 64 MiB
EnableSimulation: true,
MaxEstimateGasCalls: 100,
MaxStateOverrideAccounts: 100,
MaxStateOverrideSlots: 1000,
MaxTraceStructLogBytes: 32 << 20, // 32 MiB
TraceAllowedTracers: defaultTraceAllowedTracers(),
TraceBakeWorkers: 1,
TraceBakeQueueSize: 4096,
TraceBakeTracers: []string{"callTracer"},
TraceBakeSnapshotWindow: 64,
RateLimitingEnabled: true,
IPRateLimitRPS: 200,
IPRateLimitBurst: 200,
TrustedProxyCIDRs: []string{},
BatchRequestLimit: 100,
BatchResponseMaxSize: 25_000_000, // 25 MB
MaxRequestBodyBytes: 5 << 20, // 5 MiB
MaxConcurrentRequestBytes: 128 << 20, // 128 MiB
BodyReadIdleTimeout: Dur(10 * time.Second),
WSAdmissionTimeout: Dur(30 * time.Second),
MaxOpenConnections: 2000,
RPCDefaultTimeout: Dur(30 * time.Second),
RPCMethodTimeouts: []string{"eth_estimateGasAfterCalls=5m"},
Query: EVMQueryConfig{
GasLimit: 300_000,
},
Expand Down
122 changes: 122 additions & 0 deletions enrichments.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,128 @@ func DefaultEnrichments() map[string][]FieldOption {
"evm.worker_pool_size": {
WithDescription("Number of workers in the EVM RPC worker pool. 0 for default."),
},
"evm.max_filters": {
WithDescription("Maximum active eth_newFilter and eth_newBlockFilter filters. Must be > 0."),
},
"evm.max_block_filter_hashes": {
WithDescription("Maximum unpolled block hashes retained per eth_newBlockFilter filter. Must be > 0."),
},
"evm.max_subscriptions_logs": {
WithDescription("Maximum concurrent logs subscriptions."),
},
"evm.max_log_bytes": {
WithDescription("Maximum estimated heap bytes of matched logs a single eth_getLogs query may " +
"materialize. Non-positive uses the receipt store default."),
WithUnit("bytes"),
},
"evm.enable_simulation": {
WithDescription("Simulate eth_sendRawTransaction before broadcasting it."),
},
"evm.max_estimate_gas_calls": {
WithDescription("Maximum calls allowed in an eth_estimateGasAfterCalls request."),
},
"evm.max_state_override_accounts": {
WithDescription("Maximum accounts allowed in a single state override."),
},
"evm.max_state_override_slots": {
WithDescription("Maximum storage slots allowed per account in a state override."),
},
"evm.max_trace_struct_log_bytes": {
WithDescription("Maximum retained struct-logger output per traced transaction on debug_trace*. 0 for " +
"unlimited."),
WithUnit("bytes"),
},
"evm.trace_allowed_tracers": {
WithDescription("Native tracers callers may request on debug_trace*. JavaScript tracers are never " +
"allowed through this list."),
},
"evm.trace_allow_js_tracers": {
WithDescription("Allow callers to supply JavaScript tracer source, which runs request-supplied code " +
"in-process."),
},
"evm.enable_parallelized_block_trace": {
WithDescription("Use the parallelized default debug_traceBlock* path."),
},
"evm.trace_bake_enabled": {
WithDescription("Re-execute each committed block in the background and cache traces for debug_trace*. " +
"RPC nodes only."),
},
"evm.trace_bake_workers": {
WithDescription("Re-execution goroutines for trace baking."),
},
"evm.trace_bake_queue_size": {
WithDescription("In-flight height queue size for trace baking."),
},
"evm.trace_bake_tracers": {
WithDescription("Native tracers whose output trace baking caches."),
},
"evm.trace_bake_window_blocks": {
WithDescription("Rolling window of baked traces to keep. 0 disables pruning."),
WithUnit("blocks"),
},
"evm.trace_bake_use_snapshot": {
WithDescription("Bake traces from an in-memory memiavl snapshot instead of the state store. Requires " +
"memiavl_only write mode; falls back otherwise."),
},
"evm.trace_bake_snapshot_window": {
WithDescription("Recent memiavl snapshots kept for trace baking."),
WithUnit("blocks"),
},
"evm.rate_limiting_enabled": {
WithDescription("Master switch for the EVM HTTP rate-limit admission middleware. When false, requests " +
"bypass all rejections from that layer."),
},
"evm.ip_rate_limit_rps": {
WithDescription("Per-IP sustained request rate. 0 disables the token bucket."),
WithUnit("requests/sec"),
},
"evm.ip_rate_limit_burst": {
WithDescription("Per-IP burst size. Must be >= batch_request_limit when rate limiting is enabled. 0 " +
"disables the token bucket."),
WithUnit("requests"),
},
"evm.trusted_proxy_cidrs": {
WithDescription("CIDRs whose X-Forwarded-For headers are trusted when resolving the client IP for rate " +
"limiting. Empty trusts no proxy."),
},
"evm.batch_request_limit": {
WithDescription("Maximum requests in a single JSON-RPC batch (HTTP and WebSocket). 0 disables the limit."),
WithUnit("requests"),
},
"evm.batch_response_max_size": {
WithDescription("Maximum bytes returned from a batched JSON-RPC call. 0 disables the limit."),
WithUnit("bytes"),
},
"evm.max_request_body_bytes": {
WithDescription("Maximum size of a single HTTP request body or WebSocket frame. 0 uses the go-ethereum " +
"default (5 MiB)."),
WithUnit("bytes"),
},
"evm.max_concurrent_request_bytes": {
WithDescription("Total request-body bytes admitted concurrently, budgeted separately for HTTP and " +
"WebSocket. 0 disables the limit."),
WithUnit("bytes"),
},
"evm.body_read_idle_timeout": {
WithDescription("Maximum idle time between HTTP request body chunks. 0 disables the idle guard."),
},
"evm.ws_admission_timeout": {
WithDescription("How long a WebSocket connection waits for concurrent-byte budget before it is closed. " +
"0 uses the go-ethereum default (30s)."),
},
"evm.max_open_connections": {
WithDescription("Maximum simultaneously accepted connections per EVM listener (HTTP and WebSocket " +
"each). 0 disables the limit."),
WithUnit("connections"),
},
"evm.rpc_default_timeout": {
WithDescription("Deadline for RPC methods without a Sei-specific timeout. 0 disables the default " +
"deadline."),
},
"evm.rpc_method_timeouts": {
WithDescription("Per-method deadline overrides as method=duration (e.g. eth_call=60s). A trailing * " +
"matches a method prefix."),
},

// ---------------------------------------------------------------
// API
Expand Down
Loading
Loading