-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
65 lines (61 loc) · 1.62 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package evmstore
import (
"github.com/corex-mn/corex-base/utils/cachescale"
"github.com/syndtr/goleveldb/leveldb/opt"
)
type (
// StoreCacheConfig is a config for the db.
StoreCacheConfig struct {
// Cache size for Receipts (size in bytes).
ReceiptsSize uint
// Cache size for Receipts (number of blocks).
ReceiptsBlocks int
// Cache size for TxPositions.
TxPositions int
// Cache size for EVM database.
EvmDatabase int
// Cache size for EVM snapshot.
EvmSnap int
// Cache size for EvmBlock (number of blocks).
EvmBlocksNum int
// Cache size for EvmBlock (size in bytes).
EvmBlocksSize uint
}
// StoreConfig is a config for store db.
StoreConfig struct {
Cache StoreCacheConfig
EnableSnapshots bool
// Enables tracking of SHA3 preimages in the VM
EnablePreimageRecording bool
}
)
// DefaultStoreConfig for product.
func DefaultStoreConfig(scale cachescale.Func) StoreConfig {
return StoreConfig{
Cache: StoreCacheConfig{
ReceiptsSize: scale.U(4 * opt.MiB),
ReceiptsBlocks: scale.I(4000),
TxPositions: scale.I(20000),
EvmDatabase: scale.I(32 * opt.MiB),
EvmSnap: scale.I(32 * opt.MiB),
EvmBlocksNum: scale.I(5000),
EvmBlocksSize: scale.U(6 * opt.MiB),
},
EnableSnapshots: true,
EnablePreimageRecording: true,
}
}
// LiteStoreConfig is for tests or inmemory.
func LiteStoreConfig() StoreConfig {
return StoreConfig{
Cache: StoreCacheConfig{
ReceiptsSize: 3 * 1024,
ReceiptsBlocks: 100,
TxPositions: 500,
EvmBlocksNum: 100,
EvmBlocksSize: 3 * 1024,
},
EnableSnapshots: true,
EnablePreimageRecording: true,
}
}