Closed twoeths closed 2 months ago
a note about BalancesTreeCache
, if network is not finalized in an epoch then we'll miss the cache
it's not likely to miss the cache if we go with n-historical flag
with an average time of ~830s afterProcessEpoch
we can expect the prepareNextEpoch
on holesky to be around 1.35s - 0.8s ~= 550ms
works well for a while (more than 2w of testing)
Motivation
balances
tree from scratch and it causes memory spikes atprocessRewardsAndPenalties
step (10m) chart:while after a state is finalized, we remove checkpoint state and don't use it anymore. We can recreate the
balances
tree using that unusedbalances
tree from that state leveraging https://github.com/ChainSafe/ssz/pull/402see also #6229
Description
BalancesTreeCache
which is populated after we remove a checkpoint state, and consume by epoch transition using same design of #6938IBalancesTreeCache
interface and consume it if existsBalancesTreeCache
and put that toEpochCache
ListUintNum64Type.toViewDU(value, viewDU)
Resolves #6229
Testing
processRewardsAndPenalties
10m is improved a lot, there are 2 spikes in 12h time frame, most likely due tobatchHashTreeRoot()
we used insideListUintNum64Type.toViewDU(value, viewDU)
6h chart shows ~250ms save in average
but
prepareNextEpoch
is saved ~350ms because we hashedstate.balances
inListUintNum64Type.toViewDU(value, viewDU)
, and that's majority of hash work forprepareNextEpoch
state.hashTreeRoot()
isnota little bit confusing, but majority of work is done by this work andstate.validators.commit()