node
node copied to clipboard
Improve rate-limiter's capabilities
- Load "max concurrent signatures" from on-chain param (should be created first)
- 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:
- Rank each request per chain_id (like RANK window function in SQL)
- Sort by
rank asc, chain_id asc - Acquire locks for available slots
- 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