Documentation ¶
Index ¶
- type InMemDevNetwork
- func LiveL1DevNetwork(seqWallet wallet.Wallet, validatorWallets []wallet.Wallet, rpcURLs []string) *InMemDevNetwork
- func LocalDevNetwork(tenConfigOpts ...TenConfigOption) *InMemDevNetwork
- func NewInMemDevNetwork(tenConfig *TenConfig, l1Network L1Network, nodeOpL1Wallets *params.SimWallets) *InMemDevNetwork
- func (s *InMemDevNetwork) AllocateFaucetFunds(ctx context.Context, account gethcommon.Address) error
- func (s *InMemDevNetwork) ChainID() int64
- func (s *InMemDevNetwork) CleanUp()
- func (s *InMemDevNetwork) FaucetWallet() wallet.Wallet
- func (s *InMemDevNetwork) GetGatewayClient() (ethadapter.EthClient, error)
- func (s *InMemDevNetwork) GetGatewayURL() (string, error)
- func (s *InMemDevNetwork) GetGatewayWSURL() (string, error)
- func (s *InMemDevNetwork) GetL1Client() (ethadapter.EthClient, error)
- func (s *InMemDevNetwork) GetMCOwnerWallet() (wallet.Wallet, error)
- func (s *InMemDevNetwork) GetSequencerNode() networktest.NodeOperator
- func (s *InMemDevNetwork) GetValidatorNode(i int) networktest.NodeOperator
- func (s *InMemDevNetwork) NumValidators() int
- func (s *InMemDevNetwork) SequencerRPCAddress() string
- func (s *InMemDevNetwork) Start()
- func (s *InMemDevNetwork) ValidatorRPCAddress(idx int) string
- type InMemNodeOperator
- func (n *InMemNodeOperator) HostRPCHTTPAddress() string
- func (n *InMemNodeOperator) HostRPCWSAddress() string
- func (n *InMemNodeOperator) Start() error
- func (n *InMemNodeOperator) StartEnclave(idx int) error
- func (n *InMemNodeOperator) StartHost() error
- func (n *InMemNodeOperator) Stop() error
- func (n *InMemNodeOperator) StopEnclave(idx int) error
- func (n *InMemNodeOperator) StopHost() error
- type L1Config
- type L1Network
- type TenConfig
- type TenConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemDevNetwork ¶
type InMemDevNetwork struct {
// contains filtered or unexported fields
}
InMemDevNetwork is a local dev network (L1 and L2) - the obscuro nodes are in-memory in a single go process, the L1 nodes are a docker geth network
It can play the role of node operators and network admins to reproduce complex scenarios around nodes joining/leaving/failing.
It also implements networktest.NetworkConnector to allow us to run the same NetworkTests against it that we can run against Testnets.
func LiveL1DevNetwork ¶
func LiveL1DevNetwork(seqWallet wallet.Wallet, validatorWallets []wallet.Wallet, rpcURLs []string) *InMemDevNetwork
LiveL1DevNetwork provides a local obscuro network running on a live L1 Caller should provide a wallet per node and ideally an RPC URL per node (may not be necessary but can avoid conflicts, e.g. Infura seems to require an API key per connection)
func LocalDevNetwork ¶ added in v0.24.0
func LocalDevNetwork(tenConfigOpts ...TenConfigOption) *InMemDevNetwork
func NewInMemDevNetwork ¶ added in v0.24.0
func NewInMemDevNetwork(tenConfig *TenConfig, l1Network L1Network, nodeOpL1Wallets *params.SimWallets) *InMemDevNetwork
NewInMemDevNetwork provides an off-the-shelf default config for a sim network tenConfig - the requirements of the L2 network we are spinning up l1Network - the L1 network we are running the L2 network on nodeOpL1Wallets - the funded wallets for the node operators on the L1 network (expecting 1 per node)
func (*InMemDevNetwork) AllocateFaucetFunds ¶
func (s *InMemDevNetwork) AllocateFaucetFunds(ctx context.Context, account gethcommon.Address) error
func (*InMemDevNetwork) ChainID ¶
func (s *InMemDevNetwork) ChainID() int64
func (*InMemDevNetwork) CleanUp ¶
func (s *InMemDevNetwork) CleanUp()
func (*InMemDevNetwork) FaucetWallet ¶
func (s *InMemDevNetwork) FaucetWallet() wallet.Wallet
func (*InMemDevNetwork) GetGatewayClient ¶ added in v0.22.1
func (s *InMemDevNetwork) GetGatewayClient() (ethadapter.EthClient, error)
func (*InMemDevNetwork) GetGatewayURL ¶ added in v0.22.1
func (s *InMemDevNetwork) GetGatewayURL() (string, error)
func (*InMemDevNetwork) GetGatewayWSURL ¶ added in v0.24.1
func (s *InMemDevNetwork) GetGatewayWSURL() (string, error)
func (*InMemDevNetwork) GetL1Client ¶
func (s *InMemDevNetwork) GetL1Client() (ethadapter.EthClient, error)
GetL1Client returns the first client we have for our local L1 network todo (@matt) - this allows tests some basic L1 verification but in future this will need support more manipulation of L1 nodes,
(to allow us to simulate various scenarios where L1 is unavailable, under attack, etc.)
func (*InMemDevNetwork) GetMCOwnerWallet ¶
func (s *InMemDevNetwork) GetMCOwnerWallet() (wallet.Wallet, error)
func (*InMemDevNetwork) GetSequencerNode ¶
func (s *InMemDevNetwork) GetSequencerNode() networktest.NodeOperator
func (*InMemDevNetwork) GetValidatorNode ¶
func (s *InMemDevNetwork) GetValidatorNode(i int) networktest.NodeOperator
func (*InMemDevNetwork) NumValidators ¶
func (s *InMemDevNetwork) NumValidators() int
func (*InMemDevNetwork) SequencerRPCAddress ¶
func (s *InMemDevNetwork) SequencerRPCAddress() string
func (*InMemDevNetwork) Start ¶
func (s *InMemDevNetwork) Start()
func (*InMemDevNetwork) ValidatorRPCAddress ¶
func (s *InMemDevNetwork) ValidatorRPCAddress(idx int) string
type InMemNodeOperator ¶
type InMemNodeOperator struct {
// contains filtered or unexported fields
}
InMemNodeOperator represents an Obscuro node playing a role in a DevSimulation
Anything a node operator could do, that we need to simulate belongs here, for example: * start/stop/reset the host/enclave components of the node * provide convenient access to RPC clients for the node * it might even provide access to things like the database files for the node if needed
Note: InMemNodeOperator will panic when things go wrong, we want to fail fast in sims and avoid verbose error handling in usage
func NewInMemNodeOperator ¶
func (*InMemNodeOperator) HostRPCHTTPAddress ¶ added in v0.22.1
func (n *InMemNodeOperator) HostRPCHTTPAddress() string
func (*InMemNodeOperator) HostRPCWSAddress ¶ added in v0.22.1
func (n *InMemNodeOperator) HostRPCWSAddress() string
func (*InMemNodeOperator) Start ¶
func (n *InMemNodeOperator) Start() error
func (*InMemNodeOperator) StartEnclave ¶
func (n *InMemNodeOperator) StartEnclave(idx int) error
StartEnclave starts the enclave process in
func (*InMemNodeOperator) StartHost ¶
func (n *InMemNodeOperator) StartHost() error
StartHost starts the host process in a new thread
func (*InMemNodeOperator) Stop ¶
func (n *InMemNodeOperator) Stop() error
func (*InMemNodeOperator) StopEnclave ¶
func (n *InMemNodeOperator) StopEnclave(idx int) error
func (*InMemNodeOperator) StopHost ¶
func (n *InMemNodeOperator) StopHost() error
type L1Config ¶
type L1Config struct { PortStart int WebsocketPortStart int NumNodes int AvgBlockDuration time.Duration }
L1Config tells network admin how to setup the L1 network
type L1Network ¶
type L1Network interface { Prepare() // ensure L1 connectivity (start nodes if required) CleanUp() // shut down nodes if required, clean up connections NumNodes() int GetClient(i int) ethadapter.EthClient GetBlockTime() time.Duration // expected interval between blocks }
L1Network represents the L1Network being used for the devnetwork (it could be a local geth docker network, a local in-memory network or even a live public L1) todo (@matt) - refactor to use the same NodeOperator approach as the L2?
func NewGethNetwork ¶
func NewGethNetwork(networkWallets *params.SimWallets, l1Config *L1Config) L1Network
type TenConfig ¶ added in v0.24.0
type TenConfig struct { PortStart int InitNumValidators int BatchInterval time.Duration RollupInterval time.Duration CrossChainInterval time.Duration NumNodes int TenGatewayEnabled bool NumSeqEnclaves int L1BlockTime time.Duration }
TenConfig describes the L2 network configuration we want to spin up
func DefaultTenConfig ¶ added in v0.24.0
func DefaultTenConfig() *TenConfig
type TenConfigOption ¶ added in v0.24.0
type TenConfigOption func(*TenConfig) // option pattern - typically used as overrides to DefaultTenConfig
func WithGateway ¶ added in v0.24.0
func WithGateway() TenConfigOption
func WithHASequencer ¶ added in v0.24.0
func WithHASequencer() TenConfigOption