mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-26 05:27:19 +00:00
daa359c363
* db based version of PrefixByCumulativeWitnessSize * db based version of PrefixByCumulativeWitnessSize * retain all in Trie by default * fix WitnessLen logic in calcTrie roots * Rename IntermediateTrieWitnessLenBucket to IntermediateWitnessLenBucket * handle corner cases in WL * Use correct incarnation for IH bucket * use name WitnessSize * save progress towards db-only witness estimation * results from trie and from db are still different * less recursion * correct incarnation in CumulativeSearch * reuse results from previous Tick, separate concepts of parent and startKey * experiment: if not including trie structure to WitnessSize will reduce cumulative error * tool to generate all IH and tool to calculate assessment of cumulative error * tool to generate all IH * Calculate totalWitnessSize based on DB data - then schedule will not overrun state during MGR cycle * better stats * Calculate totalWitnessSize based on DB data - then schedule will not overrun state during MGR cycle * Calculate totalWitnessSize based on DB data - then schedule will not overrun state during MGR cycle * calculate ticks size distribution * estimate cumulative error * fix linter * resetIH from scratch if needed * cleanup * fix test * fix test
37 lines
891 B
Go
37 lines
891 B
Go
package mgr_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/eth/mgr"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestScheduleProperties(t *testing.T) {
|
|
require := require.New(t)
|
|
stateSize := uint64(123456)
|
|
block := uint64(11)
|
|
toBlock := block + mgr.BlocksPerCycle + 100
|
|
var prevTick *mgr.Tick
|
|
|
|
var sizeFromTicksAccumulator uint64
|
|
for block <= toBlock {
|
|
tick := mgr.NewTick(block, stateSize, prevTick)
|
|
|
|
sizeFromTicksAccumulator += tick.ToSize - tick.FromSize
|
|
// props
|
|
if prevTick != nil && prevTick.Number < tick.Number {
|
|
require.LessOrEqual(block, tick.FromBlock)
|
|
require.Less(tick.FromBlock, tick.ToBlock)
|
|
require.Less(prevTick.ToBlock, tick.FromBlock)
|
|
|
|
require.LessOrEqual(tick.ToSize, stateSize)
|
|
require.Less(tick.FromSize, tick.ToSize)
|
|
require.Less(prevTick.ToSize, tick.FromSize)
|
|
}
|
|
|
|
prevTick = tick
|
|
block = tick.ToBlock + 1
|
|
}
|
|
}
|