forked from 0xPolygonHermez/zkevm-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
95 lines (72 loc) · 3.6 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package jsonrpc
import (
"github.com/0xPolygonHermez/zkevm-node/config/types"
"github.com/ethereum/go-ethereum/common"
)
// Config represents the configuration of the json rpc
type Config struct {
// Host defines the network adapter that will be used to serve the HTTP requests
Host string `mapstructure:"Host"`
// Port defines the port to serve the endpoints via HTTP
Port int `mapstructure:"Port"`
// ReadTimeout is the HTTP server read timeout
// check net/http.server.ReadTimeout and net/http.server.ReadHeaderTimeout
ReadTimeout types.Duration `mapstructure:"ReadTimeout"`
// WriteTimeout is the HTTP server write timeout
// check net/http.server.WriteTimeout
WriteTimeout types.Duration `mapstructure:"WriteTimeout"`
// MaxRequestsPerIPAndSecond defines how much requests a single IP can
// send within a single second
MaxRequestsPerIPAndSecond float64 `mapstructure:"MaxRequestsPerIPAndSecond"`
// SequencerNodeURI is used allow Non-Sequencer nodes
// to relay transactions to the Sequencer node
SequencerNodeURI string `mapstructure:"SequencerNodeURI"`
// MaxCumulativeGasUsed is the max gas allowed per batch
MaxCumulativeGasUsed uint64
// WebSockets configuration
WebSockets WebSocketsConfig `mapstructure:"WebSockets"`
// EnableL2SuggestedGasPricePolling enables polling of the L2 gas price to block tx in the RPC with lower gas price.
EnableL2SuggestedGasPricePolling bool `mapstructure:"EnableL2SuggestedGasPricePolling"`
// BatchRequestsEnabled defines if the Batch requests are enabled or disabled
BatchRequestsEnabled bool `mapstructure:"BatchRequestsEnabled"`
// BatchRequestsLimit defines the limit of requests that can be incorporated into each batch request
BatchRequestsLimit uint `mapstructure:"BatchRequestsLimit"`
// L2Coinbase defines which address is going to receive the fees
L2Coinbase common.Address
// MaxLogsCount is a configuration to set the max number of logs that can be returned
// in a single call to the state, if zero it means no limit
MaxLogsCount uint64 `mapstructure:"MaxLogsCount"`
// MaxLogsBlockRange is a configuration to set the max range for block number when querying TXs
// logs in a single call to the state, if zero it means no limit
MaxLogsBlockRange uint64 `mapstructure:"MaxLogsBlockRange"`
// MaxNativeBlockHashBlockRange is a configuration to set the max range for block number when querying
// native block hashes in a single call to the state, if zero it means no limit
MaxNativeBlockHashBlockRange uint64 `mapstructure:"MaxNativeBlockHashBlockRange"`
// EnableHttpLog allows the user to enable or disable the logs related to the HTTP
// requests to be captured by the server.
EnableHttpLog bool `mapstructure:"EnableHttpLog"`
// ZKCountersLimits defines the ZK Counter limits
ZKCountersLimits ZKCountersLimits
}
// ZKCountersLimits defines the ZK Counter limits
type ZKCountersLimits struct {
MaxKeccakHashes uint32
MaxPoseidonHashes uint32
MaxPoseidonPaddings uint32
MaxMemAligns uint32
MaxArithmetics uint32
MaxBinaries uint32
MaxSteps uint32
MaxSHA256Hashes uint32
}
// WebSocketsConfig has parameters to config the rpc websocket support
type WebSocketsConfig struct {
// Enabled defines if the WebSocket requests are enabled or disabled
Enabled bool `mapstructure:"Enabled"`
// Host defines the network adapter that will be used to serve the WS requests
Host string `mapstructure:"Host"`
// Port defines the port to serve the endpoints via WS
Port int `mapstructure:"Port"`
// ReadLimit defines the maximum size of a message read from the client (in bytes)
ReadLimit int64 `mapstructure:"ReadLimit"`
}