node icon indicating copy to clipboard operation
node copied to clipboard

Improve rate-limiter's capabilities

Open swift1337 opened this issue 8 months ago • 0 comments

  1. Load "max concurrent signatures" from on-chain param (should be created first)
  2. Introduce throttling "fairness" between different chains

Example: There are 200 pending outbounds on Base and BSC and the limit is 100. The signers should try to sign 50 sigs on Base and 50 on BSC instead of 100 on Base

Possible approach

  • Split sigs by timeframes of 500ms / 1000ms
  • During this timeframe, collect all tss.sign(msg, chainID, nonce) into pending actions
  • Then run something like rateLimiter.tick() in the background that would:
  1. Rank each request per chain_id (like RANK window function in SQL)
  2. Sort by rank asc, chain_id asc
  3. Acquire locks for available slots
  4. Reject the rest

By doing so we'd

  • ✅ Ensure "fairness" between chains in case of TSS request spikes
  • ✅ Ensure lower nonces are signed first
  • ⚠️ Make signatures a bit slower by introducing a "bucketing" time window (<1s)

Related:

  • https://github.com/zeta-chain/node/issues/3817
  • https://github.com/zeta-chain/node/pull/3826

swift1337 avatar Apr 25 '25 11:04 swift1337