You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Motivation
Builder constantly builds different blocks for a slot and most of
transactions are execution over and over with the same result.
Here, we cache execution of transactions and next time we apply tx that
was already executed we only check if state that is currently available
is the same as for the cached result.
# Config
* `simulation_use_random_coinbase: bool` if top of block simulation
should use random coinbase
* `evm_caching_enable: bool` if evm caching should be enabled
# Results
* Cache hit rate: typically around 80-90% of txs are cached and cache
hit rate is around 70-90%
* The speedup for EVM part of execution is huge, verifying tx state and
applying result is much faster than EVM execution, for most txs its
around 10 microseconds while typical execution is around 300
microseconds. There are txs that take multiple milliseconds to execute
and for those time saved is huge.
## Speedup of block fill time.
To measure this I compare average block fill time for the given block of
builder with and without caching. I only look at blocks where average
gas used is the same in both builders.
The speedup of block fill time is distributed like this: average: 2.5x,
median: 2.3x, p10: 1.5x, p90: 3.8x
## Limiting factor
The limiting factor of speedup and cache hit rate are txs that are
always failing when filling block. We execute txs like that only once,
their execution is never cached. Successful txs that we execute over and
over are almost perfectly cached.
# Caveats
I don't recommend enabling it on prod for now because I've seen one root
hash related block simulation error that is hard to explain. Currently
our dev version builder is broken in that part so that might be it.
---------
Co-authored-by: Daniel Xifra <[email protected]>
0 commit comments