-
Notifications
You must be signed in to change notification settings - Fork 12
/
params.go
86 lines (71 loc) · 3.8 KB
/
params.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package protocol
import (
"time"
"github.com/iotaledger/hive.go/app"
)
// ParametersProtocol contains the definition of the configuration parameters used by the Protocol.
type ParametersProtocol struct {
// Snapshot contains snapshots related configuration parameters.
Snapshot struct {
// Path is the path to the snapshot file.
Path string `default:"testnet/snapshot.bin" usage:"the path of the snapshot file"`
// Depth defines how many slot diffs are stored in the snapshot, starting from the full ledgerstate.
Depth int `default:"5" usage:"defines how many slot diffs are stored in the snapshot, starting from the full ledgerstate"`
}
CommitmentCheck bool `default:"true" usage:"specifies whether commitment and ledger checks should be enabled"`
Filter struct {
// MaxAllowedClockDrift defines the maximum drift our wall clock can have to future blocks being received from the network.
MaxAllowedClockDrift time.Duration `default:"5s" usage:"the maximum drift our wall clock can have to future blocks being received from the network"`
}
ProtocolParametersPath string `default:"testnet/protocol_parameters.json" usage:"the path of the protocol parameters file"`
BaseToken BaseToken
}
type BaseToken struct {
// the base token name
Name string `default:"Shimmer" usage:"the base token name"`
// the base token ticker symbol
TickerSymbol string `default:"SMR" usage:"the base token ticker symbol"`
// the base token unit
Unit string `default:"SMR" usage:"the base token unit"`
// the base token subunit
Subunit string `default:"glow" usage:"the base token subunit"`
// the base token amount of decimals
Decimals uint32 `default:"6" usage:"the base token amount of decimals"`
}
// ParametersDatabase contains the definition of configuration parameters used by the storage layer.
type ParametersDatabase struct {
Engine string `default:"rocksdb" usage:"the used database engine (rocksdb/mapdb)"`
Path string `default:"testnet/database" usage:"the path to the database folder"`
MaxOpenDBs int `default:"5" usage:"maximum number of open database instances"`
Pruning struct {
Threshold uint64 `default:"30" usage:"how many finalized epochs should be retained"`
Size struct {
// Enabled defines whether to delete old block data from the database based on maximum database size
Enabled bool `default:"true" usage:"whether to delete old block data from the database based on maximum database size"`
// TargetSize defines the target size of the database
TargetSize string `default:"30GB" usage:"target size of the database"`
// ReductionPercentage defines the percentage the database size gets reduced if the target size is reached
ReductionPercentage float64 `default:"10.0" usage:"the percentage the database size gets reduced if the target size is reached"`
// CooldownTime defines the cooldown time between two pruning by database size events
CooldownTime time.Duration `default:"5m" usage:"cooldown time between two pruning by database size events"`
}
}
}
// ParametersRetainer contains the definition of configuration parameters used by the Retainer.
type ParametersRetainer struct {
// DebugStoreErrorMessages defines whether to store debug error messages in the database.
DebugStoreErrorMessages bool `default:"false" usage:"whether to store debug error messages in the database"`
}
// ParamsProtocol contains the configuration parameters used by the Protocol.
var ParamsProtocol = &ParametersProtocol{}
// ParamsDatabase contains configuration parameters used by Database.
var ParamsDatabase = &ParametersDatabase{}
// ParamsRetainer contains configuration parameters used by Retainer.
var ParamsRetainer = &ParametersRetainer{}
var params = &app.ComponentParams{
Params: map[string]any{
"protocol": ParamsProtocol,
"db": ParamsDatabase,
"retainer": ParamsRetainer,
},
}