Skip to content

Conversation

@pk910
Copy link
Member

@pk910 pk910 commented Oct 7, 2025

Optimize UI Performance & Add Filtered RPC Proxy

UI Performance Improvements

Fixed excessive RPC requests in validator operation submission forms that were overloading backends with hundreds of users:

Key Optimizations:

  • Fixed render-triggered calls: Moved explorer.initControls() to proper useEffect hooks with cleanup
  • Added global queue data caching: Shared cache across all form instances eliminates duplicate RPC calls
  • Fixed React key prop issue: Removed withdrawalAmount from component keys to prevent unnecessary re-mounts on slider changes
  • Reduced polling frequency: Block number polling 5s→10s, queue data polling 15s→20s
  • Added proper memoization: useCallback for expensive filter functions

Result: ~95% reduction in RPC requests for validator operations.

Filtered RPC Proxy

Added optional filtered RPC proxy for deployments without public RPC access:

Features:

  • Method filtering: Whitelist of safe read-only methods (eth_getStorageAt, eth_getLogs, etc.)
  • Rate limiting: Per-IP token bucket (30 req/min, 10 burst by default)
  • Parameter validation: Prevents DoS attacks (max 1000 block ranges)
  • Request logging: Optional monitoring of all RPC calls
  • Automatic frontend integration: When enabled, frontend uses /_rpc endpoint

Configuration:

rpcProxy:
  enabled: true
  upstreamUrl: "http://localhost:8545"
  requestsPerMinute: 30
  burstLimit: 10
  logRequests: true

Endpoint:

  • POST /_rpc - Filtered JSON-RPC proxy (separate from API namespace)
  • Proper error handling with JSON-RPC 2.0 responses

Use case: Controlled RPC access in private/testing environments without exposing execution clients directly.

@pk910 pk910 merged commit a70e754 into master Oct 7, 2025
4 checks passed
@pk910 pk910 deleted the pk910/ui-rpc-proxy branch October 7, 2025 11:57
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.

3 participants