From e76e10dce4e0a6161aec52478c4084094213be1f Mon Sep 17 00:00:00 2001 From: Petr Hanzl Date: Fri, 22 Nov 2024 10:45:32 +0100 Subject: [PATCH 1/4] Lower memory consumption for testnet and integration tests. --- cmd/sonicd/app/launcher.go | 1 + cmd/sonicd/app/run_test.go | 7 ++++++- cmd/sonictool/app/genesis.go | 11 +++++++++-- cmd/sonictool/app/main.go | 3 +++ config/config.go | 4 ++++ config/flags/flags.go | 6 ++++++ gossip/common_test.go | 10 +++++++++- gossip/evmstore/config.go | 12 +++++++----- gossip/evmstore/store.go | 2 +- gossip/handler_fuzz.go | 7 ++++++- integration/makefakegenesis/genesis.go | 19 +++++++++++++------ integration/makefakegenesis/json.go | 4 ++-- integration/makegenesis/genesis.go | 4 ++-- tests/integration_test_net.go | 4 ++-- 14 files changed, 71 insertions(+), 23 deletions(-) diff --git a/cmd/sonicd/app/launcher.go b/cmd/sonicd/app/launcher.go index 327dbe0ea..6980d2003 100644 --- a/cmd/sonicd/app/launcher.go +++ b/cmd/sonicd/app/launcher.go @@ -66,6 +66,7 @@ func initFlags() { flags.CacheFlag, flags.LiveDbCacheFlag, flags.ArchiveCacheFlag, + flags.StateDbCacheCapacityFlag, } networkingFlags = []cli.Flag{ flags.BootnodesFlag, diff --git a/cmd/sonicd/app/run_test.go b/cmd/sonicd/app/run_test.go index 98e830a94..4bd063c12 100644 --- a/cmd/sonicd/app/run_test.go +++ b/cmd/sonicd/app/run_test.go @@ -23,7 +23,12 @@ func tmpdir(t *testing.T) string { } func initFakenetDatadir(dataDir string, validatorsNum idx.Validator) { - genesisStore := makefakegenesis.FakeGenesisStore(validatorsNum, futils.ToFtm(1000000000), futils.ToFtm(5000000)) + genesisStore := makefakegenesis.FakeGenesisStore( + validatorsNum, + futils.ToFtm(1000000000), + futils.ToFtm(5000000), + 1024, // 1024 bytes is both small and safe value used by tests + ) defer genesisStore.Close() if err := genesis.ImportGenesisStore(genesis.ImportParams{ diff --git a/cmd/sonictool/app/genesis.go b/cmd/sonictool/app/genesis.go index a98044677..25c118c25 100644 --- a/cmd/sonictool/app/genesis.go +++ b/cmd/sonictool/app/genesis.go @@ -100,7 +100,9 @@ func jsonGenesisImport(ctx *cli.Context) error { if err != nil { return fmt.Errorf("failed to load JSON genesis: %w", err) } - genesisStore, err := makefakegenesis.ApplyGenesisJson(genesisJson) + + stateDbCacheCapacity := ctx.Int(flags.StateDbCacheCapacityFlag.Name) + genesisStore, err := makefakegenesis.ApplyGenesisJson(genesisJson, stateDbCacheCapacity) if err != nil { return fmt.Errorf("failed to prepare JSON genesis: %w", err) } @@ -139,7 +141,12 @@ func fakeGenesisImport(ctx *cli.Context) error { return err } - genesisStore := makefakegenesis.FakeGenesisStore(idx.Validator(validatorsNumber), futils.ToFtm(1000000000), futils.ToFtm(5000000)) + genesisStore := makefakegenesis.FakeGenesisStore( + idx.Validator(validatorsNumber), + futils.ToFtm(1000000000), + futils.ToFtm(5000000), + ctx.Int(flags.StateDbCacheCapacityFlag.Name), + ) defer genesisStore.Close() return genesis.ImportGenesisStore(genesis.ImportParams{ GenesisStore: genesisStore, diff --git a/cmd/sonictool/app/main.go b/cmd/sonictool/app/main.go index d71ffb5eb..439d6dc75 100644 --- a/cmd/sonictool/app/main.go +++ b/cmd/sonictool/app/main.go @@ -62,6 +62,9 @@ Initialize the database using data from the experimental genesis file. ArgsUsage: "", Action: fakeGenesisImport, Flags: []cli.Flag{ + flags.LiveDbCacheFlag, + flags.ArchiveCacheFlag, + flags.StateDbCacheCapacityFlag, ModeFlag, }, Description: ` diff --git a/config/config.go b/config/config.go index 5989125f0..7d46d6000 100644 --- a/config/config.go +++ b/config/config.go @@ -341,6 +341,10 @@ func MakeAllConfigsFromFile(ctx *cli.Context, configFile string) (*Config, error cfg.Lachesis.SuppressFramePanic = true } + if ctx.IsSet(flags.StateDbCacheCapacityFlag.Name) { + cfg.OperaStore.EVM.Cache.StateDbCapacity = ctx.Int(flags.StateDbCacheCapacityFlag.Name) + } + return &cfg, nil } diff --git a/config/flags/flags.go b/config/flags/flags.go index 3f9582e41..db18c7858 100644 --- a/config/flags/flags.go +++ b/config/flags/flags.go @@ -365,4 +365,10 @@ var ( "Setting this value to <=2000 will result in pre-confugired cache capacity of 2KB", CacheFlag.Name), Value: 0, } + StateDbCacheCapacityFlag = cli.IntFlag{ + Name: "statedb.cache", + Usage: "Size of StateDb instances cache in bytes. Leaving this blank (which is generally recommended), or setting" + + "this to <1 will automatically set the cache capacity a hard-coded constant.", + Value: 0, + } ) diff --git a/gossip/common_test.go b/gossip/common_test.go index 94514857d..f0dc39da3 100644 --- a/gossip/common_test.go +++ b/gossip/common_test.go @@ -143,7 +143,15 @@ func newTestEnv(firstEpoch idx.Epoch, validatorsNum idx.Validator, tb testing.TB rules.Blocks.MaxEmptyBlockSkipPeriod = 0 rules.Emitter.Interval = 0 - genStore := makefakegenesis.FakeGenesisStoreWithRulesAndStart(validatorsNum, utils.ToFtm(genesisBalance), utils.ToFtm(genesisStake), rules, firstEpoch, 2) + genStore := makefakegenesis.FakeGenesisStoreWithRulesAndStart( + validatorsNum, + utils.ToFtm(genesisBalance), + utils.ToFtm(genesisStake), + rules, + firstEpoch, + 2, + 1024, + ) genesis := genStore.Genesis() store, err := NewMemStore(tb) diff --git a/gossip/evmstore/config.go b/gossip/evmstore/config.go index 9464c64d9..ed8729091 100644 --- a/gossip/evmstore/config.go +++ b/gossip/evmstore/config.go @@ -19,6 +19,8 @@ type ( EvmBlocksNum int // Cache size for EvmBlock (size in bytes). EvmBlocksSize uint + // Cache size for StateDb instances (0 for DB-selected default) + StateDbCapacity int } // StoreConfig is a config for store db. StoreConfig struct { @@ -38,11 +40,11 @@ type ( func DefaultStoreConfig(scale cachescale.Func) StoreConfig { return StoreConfig{ Cache: StoreCacheConfig{ - ReceiptsSize: scale.U(4 * opt.MiB), - ReceiptsBlocks: scale.I(4000), - TxPositions: scale.I(20000), - EvmBlocksNum: scale.I(5000), - EvmBlocksSize: scale.U(6 * opt.MiB), + ReceiptsSize: scale.U(4 * opt.MiB), + ReceiptsBlocks: scale.I(4000), + TxPositions: scale.I(20000), + EvmBlocksNum: scale.I(5000), + EvmBlocksSize: scale.U(6 * opt.MiB), }, StateDb: carmen.Parameters{ Variant: "go-file", diff --git a/gossip/evmstore/store.go b/gossip/evmstore/store.go index 4244cc9ae..2adc89607 100644 --- a/gossip/evmstore/store.go +++ b/gossip/evmstore/store.go @@ -78,7 +78,7 @@ func (s *Store) Open() error { if err != nil { return fmt.Errorf("failed to create carmen state; %s", err) } - s.liveStateDb = carmen.CreateStateDBUsing(s.carmenState) + s.liveStateDb = carmen.CreateCustomStateDBUsing(s.carmenState, s.cfg.Cache.StateDbCapacity) return nil } diff --git a/gossip/handler_fuzz.go b/gossip/handler_fuzz.go index 0b650e8c0..b9559957f 100644 --- a/gossip/handler_fuzz.go +++ b/gossip/handler_fuzz.go @@ -68,7 +68,12 @@ func makeFuzzedHandler() (h *handler, err error) { genesisStake = 2 * 4e6 ) - genStore := makefakegenesis.FakeGenesisStore(genesisStakers, utils.ToFtm(genesisBalance), utils.ToFtm(genesisStake)) + genStore := makefakegenesis.FakeGenesisStore( + genesisStakers, + utils.ToFtm(genesisBalance), + utils.ToFtm(genesisStake), + 0, // 0 sets default value + ) genesis := genStore.Genesis() config := DefaultConfig(cachescale.Identity) diff --git a/integration/makefakegenesis/genesis.go b/integration/makefakegenesis/genesis.go index 387589283..ad66c3c26 100644 --- a/integration/makefakegenesis/genesis.go +++ b/integration/makefakegenesis/genesis.go @@ -42,16 +42,23 @@ func FakeKey(n idx.ValidatorID) *ecdsa.PrivateKey { return evmcore.FakeKey(uint32(n)) } -func FakeGenesisStore(num idx.Validator, balance, stake *big.Int) *genesisstore.Store { - return FakeGenesisStoreWithRules(num, balance, stake, opera.FakeNetRules()) +func FakeGenesisStore(num idx.Validator, balance, stake *big.Int, stateDbCacheCapacity int) *genesisstore.Store { + return FakeGenesisStoreWithRules(num, balance, stake, opera.FakeNetRules(), stateDbCacheCapacity) } -func FakeGenesisStoreWithRules(num idx.Validator, balance, stake *big.Int, rules opera.Rules) *genesisstore.Store { - return FakeGenesisStoreWithRulesAndStart(num, balance, stake, rules, 2, 1) +func FakeGenesisStoreWithRules(num idx.Validator, balance, stake *big.Int, rules opera.Rules, stateDbCacheCapacity int) *genesisstore.Store { + return FakeGenesisStoreWithRulesAndStart(num, balance, stake, rules, 2, 1, stateDbCacheCapacity) } -func FakeGenesisStoreWithRulesAndStart(num idx.Validator, balance, stake *big.Int, rules opera.Rules, epoch idx.Epoch, block idx.Block) *genesisstore.Store { - builder := makegenesis.NewGenesisBuilder() +func FakeGenesisStoreWithRulesAndStart( + num idx.Validator, + balance, stake *big.Int, + rules opera.Rules, + epoch idx.Epoch, + block idx.Block, + stateDbCacheCapacity int, +) *genesisstore.Store { + builder := makegenesis.NewGenesisBuilder(stateDbCacheCapacity) validators := GetFakeValidators(num) diff --git a/integration/makefakegenesis/json.go b/integration/makefakegenesis/json.go index d6eae4a25..fd329c3d8 100644 --- a/integration/makefakegenesis/json.go +++ b/integration/makefakegenesis/json.go @@ -61,12 +61,12 @@ func LoadGenesisJson(filename string) (*GenesisJson, error) { return &decoded, nil } -func ApplyGenesisJson(json *GenesisJson) (*genesisstore.Store, error) { +func ApplyGenesisJson(json *GenesisJson, stateDbCacheCapacity int) (*genesisstore.Store, error) { if json.BlockZeroTime.IsZero() { return nil, fmt.Errorf("block zero time must be set") } - builder := makegenesis.NewGenesisBuilder() + builder := makegenesis.NewGenesisBuilder(stateDbCacheCapacity) fmt.Printf("Building genesis file - rules: %+v\n", json.Rules) diff --git a/integration/makegenesis/genesis.go b/integration/makegenesis/genesis.go index 7241de760..9f904f6ae 100644 --- a/integration/makegenesis/genesis.go +++ b/integration/makegenesis/genesis.go @@ -113,7 +113,7 @@ func (b *GenesisBuilder) CurrentHash() hash.Hash { return er.Hash() } -func NewGenesisBuilder() *GenesisBuilder { +func NewGenesisBuilder(stateDbCacheCapacity int) *GenesisBuilder { carmenDir, err := os.MkdirTemp("", "opera-tmp-genesis") if err != nil { panic(fmt.Errorf("failed to create temporary dir for GenesisBuilder: %v", err)) @@ -128,7 +128,7 @@ func NewGenesisBuilder() *GenesisBuilder { if err != nil { panic(fmt.Errorf("failed to create carmen state; %s", err)) } - carmenStateDb := carmen.CreateStateDBUsing(carmenState) + carmenStateDb := carmen.CreateCustomStateDBUsing(carmenState, stateDbCacheCapacity) tmpStateDB := evmstore.CreateCarmenStateDb(carmenStateDb) return &GenesisBuilder{ tmpStateDB: tmpStateDB, diff --git a/tests/integration_test_net.go b/tests/integration_test_net.go index 154deb7de..e050e3a63 100644 --- a/tests/integration_test_net.go +++ b/tests/integration_test_net.go @@ -201,6 +201,7 @@ func startIntegrationTestNet(directory string, args []string) (*IntegrationTestN "--datadir", result.stateDir(), "--statedb.livecache", "1", "--statedb.archivecache", "1", + "--statedb.cache", "1024", }, args...) if err := sonictool.Run(); err != nil { os.Args = originalArgs @@ -208,8 +209,6 @@ func startIntegrationTestNet(directory string, args []string) (*IntegrationTestN } os.Args = originalArgs - os.Args = originalArgs - if err := result.start(); err != nil { return nil, fmt.Errorf("failed to start the test network: %w", err) } @@ -274,6 +273,7 @@ func (n *IntegrationTestNet) start() error { // database memory usage options "--statedb.livecache", "1", "--statedb.archivecache", "1", + "--statedb.cache", "1024", } err := sonicd.Run() From d45bd935f9428b163d6b0c737cb9d357b71baa5e Mon Sep 17 00:00:00 2001 From: Petr Hanzl Date: Tue, 3 Dec 2024 11:36:25 +0100 Subject: [PATCH 2/4] Use globalint --- cmd/sonictool/app/genesis.go | 4 ++-- config/config.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/sonictool/app/genesis.go b/cmd/sonictool/app/genesis.go index 25c118c25..66b902f66 100644 --- a/cmd/sonictool/app/genesis.go +++ b/cmd/sonictool/app/genesis.go @@ -101,7 +101,7 @@ func jsonGenesisImport(ctx *cli.Context) error { return fmt.Errorf("failed to load JSON genesis: %w", err) } - stateDbCacheCapacity := ctx.Int(flags.StateDbCacheCapacityFlag.Name) + stateDbCacheCapacity := ctx.GlobalInt(flags.StateDbCacheCapacityFlag.Name) genesisStore, err := makefakegenesis.ApplyGenesisJson(genesisJson, stateDbCacheCapacity) if err != nil { return fmt.Errorf("failed to prepare JSON genesis: %w", err) @@ -145,7 +145,7 @@ func fakeGenesisImport(ctx *cli.Context) error { idx.Validator(validatorsNumber), futils.ToFtm(1000000000), futils.ToFtm(5000000), - ctx.Int(flags.StateDbCacheCapacityFlag.Name), + ctx.GlobalInt(flags.StateDbCacheCapacityFlag.Name), ) defer genesisStore.Close() return genesis.ImportGenesisStore(genesis.ImportParams{ diff --git a/config/config.go b/config/config.go index 7d46d6000..56ef4cce7 100644 --- a/config/config.go +++ b/config/config.go @@ -342,7 +342,7 @@ func MakeAllConfigsFromFile(ctx *cli.Context, configFile string) (*Config, error } if ctx.IsSet(flags.StateDbCacheCapacityFlag.Name) { - cfg.OperaStore.EVM.Cache.StateDbCapacity = ctx.Int(flags.StateDbCacheCapacityFlag.Name) + cfg.OperaStore.EVM.Cache.StateDbCapacity = ctx.GlobalInt(flags.StateDbCacheCapacityFlag.Name) } return &cfg, nil From 98464fe74b8fc87f2a7e9358ced478bf8e2687d8 Mon Sep 17 00:00:00 2001 From: Petr Hanzl Date: Tue, 3 Dec 2024 11:54:17 +0100 Subject: [PATCH 3/4] Fix flags in test --- cmd/sonictool/app/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/sonictool/app/main.go b/cmd/sonictool/app/main.go index 439d6dc75..c6099fa59 100644 --- a/cmd/sonictool/app/main.go +++ b/cmd/sonictool/app/main.go @@ -20,6 +20,7 @@ func Run() error { flags.CacheFlag, flags.LiveDbCacheFlag, flags.ArchiveCacheFlag, + flags.StateDbCacheCapacityFlag, } app.Commands = []cli.Command{ { @@ -62,9 +63,6 @@ Initialize the database using data from the experimental genesis file. ArgsUsage: "", Action: fakeGenesisImport, Flags: []cli.Flag{ - flags.LiveDbCacheFlag, - flags.ArchiveCacheFlag, - flags.StateDbCacheCapacityFlag, ModeFlag, }, Description: ` From fd02a53d0c1909fe4c90c6904869dfef355fdeae Mon Sep 17 00:00:00 2001 From: Petr Hanzl Date: Tue, 3 Dec 2024 12:07:43 +0100 Subject: [PATCH 4/4] Address reviewers feedback --- cmd/sonicd/app/run_test.go | 1 - cmd/sonictool/app/genesis.go | 4 +--- config/flags/flags.go | 5 +++-- gossip/common_test.go | 1 - gossip/handler_fuzz.go | 1 - integration/makefakegenesis/genesis.go | 11 +++++------ integration/makefakegenesis/json.go | 4 ++-- integration/makegenesis/genesis.go | 5 +++-- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/cmd/sonicd/app/run_test.go b/cmd/sonicd/app/run_test.go index 4bd063c12..348d66995 100644 --- a/cmd/sonicd/app/run_test.go +++ b/cmd/sonicd/app/run_test.go @@ -27,7 +27,6 @@ func initFakenetDatadir(dataDir string, validatorsNum idx.Validator) { validatorsNum, futils.ToFtm(1000000000), futils.ToFtm(5000000), - 1024, // 1024 bytes is both small and safe value used by tests ) defer genesisStore.Close() diff --git a/cmd/sonictool/app/genesis.go b/cmd/sonictool/app/genesis.go index 66b902f66..a81076c2a 100644 --- a/cmd/sonictool/app/genesis.go +++ b/cmd/sonictool/app/genesis.go @@ -101,8 +101,7 @@ func jsonGenesisImport(ctx *cli.Context) error { return fmt.Errorf("failed to load JSON genesis: %w", err) } - stateDbCacheCapacity := ctx.GlobalInt(flags.StateDbCacheCapacityFlag.Name) - genesisStore, err := makefakegenesis.ApplyGenesisJson(genesisJson, stateDbCacheCapacity) + genesisStore, err := makefakegenesis.ApplyGenesisJson(genesisJson) if err != nil { return fmt.Errorf("failed to prepare JSON genesis: %w", err) } @@ -145,7 +144,6 @@ func fakeGenesisImport(ctx *cli.Context) error { idx.Validator(validatorsNumber), futils.ToFtm(1000000000), futils.ToFtm(5000000), - ctx.GlobalInt(flags.StateDbCacheCapacityFlag.Name), ) defer genesisStore.Close() return genesis.ImportGenesisStore(genesis.ImportParams{ diff --git a/config/flags/flags.go b/config/flags/flags.go index db18c7858..20d0c8f6d 100644 --- a/config/flags/flags.go +++ b/config/flags/flags.go @@ -367,8 +367,9 @@ var ( } StateDbCacheCapacityFlag = cli.IntFlag{ Name: "statedb.cache", - Usage: "Size of StateDb instances cache in bytes. Leaving this blank (which is generally recommended), or setting" + - "this to <1 will automatically set the cache capacity a hard-coded constant.", + Usage: "The number of cached data elements by each StateDb instance. Since this is an experimental feature " + + "used mainly by tests it is generally recommended leaving this blank. In tests no value lower than 1024 " + + "is recommended. Setting this to <1 will automatically set the cache capacity to a DB defined default value.", Value: 0, } ) diff --git a/gossip/common_test.go b/gossip/common_test.go index f0dc39da3..89309b0bb 100644 --- a/gossip/common_test.go +++ b/gossip/common_test.go @@ -150,7 +150,6 @@ func newTestEnv(firstEpoch idx.Epoch, validatorsNum idx.Validator, tb testing.TB rules, firstEpoch, 2, - 1024, ) genesis := genStore.Genesis() diff --git a/gossip/handler_fuzz.go b/gossip/handler_fuzz.go index b9559957f..c774f1e84 100644 --- a/gossip/handler_fuzz.go +++ b/gossip/handler_fuzz.go @@ -72,7 +72,6 @@ func makeFuzzedHandler() (h *handler, err error) { genesisStakers, utils.ToFtm(genesisBalance), utils.ToFtm(genesisStake), - 0, // 0 sets default value ) genesis := genStore.Genesis() diff --git a/integration/makefakegenesis/genesis.go b/integration/makefakegenesis/genesis.go index ad66c3c26..96100d009 100644 --- a/integration/makefakegenesis/genesis.go +++ b/integration/makefakegenesis/genesis.go @@ -42,12 +42,12 @@ func FakeKey(n idx.ValidatorID) *ecdsa.PrivateKey { return evmcore.FakeKey(uint32(n)) } -func FakeGenesisStore(num idx.Validator, balance, stake *big.Int, stateDbCacheCapacity int) *genesisstore.Store { - return FakeGenesisStoreWithRules(num, balance, stake, opera.FakeNetRules(), stateDbCacheCapacity) +func FakeGenesisStore(num idx.Validator, balance, stake *big.Int) *genesisstore.Store { + return FakeGenesisStoreWithRules(num, balance, stake, opera.FakeNetRules()) } -func FakeGenesisStoreWithRules(num idx.Validator, balance, stake *big.Int, rules opera.Rules, stateDbCacheCapacity int) *genesisstore.Store { - return FakeGenesisStoreWithRulesAndStart(num, balance, stake, rules, 2, 1, stateDbCacheCapacity) +func FakeGenesisStoreWithRules(num idx.Validator, balance, stake *big.Int, rules opera.Rules) *genesisstore.Store { + return FakeGenesisStoreWithRulesAndStart(num, balance, stake, rules, 2, 1) } func FakeGenesisStoreWithRulesAndStart( @@ -56,9 +56,8 @@ func FakeGenesisStoreWithRulesAndStart( rules opera.Rules, epoch idx.Epoch, block idx.Block, - stateDbCacheCapacity int, ) *genesisstore.Store { - builder := makegenesis.NewGenesisBuilder(stateDbCacheCapacity) + builder := makegenesis.NewGenesisBuilder() validators := GetFakeValidators(num) diff --git a/integration/makefakegenesis/json.go b/integration/makefakegenesis/json.go index fd329c3d8..d6eae4a25 100644 --- a/integration/makefakegenesis/json.go +++ b/integration/makefakegenesis/json.go @@ -61,12 +61,12 @@ func LoadGenesisJson(filename string) (*GenesisJson, error) { return &decoded, nil } -func ApplyGenesisJson(json *GenesisJson, stateDbCacheCapacity int) (*genesisstore.Store, error) { +func ApplyGenesisJson(json *GenesisJson) (*genesisstore.Store, error) { if json.BlockZeroTime.IsZero() { return nil, fmt.Errorf("block zero time must be set") } - builder := makegenesis.NewGenesisBuilder(stateDbCacheCapacity) + builder := makegenesis.NewGenesisBuilder() fmt.Printf("Building genesis file - rules: %+v\n", json.Rules) diff --git a/integration/makegenesis/genesis.go b/integration/makegenesis/genesis.go index 9f904f6ae..fcaee3fe9 100644 --- a/integration/makegenesis/genesis.go +++ b/integration/makegenesis/genesis.go @@ -113,7 +113,7 @@ func (b *GenesisBuilder) CurrentHash() hash.Hash { return er.Hash() } -func NewGenesisBuilder(stateDbCacheCapacity int) *GenesisBuilder { +func NewGenesisBuilder() *GenesisBuilder { carmenDir, err := os.MkdirTemp("", "opera-tmp-genesis") if err != nil { panic(fmt.Errorf("failed to create temporary dir for GenesisBuilder: %v", err)) @@ -128,7 +128,8 @@ func NewGenesisBuilder(stateDbCacheCapacity int) *GenesisBuilder { if err != nil { panic(fmt.Errorf("failed to create carmen state; %s", err)) } - carmenStateDb := carmen.CreateCustomStateDBUsing(carmenState, stateDbCacheCapacity) + // Set cache size to lowest value possible + carmenStateDb := carmen.CreateCustomStateDBUsing(carmenState, 1024) tmpStateDB := evmstore.CreateCarmenStateDb(carmenStateDb) return &GenesisBuilder{ tmpStateDB: tmpStateDB,