Documentation
¶
Overview ¶
Package devnet provides functionality to start and manage a development network (devnet) consisting of multiple nodes. It offers utilities for configuring and starting nodes with various consensus mechanisms, such as BootstrapSequencer or Sequencer. The package handles the creation of Avail accounts, configuration of node settings, and starting the associated servers. It also provides functions to interact with the devnet, such as obtaining the JSON-RPC URL or stopping all the nodes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidNodeType = errors.New("invalid node type")
ErrInvalidNodeType is returned when an invalid node type is provided.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context represents the devnet context with information about the running nodes.
func StartNodes ¶
func StartNodes(logger hclog.Logger, bindAddr netip.Addr, availAddr, accountsPath string, nodeTypes ...consensus.MechanismType) (*Context, error)
StartNodes starts the devnet nodes based on the provided parameters. It creates the Avail accounts, configures and starts the nodes, and returns the devnet context.
func (*Context) FirstRPCAddrForNodeType ¶
FirstRPCAddrForNodeType looks up and returns the JSON-RPC URL of the node for the specified node type.
func (*Context) GethClient ¶
GethClient returns an Ethereum client for the specified node type. It connects to the JSON-RPC URL of the first available node of the specified type.
type PortAllocator ¶
type PortAllocator struct {
// contains filtered or unexported fields
}
PortAllocator provides functionality to allocate and release ports for node communication.
func NewPortAllocator ¶
func NewPortAllocator(bindAddr netip.Addr) *PortAllocator
NewPortAllocator creates a new PortAllocator with the provided bind address.
func (*PortAllocator) Allocate ¶
func (pa *PortAllocator) Allocate() (netip.AddrPort, error)
Allocate allocates a new port from the PortAllocator's bind address. It returns the allocated port as a netip.AddrPort.
func (*PortAllocator) Release ¶
func (pa *PortAllocator) Release() error
Release releases all the ports allocated by the PortAllocator. It returns the last error encountered during port release, if any.