forked from okx/xlayer-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
74 lines (53 loc) · 3.26 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
66
67
68
69
70
71
72
73
74
package pool
import (
"github.com/0xPolygonHermez/zkevm-node/config/types"
"github.com/0xPolygonHermez/zkevm-node/db"
)
// Config is the pool configuration
type Config struct {
// IntervalToRefreshBlockedAddresses is the time it takes to sync the
// blocked address list from db to memory
IntervalToRefreshBlockedAddresses types.Duration `mapstructure:"IntervalToRefreshBlockedAddresses"`
// IntervalToRefreshGasPrices is the time to wait to refresh the gas prices
IntervalToRefreshGasPrices types.Duration `mapstructure:"IntervalToRefreshGasPrices"`
// MaxTxBytesSize is the max size of a transaction in bytes
MaxTxBytesSize uint64 `mapstructure:"MaxTxBytesSize"`
// MaxTxDataBytesSize is the max size of the data field of a transaction in bytes
MaxTxDataBytesSize int `mapstructure:"MaxTxDataBytesSize"`
// DB is the database configuration
DB db.Config `mapstructure:"DB"`
// DefaultMinGasPriceAllowed is the default min gas price to suggest
DefaultMinGasPriceAllowed uint64 `mapstructure:"DefaultMinGasPriceAllowed"`
// MinAllowedGasPriceInterval is the interval to look back of the suggested min gas price for a tx
MinAllowedGasPriceInterval types.Duration `mapstructure:"MinAllowedGasPriceInterval"`
// PollMinAllowedGasPriceInterval is the interval to poll the suggested min gas price for a tx
PollMinAllowedGasPriceInterval types.Duration `mapstructure:"PollMinAllowedGasPriceInterval"`
// AccountQueue represents the maximum number of non-executable transaction slots permitted per account
AccountQueue uint64 `mapstructure:"AccountQueue"`
// GlobalQueue represents the maximum number of non-executable transaction slots for all accounts
GlobalQueue uint64 `mapstructure:"GlobalQueue"`
// EffectiveGasPrice is the config for the effective gas price calculation
EffectiveGasPrice EffectiveGasPriceCfg `mapstructure:"EffectiveGasPrice"`
// ForkID is the current fork ID of the chain
ForkID uint64 `mapstructure:"ForkID"`
}
// EffectiveGasPriceCfg contains the configuration properties for the effective gas price
type EffectiveGasPriceCfg struct {
// Enabled is a flag to enable/disable the effective gas price
Enabled bool `mapstructure:"Enabled"`
// L1GasPriceFactor is the percentage of the L1 gas price that will be used as the L2 min gas price
L1GasPriceFactor float64 `mapstructure:"L1GasPriceFactor"`
// ByteGasCost is the gas cost per byte that is not 0
ByteGasCost uint64 `mapstructure:"ByteGasCost"`
// ZeroByteGasCost is the gas cost per byte that is 0
ZeroByteGasCost uint64 `mapstructure:"ZeroByteGasCost"`
// NetProfit is the profit margin to apply to the calculated breakEvenGasPrice
NetProfit float64 `mapstructure:"NetProfit"`
// BreakEvenFactor is the factor to apply to the calculated breakevenGasPrice when comparing it with the gasPriceSigned of a tx
BreakEvenFactor float64 `mapstructure:"BreakEvenFactor"`
// FinalDeviationPct is the max allowed deviation percentage BreakEvenGasPrice on re-calculation
FinalDeviationPct uint64 `mapstructure:"FinalDeviationPct"`
// L2GasPriceSuggesterFactor is the factor to apply to L1 gas price to get the suggested L2 gas price used in the
// calculations when the effective gas price is disabled (testing/metrics purposes)
L2GasPriceSuggesterFactor float64 `mapstructure:"L2GasPriceSuggesterFactor"`
}