Documentation ¶
Index ¶
Constants ¶
View Source
const ( HostIDFlag = "hostID" HostAddressFlag = "hostAddress" AddressFlag = "address" NodeTypeFlag = "nodeType" L1ChainIDFlag = "l1ChainID" ObscuroChainIDFlag = "obscuroChainID" WillAttestFlag = "willAttest" ValidateL1BlocksFlag = "validateL1Blocks" ManagementContractAddressFlag = "managementContractAddress" LogLevelFlag = "logLevel" LogPathFlag = "logPath" UseInMemoryDBFlag = "useInMemoryDB" EdgelessDBHostFlag = "edgelessDBHost" SQLiteDBPathFlag = "sqliteDBPath" ProfilerEnabledFlag = "profilerEnabled" MinGasPriceFlag = "minGasPrice" MessageBusAddressFlag = "messageBusAddress" SequencerIDFlag = "sequencerID" ObscuroGenesisFlag = "obscuroGenesis" DebugNamespaceEnabledFlag = "debugNamespaceEnabled" MaxBatchSizeFlag = "maxBatchSize" MaxRollupSizeFlag = "maxRollupSize" L2BaseFeeFlag = "l2BaseFee" L2CoinbaseFlag = "l2Coinbase" GasBatchExecutionLimit = "gasBatchExecutionLimit" GasLocalExecutionCapFlag = "gasLocalExecutionCap" )
Flag names.
Variables ¶
View Source
var EnclaveFlags = map[string]*flag.TenFlag{ HostIDFlag: flag.NewStringFlag(HostIDFlag, "", "The 20 bytes of the address of the Obscuro host this enclave serves"), HostAddressFlag: flag.NewStringFlag(HostAddressFlag, "127.0.0.1:10000", "The peer-to-peer IP address of the Obscuro host this enclave serves"), AddressFlag: flag.NewStringFlag(AddressFlag, "127.0.0.1:11000", "The address on which to serve the Obscuro enclave service"), NodeTypeFlag: flag.NewStringFlag(NodeTypeFlag, common.Sequencer.String(), "The node's type (e.g. sequencer, validator)"), WillAttestFlag: flag.NewBoolFlag(WillAttestFlag, false, "Whether the enclave will produce a verified attestation report"), ValidateL1BlocksFlag: flag.NewBoolFlag(ValidateL1BlocksFlag, false, "Whether to validate incoming blocks using the hardcoded L1 genesis.json config"), ManagementContractAddressFlag: flag.NewStringFlag(ManagementContractAddressFlag, "", "The management contract address on the L1"), LogLevelFlag: flag.NewIntFlag(LogLevelFlag, 3, "The verbosity level of logs. (Defaults to Info)"), LogPathFlag: flag.NewStringFlag(LogPathFlag, "stdout", "The path to use for the enclave service's log file"), EdgelessDBHostFlag: flag.NewStringFlag(EdgelessDBHostFlag, "", "Host address for the edgeless DB instance (can be empty if useInMemoryDB is true or if not using attestation"), SQLiteDBPathFlag: flag.NewStringFlag(SQLiteDBPathFlag, "", "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 using attestation/EdgelessDB)"), MinGasPriceFlag: flag.NewInt64Flag(MinGasPriceFlag, 1, "The minimum gas price for mining a transaction"), MessageBusAddressFlag: flag.NewStringFlag(MessageBusAddressFlag, "", "The address of the L1 message bus contract owned by the management contract."), SequencerIDFlag: flag.NewStringFlag(SequencerIDFlag, "", "The 20 bytes of the address of the sequencer for this network"), MaxBatchSizeFlag: flag.NewUint64Flag(MaxBatchSizeFlag, 1024*55, "The maximum size a batch is allowed to reach uncompressed"), MaxRollupSizeFlag: flag.NewUint64Flag(MaxRollupSizeFlag, 1024*64, "The maximum size a rollup is allowed to reach"), L2BaseFeeFlag: flag.NewUint64Flag(L2BaseFeeFlag, params.InitialBaseFee, ""), L2CoinbaseFlag: flag.NewStringFlag(L2CoinbaseFlag, "0xd6C9230053f45F873Cb66D8A02439380a37A4fbF", ""), GasBatchExecutionLimit: flag.NewUint64Flag(GasBatchExecutionLimit, 3_000_000_000, "Max gas that can be executed in a single batch"), ObscuroGenesisFlag: flag.NewStringFlag(ObscuroGenesisFlag, "", "The json string with the obscuro genesis"), L1ChainIDFlag: flag.NewInt64Flag(L1ChainIDFlag, 1337, "An integer representing the unique chain id of the Ethereum chain used as an L1 (default 1337)"), ObscuroChainIDFlag: flag.NewInt64Flag(ObscuroChainIDFlag, 443, "An integer representing the unique chain id of the Obscuro chain (default 443)"), UseInMemoryDBFlag: flag.NewBoolFlag(UseInMemoryDBFlag, true, "Whether the enclave will use an in-memory DB rather than persist data"), ProfilerEnabledFlag: flag.NewBoolFlag(ProfilerEnabledFlag, false, "Runs a profiler instance (Defaults to false)"), DebugNamespaceEnabledFlag: flag.NewBoolFlag(DebugNamespaceEnabledFlag, false, "Whether the debug namespace is enabled"), GasLocalExecutionCapFlag: flag.NewUint64Flag(GasLocalExecutionCapFlag, 4_000_000_000, "Max gas usage when executing local transactions"), }
EnclaveFlags are the flags that the enclave can receive
Functions ¶
This section is empty.
Types ¶
type EnclaveConfig ¶
type EnclaveConfig struct { // The identity of the host the enclave service is tied to HostID gethcommon.Address // The public peer-to-peer IP address of the host the enclave service is tied to HostAddress string // The address on which to serve requests Address string // The type of the node. NodeType common.NodeType // The ID of the L1 chain L1ChainID int64 // The ID of the Obscuro chain ObscuroChainID int64 // Whether to produce a verified attestation report WillAttest bool // Whether to validate incoming L1 blocks ValidateL1Blocks bool // When validating incoming blocks, the genesis config for the L1 chain GenesisJSON []byte // The management contract address on the L1 network ManagementContractAddress gethcommon.Address // LogLevel determines the verbosity of output logs LogLevel int // The path that the enclave's logs are written to LogPath string // Whether the enclave should use in-memory or persistent storage UseInMemoryDB bool // host address for the edgeless DB instance (can be empty if using InMemory DB or if attestation is disabled) EdgelessDBHost string // 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) SqliteDBPath string // ProfilerEnabled starts a profiler instance ProfilerEnabled bool // MinGasPrice is the minimum gas price for mining a transaction MinGasPrice *big.Int // MessageBus L1 Address MessageBusAddress gethcommon.Address // The identity of the sequencer for the network SequencerID gethcommon.Address // A json string that specifies the prefunded addresses at the genesis of the Obscuro network ObscuroGenesis string // Whether debug calls are available DebugNamespaceEnabled bool // Maximum bytes a batch can be uncompressed. MaxBatchSize uint64 // MaxRollupSize - 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 MaxRollupSize uint64 GasPaymentAddress gethcommon.Address BaseFee *big.Int GasBatchExecutionLimit uint64 GasLocalExecutionCapFlag uint64 }
EnclaveConfig contains the full configuration for an Obscuro enclave service.
func NewConfigFromFlags ¶ added in v0.21.0
func NewConfigFromFlags(cliFlags map[string]*flag.TenFlag) (*EnclaveConfig, error)
type HostConfig ¶
type HostConfig struct { // The ID of the L1 chain L1ChainID int64 // The ID of the Obscuro chain ObscuroChainID int64 // L1StartHash is the hash of the L1 block we can start streaming from for all Obscuro state (e.g. management contract deployment block) L1StartHash gethcommon.Hash // The ID of the obscuro sequencer node SequencerID gethcommon.Address // The rollup contract address on the L1 network ManagementContractAddress gethcommon.Address // The message bus contract address on the L1 network MessageBusAddress gethcommon.Address // Min interval before creating the next batch (only used by Sequencer nodes) BatchInterval time.Duration // MaxBatchInterval is the max interval between batches, if this is set higher than BatchInterval, the host will // not create empty batches until the MaxBatchInterval is reached or a transaction is received. MaxBatchInterval time.Duration // Min interval before creating the next rollup (only used by Sequencer nodes) RollupInterval time.Duration // MaxRollupSize is the max size of the rollup MaxRollupSize uint64 // The expected time between blocks on the L1 network L1BlockTime time.Duration // The host's identity derived from the L1 Private Key ID gethcommon.Address // The stringified private key for the host's L1 wallet PrivateKeyString string // Whether the host is the genesis Obscuro node IsGenesis bool // The type of the node. NodeType common.NodeType // LogLevel determines the verbosity of output logs LogLevel int // The path that the node's logs are written to LogPath string // Whether the host should use in-memory or persistent storage UseInMemoryDB bool // filepath for the levelDB persistence dir (can be empty if a throwaway file in /tmp/ is acceptable, or if using InMemory DB) LevelDBPath string // Whether to serve client RPC requests over HTTP HasClientRPCHTTP bool // Port on which to handle HTTP client RPC requests ClientRPCPortHTTP uint64 // Whether to serve client RPC requests over websockets HasClientRPCWebsockets bool // Port on which to handle websocket client RPC requests ClientRPCPortWS uint64 // Host on which to handle client RPC requests ClientRPCHost string // Address on which to connect to the enclave EnclaveRPCAddress string // P2PBindAddress is the address where the P2P server is bound to P2PBindAddress string // P2PPublicAddress is the advertised P2P server address P2PPublicAddress string // L1WebsocketURL is the RPC address for interactions with the L1 L1WebsocketURL string // Timeout duration for RPC requests to the enclave service EnclaveRPCTimeout time.Duration // Timeout duration for connecting to, and communicating with, the L1 node L1RPCTimeout time.Duration // Timeout duration for messaging between hosts. P2PConnectionTimeout time.Duration // ProfilerEnabled starts a profiler instance ProfilerEnabled bool // MetricsEnabled defines whether the metrics are enabled or not MetricsEnabled bool // MetricsHTTPPort sets the port where the http server is available MetricsHTTPPort uint // DebugNamespaceEnabled enables the debug namespace handler in the host rpc server DebugNamespaceEnabled bool // Whether p2p is enabled or not IsInboundP2PDisabled bool }
HostConfig contains the configuration used in the Obscuro host execution. Some fields are derived from the HostInputConfig.
type HostInputConfig ¶
type HostInputConfig struct { // Whether the host is the genesis Obscuro node IsGenesis bool // The type of the node. NodeType common.NodeType // Whether to serve client RPC requests over HTTP HasClientRPCHTTP bool // Port on which to handle HTTP client RPC requests ClientRPCPortHTTP uint64 // Whether to serve client RPC requests over websockets HasClientRPCWebsockets bool // Port on which to handle websocket client RPC requests ClientRPCPortWS uint64 // Host on which to handle client RPC requests ClientRPCHost string // Address on which to connect to the enclave EnclaveRPCAddress string // P2PBindAddress is the address where the P2P server is bound to P2PBindAddress string // P2PPublicAddress is the advertised P2P server address P2PPublicAddress string // L1WebsocketURL is the RPC address for interactions with the L1 L1WebsocketURL string // Timeout duration for RPC requests to the enclave service EnclaveRPCTimeout time.Duration // Timeout duration for connecting to, and communicating with, the L1 node L1RPCTimeout time.Duration // Timeout duration for messaging between hosts. P2PConnectionTimeout time.Duration // The rollup contract address on the L1 network ManagementContractAddress gethcommon.Address // The message bus contract address on the L1 network MessageBusAddress gethcommon.Address // LogLevel determines the verbosity of output logs LogLevel int // The path that the node's logs are written to LogPath string // The stringified private key for the host's L1 wallet PrivateKeyString string // The ID of the L1 chain L1ChainID int64 // The ID of the Obscuro chain ObscuroChainID int64 // ProfilerEnabled starts a profiler instance ProfilerEnabled bool // L1StartHash is the hash of the L1 block we can start streaming from for all Obscuro state (e.g. management contract deployment block) L1StartHash gethcommon.Hash // The ID of the obscuro sequencer node SequencerID gethcommon.Address // MetricsEnabled defines whether the metrics are enabled or not MetricsEnabled bool // MetricsHTTPPort sets the port where the http server is available MetricsHTTPPort uint // UseInMemoryDB sets whether the host should use in-memory or persistent storage UseInMemoryDB bool // LevelDBPath path for the levelDB persistence dir (can be empty if a throwaway file in /tmp/ is acceptable, or if using InMemory DB) LevelDBPath string // DebugNamespaceEnabled enables the debug namespace handler in the host rpc server DebugNamespaceEnabled bool // Min interval before creating the next batch (only used by Sequencer nodes) BatchInterval time.Duration // MaxBatchInterval is the max interval between batches, if this is set higher than BatchInterval, the host will // not create empty batches until the MaxBatchInterval is reached or a transaction is received. MaxBatchInterval time.Duration // Min interval before creating the next rollup (only used by Sequencer nodes) RollupInterval time.Duration // The expected time between blocks on the L1 network L1BlockTime time.Duration // Whether inbound p2p is enabled or not IsInboundP2PDisabled bool // MaxRollupSize specifies the threshold size which the sequencer-host publishes a rollup MaxRollupSize uint64 }
HostInputConfig contains the configuration that was parsed from a config file / command line to start the Obscuro host.
func DefaultHostParsedConfig ¶
func DefaultHostParsedConfig() *HostInputConfig
DefaultHostParsedConfig returns a HostConfig with default values.
func (HostInputConfig) ToHostConfig ¶
func (p HostInputConfig) ToHostConfig() *HostConfig
ToHostConfig returns a HostConfig given a HostInputConfig
Click to show internal directories.
Click to hide internal directories.