-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathconfig.go
More file actions
136 lines (127 loc) · 5.96 KB
/
config.go
File metadata and controls
136 lines (127 loc) · 5.96 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package config
import (
"crypto/ecdsa"
"io"
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/crypto"
flowGoKMS "github.com/onflow/flow-go-sdk/crypto/cloudkms"
flowGo "github.com/onflow/flow-go/model/flow"
"github.com/rs/zerolog"
)
const (
// Default InitCadenceHeight for initializing the database on a local emulator.
// TODO: temporary fix until https://github.com/onflow/flow-go/issues/5481 is
// fixed upstream and released.
EmulatorInitCadenceHeight = uint64(0)
// Default InitCadenceHeight for initializing the database on a live network.
// We don't use 0 as it has a special meaning to represent latest block in the AN API context.
LiveNetworkInitCadenceHeight = uint64(1)
// Testnet height at which the `EVM` system contract was first deployed.
// This is the first height at which the EVM state starts.
TestnetInitCadenceHeight = uint64(211176670)
// Mainnet height at which the `EVM` system contract was first deployed.
// This is the first height at which the EVM state starts.
// reference: https://github.com/onflow/flow/blob/9203b57a04d422360de257bcd92c522a2f51d3b0/sporks.json#L91
MainnetInitCadenceHeight = uint64(85981135)
)
type TxStateValidation string
const (
LocalIndexValidation = "local-index"
TxSealValidation = "tx-seal"
)
type Config struct {
// DatabaseDir is where the database should be stored.
DatabaseDir string
// AccessNodeHost defines the current spork Flow network AN host.
AccessNodeHost string
// AccessNodePreviousSporkHosts contains a list of the ANs hosts for each spork
AccessNodePreviousSporkHosts []string
// GRPCPort for the RPC API server
RPCPort int
// GRPCHost for the RPC API server
RPCHost string
// WSEnabled determines if the websocket server is enabled.
WSEnabled bool
// EVMNetworkID provides the EVM chain ID.
EVMNetworkID *big.Int
// FlowNetworkID is the Flow network ID that the EVM is hosted on (mainnet, testnet, emulator...)
FlowNetworkID flowGo.ChainID
// Coinbase is EVM address that collects the EVM operator fees collected
// when transactions are being submitted.
Coinbase common.Address
// COAAddress is Flow address that holds COA account used for submitting transactions.
COAAddress flow.Address
// COAKey is Flow key to the COA account. WARNING: do not use in production
COAKey crypto.PrivateKey
// COACloudKMSKey is a Cloud KMS key that will be used for signing transactions.
COACloudKMSKey *flowGoKMS.Key
// COATxLookupEnabled enables tracking of Cadence transactions to release COA signing
// keys much faster. Increases capacity of the available COA signing keys for nodes
// with high tx volume.
COATxLookupEnabled bool
// GasPrice is a fixed gas price that will be used when submitting transactions.
GasPrice *big.Int
// EnforceGasPrice defines whether the minimum gas price should be enforced.
EnforceGasPrice bool
// InitCadenceHeight is used for initializing the database on a local emulator or a live network.
InitCadenceHeight uint64
// LogLevel defines how verbose the output log is
LogLevel zerolog.Level
// LogWriter defines the writer used for logging
LogWriter io.Writer
// Logger if you bring your own
Logger *zerolog.Logger
// RateLimit requests made by the client identified by IP over any protocol (ws/http).
RateLimit uint64
// Address header used to identified clients, usually set by the proxy
AddressHeader string
// FilterExpiry defines the time it takes for an idle filter to expire
FilterExpiry time.Duration
// ForceStartCadenceHeight will force set the starting Cadence height, this should be only used for testing or locally.
ForceStartCadenceHeight uint64
// WalletEnabled sets whether wallet APIs are enabled
WalletEnabled bool
// WalletKey used for signing transactions
WalletKey *ecdsa.PrivateKey
// MetricsPort defines the port the metric server will listen to
MetricsPort int
// IndexOnly configures the gateway to not accept any transactions but only queries of the state
IndexOnly bool
// ProfilerEnabled sets whether the profiler server is enabled
ProfilerEnabled bool
// ProfilerHost is the host for the profiler server will listen to (e.g. localhost, 0.0.0.0)
ProfilerHost string
// ProfilerPort is the port for the profiler server
ProfilerPort int
// TxStateValidation sets the transaction validation mechanism. It can validate
// using the local state index, or wait for the outer Flow transaction to seal.
TxStateValidation string
// TxRequestLimit is the number of transaction submissions to allow per interval.
TxRequestLimit uint64
// TxRequestLimitDuration is the time interval upon which to enforce transaction submission
// rate limiting.
TxRequestLimitDuration time.Duration
// TxBatchMode configures the gateway to send transactions in batches grouped by EOA address,
// to avoid the re-ordering issue for EOAs with a high-volume of transaction submission
// in small intervals.
TxBatchMode bool
// TxBatchInterval is the time interval upon which to submit the transaction batches to the
// Flow network.
TxBatchInterval time.Duration
// ExperimentalSoftFinalityEnabled enables the experimental soft finality feature which syncs
// EVM block and transaction data from the upstream Access node before the block is sealed.
// CAUTION: This feature is experimental and may return incorrect data in certain circumstances.
ExperimentalSoftFinalityEnabled bool
// ExperimentalSealingVerificationEnabled enables the experimental sealing verification feature
// which verifies the hash of the EVM events ingested by the requester engine match the hash
// of the events from the sealed block in the Flow network.
// CAUTION: This feature is experimental and will cause the node to halt if the events don't match.
ExperimentalSealingVerificationEnabled bool
// EOAActivityCacheTTL is the time interval used to track EOA activity. Tx send more
// frequently than this interval will be batched.
// Useful only when batch transaction submission is enabled.
EOAActivityCacheTTL time.Duration
}