Documentation ¶
Index ¶
- type BatchConfig
- type CrossChainConfig
- type EnclaveConfig
- type EnclaveDB
- type EnclaveDebug
- type EnclaveL1
- type EnclaveLog
- type EnclaveRPC
- type GasConfig
- type HostConfig
- type HostDB
- type HostDebug
- type HostEnclave
- type HostL1
- type HostLog
- type HostP2P
- type HostRPC
- type L1Config
- type L1Contracts
- type NetworkConfig
- type NodeConfig
- type RollupConfig
- type Sequencer
- type TenConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchConfig ¶ added in v0.28.0
type BatchConfig struct { // Interval is the time between batches being created Interval time.Duration `mapstructure:"interval"` // MaxInterval is the maximum time between batches being created (if this is set higher than Batch Interval, the host will // not create empty batches until the MaxBatchInterval is reached or a transaction is received) MaxInterval time.Duration `mapstructure:"maxInterval"` // MaxSize is the maximum bytes a batch can be uncompressed MaxSize uint64 `mapstructure:"maxSize"` }
BatchConfig contains the configuration for the batch processing on the Ten network
yaml: `network.batch`
type CrossChainConfig ¶ added in v0.28.0
type CrossChainConfig struct { // Interval is the time between sequencer checking if it should produce cross chain messages Interval time.Duration `mapstructure:"interval"` }
CrossChainConfig contains the configuration for the cross chain processing on the Ten network
yaml: `network.crossChain`
type EnclaveConfig ¶
type EnclaveConfig struct { // EnableAttestation specifies whether the enclave will produce verified attestation report. EnableAttestation bool `mapstructure:"enableAttestation"` DB *EnclaveDB `mapstructure:"db"` Debug *EnclaveDebug `mapstructure:"debug"` L1 *EnclaveL1 `mapstructure:"l1"` Log *EnclaveLog `mapstructure:"log"` RPC *EnclaveRPC `mapstructure:"rpc"` }
EnclaveConfig is the configuration struct for the enclave service.
yaml: `enclave`
type EnclaveDB ¶ added in v0.28.0
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"` }
EnclaveDB contains the configuration for the enclave database.
yaml: `enclave.db`
type EnclaveDebug ¶ added in v0.28.0
type EnclaveDebug struct { EnableDebugNamespace bool `mapstructure:"enableDebugNamespace"` EnableProfiler bool `mapstructure:"enableProfiler"` }
EnclaveDebug contains the configuration for the enclave debug.
yaml: `enclave.debug`
type EnclaveL1 ¶ added in v0.28.0
type EnclaveL1 struct { EnableBlockValidation bool `mapstructure:"enableBlockValidation"` // GenesisJSON is the genesis config for the L1 chain. GenesisJSON []byte `mapstructure:"genesisJSON"` }
EnclaveL1 contains the configuration related to the L1 chain.
yaml: `enclave.l1`
type EnclaveLog ¶ added in v0.28.0
EnclaveLog contains the configuration for the enclave logger.
yaml: `enclave.log`
type EnclaveRPC ¶ added in v0.28.0
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"` }
EnclaveRPC contains the configuration for the enclave RPC server.
yaml: `enclave.rpc`
type GasConfig ¶ added in v0.28.0
type GasConfig struct { BaseFee *big.Int `mapstructure:"baseFee"` // MinGasPrice is the minimum gas price for mining a transaction MinGasPrice *big.Int `mapstructure:"minGasPrice"` PaymentAddress gethcommon.Address `mapstructure:"paymentAddress"` BatchExecutionLimit uint64 `mapstructure:"batchExecutionLimit"` LocalExecutionCap uint64 `mapstructure:"localExecutionCap"` }
GasConfig contains the gas configuration for the Ten network
yaml: `network.gas`
type HostConfig ¶
type HostConfig struct { DB *HostDB `mapstructure:"db"` Debug *HostDebug `mapstructure:"debug"` Enclave *HostEnclave `mapstructure:"enclave"` L1 *HostL1 `mapstructure:"l1"` Log *HostLog `mapstructure:"log"` P2P *HostP2P `mapstructure:"p2p"` RPC *HostRPC `mapstructure:"rpc"` }
HostConfig is the configuration struct for the host service.
yaml: `host`
type HostDB ¶ added in v0.28.0
type HostDB struct { // UseInMemory specifies whether the host should use an in-memory database. UseInMemory bool `mapstructure:"useInMemory"` // PostgresHost is the host address for Postgres DB instance (can be empty if using InMemory DB) PostgresHost string `mapstructure:"postgresHost"` // SqlitePath 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) SqlitePath string `mapstructure:"sqlitePath"` }
HostDB contains the configuration for the host database.
yaml: `host.db`
type HostDebug ¶ added in v0.28.0
type HostDebug struct { EnableMetrics bool `mapstructure:"enableMetrics"` MetricsHTTPPort uint `mapstructure:"metricsHTTPPort"` EnableProfiler bool `mapstructure:"enableProfiler"` EnableDebugNamespace bool `mapstructure:"enableDebugNamespace"` }
HostDebug contains the configuration for the host's debug settings.
yaml: `host.debug`
type HostEnclave ¶ added in v0.28.0
type HostEnclave struct { // RPCAddresses is a list of managed enclave RPC addresses. RPCAddresses []string `mapstructure:"rpcAddresses"` RPCTimeout time.Duration `mapstructure:"rpcTimeout"` }
HostEnclave contains the configuration for the host's enclave(s)
yaml: `host.enclave`
type HostL1 ¶ added in v0.28.0
type HostL1 struct { WebsocketURL string `mapstructure:"wsURL"` // L1BeaconUrl of the beacon chain to fetch blob data L1BeaconUrl string `mapstructure:"beaconURL"` // L1BlobArchiveUrl of the blob archive to fetch expired blob data L1BlobArchiveUrl string `mapstructure:"blobArchiveURL"` // RPCTimeout is the timeout for L1 client operations. RPCTimeout time.Duration `mapstructure:"rpcTimeout"` }
HostL1 contains the configuration for the host's L1 client and interactions.
yaml: `host.l1`
type HostLog ¶ added in v0.28.0
HostLog contains the configuration for the host logger.
yaml: `host.log`
type HostP2P ¶ added in v0.28.0
type HostP2P struct { // IsDisabled specifies whether the host's P2P server should be disabled for incoming connections. IsDisabled bool `mapstructure:"disabled"` // BindAddress is the address to bind the P2P server to // (note: this is not the publicly advertised host address, which is currently on node config). BindAddress string `mapstructure:"bindAddress"` Timeout time.Duration `mapstructure:"timeout"` }
HostP2P contains the configuration for the host P2P server.
yaml: `host.p2p`
type HostRPC ¶ added in v0.28.0
type HostRPC struct { Address string `mapstructure:"address"` EnableHTTP bool `mapstructure:"enableHTTP"` HTTPPort uint64 `mapstructure:"httpPort"` EnableWS bool `mapstructure:"enableWS"` WSPort uint64 `mapstructure:"wsPort"` }
HostRPC contains the configuration for the host RPC server.
yaml: `host.rpc`
type L1Config ¶ added in v0.28.0
type L1Config struct { ChainID int64 `mapstructure:"chainId"` // chainID for the L1 network BlockTime time.Duration `mapstructure:"blockTime"` // average expected block time for the L1 network StartHash gethcommon.Hash `mapstructure:"startHash"` // hash of the first block on the L1 network relevant to the Ten network L1Contracts *L1Contracts `mapstructure:"contracts"` }
L1Config contains config about the L1 network that the Ten network is rolling up to
yaml: `network.l1`
type L1Contracts ¶ added in v0.28.0
type L1Contracts struct { ManagementContract gethcommon.Address `mapstructure:"management"` MessageBusContract gethcommon.Address `mapstructure:"messageBus"` BridgeContract gethcommon.Address `mapstructure:"bridge"` }
L1Contracts contains the addresses of Ten contracts on the L1 network
yaml: `network.l1.contracts`
type NetworkConfig ¶ added in v0.28.0
type NetworkConfig struct { // ChainID is the chainID for the Ten network ChainID int64 `mapstructure:"chainId"` // GenesisJSON is a json string that specifies the prefunded addresses at the genesis of the Ten network GenesisJSON string `mapstructure:"genesis"` Batch *BatchConfig `mapstructure:"batch"` Gas *GasConfig `mapstructure:"gas"` L1 *L1Config `mapstructure:"l1"` Rollup *RollupConfig `mapstructure:"rollup"` Sequencer *Sequencer `mapstructure:"sequencer"` CrossChain *CrossChainConfig `mapstructure:"crossChain"` }
NetworkConfig contains the static configuration for this instance of the Ten network
yaml: `network`
type NodeConfig ¶ added in v0.28.0
type NodeConfig struct { NodeType common.NodeType `mapstructure:"nodeType"` // Name of the node, used by orchestrator to name the containers etc., mostly useful for local testnets Name string `mapstructure:"name"` // The host's identity derived from the L1 Private Key // todo: does node ID still need to exist? Look to remove in favour of enclave IDs ID gethcommon.Address `mapstructure:"id"` // The public peer-to-peer IP address of the host // todo: does host address still need to exist for the enclave to sign over or does the enclave ID cover the usages? HostAddress string `mapstructure:"hostAddress"` // The stringified private key for the host's L1 wallet PrivateKeyString string `mapstructure:"privateKey"` // Whether the host is the genesis Obscuro node IsGenesis bool `mapstructure:"isGenesis"` }
NodeConfig contains the configuration for this Ten node (maybe relevant to multiple processes, host and enclave)
yaml: `node`
type RollupConfig ¶ added in v0.28.0
type RollupConfig struct { // Interval is the time between sequencer checking if it should produce rollups Interval time.Duration `mapstructure:"interval"` // MaxInterval is the max time between sequencer rollups (it will create even if the rollup won't be full) MaxInterval time.Duration `mapstructure:"maxInterval"` // MaxSize - (in bytes) configured to be close to what the ethereum clients // have configured as the maximum size a transaction can have. Note that this isn't // a protocol limit, but a miner imposed limit and it might be hard to find someone // to include a transaction if it goes above it MaxSize uint64 `mapstructure:"maxSize"` }
RollupConfig contains the configuration for the rollup processing on the Ten network
yaml: `network.rollup`
type Sequencer ¶ added in v0.28.0
type Sequencer struct { // P2PAddress is the address that the sequencer will listen on for incoming P2P connections P2PAddress string `mapstructure:"p2pAddress"` }
Sequencer contains the configuration for how the L2 sequencer will operate for the Ten network
yaml: `network.sequencer`
type TenConfig ¶ added in v0.28.0
type TenConfig struct { Network *NetworkConfig `mapstructure:"network"` Node *NodeConfig `mapstructure:"node"` Host *HostConfig `mapstructure:"host"` Enclave *EnclaveConfig `mapstructure:"enclave"` }
TenConfig is the top-level configuration struct for all TEN services. Fields are organised hierarchically, not all fields and structures will be used by all services.
The default config is defined in yaml files formatted hierarchically like: ``` network:
chainId: 1234 l1Contracts: managementContract: "0x1234567890abcdef1234567890abcdef12345678" ...
node:
nodeType: "validator" ...
``` The config can be overridden by other yaml files formatted the same. But fields can also be overridden directly per yaml spec, e.g.: ``` network.chainId: 5678 node.nodeType: "sequencer" ```
Fields can also be overridden by environment variables, with the key being the flattened path of the field, like: ``` export NETWORK_CHAINID=5678 export NODE_NODETYPE=sequencer ``` For ease of reading only the top-level struct is defined in this file, the nested structs are defined in their own files.
func LoadTenConfig ¶ added in v0.28.0
LoadTenConfig reads the base config file and applying additional files provided as well as any env variables, returns a TenConfig struct
func (*TenConfig) PrettyPrint ¶ added in v0.28.0
func (t *TenConfig) PrettyPrint()
func (*TenConfig) ToEnvironmentVariables ¶ added in v0.28.0
ToEnvironmentVariables converts the config structure into environment variables map