-
Notifications
You must be signed in to change notification settings - Fork 38
/
enclave.go
66 lines (58 loc) · 2.37 KB
/
enclave.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
package config
import "time"
// EnclaveConfig is the configuration struct for the enclave service.
//
// yaml: `enclave`
type EnclaveConfig struct {
// EnableAttestation specifies whether the enclave will produce verified attestation report.
EnableAttestation bool `mapstructure:"enableAttestation"`
StoreExecutedTransactions bool `mapstructure:"storeExecutedTransactions"`
DB *EnclaveDB `mapstructure:"db"`
Debug *EnclaveDebug `mapstructure:"debug"`
L1 *EnclaveL1 `mapstructure:"l1"`
Log *EnclaveLog `mapstructure:"log"`
RPC *EnclaveRPC `mapstructure:"rpc"`
}
// EnclaveDB contains the configuration for the enclave database.
//
// yaml: `enclave.db`
type EnclaveDB struct {
// UseInMemory specifies whether the enclave should use an in-memory database.
UseInMemory bool `mapstructure:"useInMemory"`
// EdgelessDBHost is the host address for the edgeless DB instance (can be empty if using InMemory DB or if attestation is disabled).
EdgelessDBHost string `mapstructure:"edgelessDBHost"`
// SqliteDBPath is the filepath for the sqlite DB persistence file (can be empty if a throwaway file in /tmp/ is acceptable or
// if using InMemory DB or if attestation is enabled).
SqlitePath string `mapstructure:"sqlitePath"`
}
// EnclaveDebug contains the configuration for the enclave debug.
//
// yaml: `enclave.debug`
type EnclaveDebug struct {
EnableDebugNamespace bool `mapstructure:"enableDebugNamespace"`
EnableProfiler bool `mapstructure:"enableProfiler"`
}
// EnclaveL1 contains the configuration related to the L1 chain.
//
// yaml: `enclave.l1`
type EnclaveL1 struct {
EnableBlockValidation bool `mapstructure:"enableBlockValidation"`
// GenesisJSON is the genesis config for the L1 chain.
GenesisJSON []byte `mapstructure:"genesisJSON"`
}
// EnclaveLog contains the configuration for the enclave logger.
//
// yaml: `enclave.log`
type EnclaveLog struct {
Level int `mapstructure:"level"`
Path string `mapstructure:"path"`
}
// EnclaveRPC contains the configuration for the enclave RPC server.
//
// yaml: `enclave.rpc`
type EnclaveRPC struct {
BindAddress string `mapstructure:"bindAddress"`
// Timeout - calls that are longer than this will be cancelled, to prevent resource starvation
// (normally, the context is propagated from the host, but in some cases like the evm, we have to create a context)
Timeout time.Duration `mapstructure:"timeout"`
}