Skip to content

evict balance cache based on time instead of blocks - #4699

Draft
MartinquaXD wants to merge 5 commits into
mainfrom
fix-balance-cache-for-fast-chains
Draft

evict balance cache based on time instead of blocks#4699
MartinquaXD wants to merge 5 commits into
mainfrom
fix-balance-cache-for-fast-chains

Conversation

@MartinquaXD

@MartinquaXD MartinquaXD commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Currently the time to cut auctions on arbitrum and bnb is significantly higher than on more used chains (~400ms vs. 200ms). The reason is that the cache currently evicts balances that have not been requested for 5 blocks which is like 1.5s on arbitrum for example. So when the autopilot run loop eventually finishes the balances have long been evicted and we need to re-fetch everything while building the auction.

Changes

Keep balances for 20s to definitely span at least 1 full auction so that the balances are always ready when building a new auction.

How to test

Temporarily deployed to arbitrum. As expected the time to build an auction dropped from ~400ms to ~50ms. On the flip side the total number of RPC requests trippled because it now actually continuously updates the balances the entire time.
Screenshot 2026-08-03 at 19 25 36
Screenshot 2026-08-03 at 19 25 43

If we also throttle the balance updates to once per second we are improving many metrics even more and even drop the number of RPC calls per second. With both changes applied we drop the total auction overhead from ~700ms to ~150ms.
Screenshot 2026-08-03 at 19 52 08
Screenshot 2026-08-03 at 19 52 13

@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed.

@github-actions github-actions Bot added the stale label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant