netconf

package
v0.1.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package netconf provides the configuration of an Omni network, an instance of the Omni cross chain protocol.

Index

Constants

View Source
const (
	// Simnet is a simulated network for very simple testing of individual binaries.
	// It is a single binary with mocked clients (no networking).
	Simnet = "simnet" // Single binary with mocked clients (no network)

	// Devnet is the most basic single-machine deployment of the Omni cross chain protocol.
	// It uses docker compose to setup a network with multi containers.
	// E.g. 2 geth nodes, 4 halo validators, a relayer, and 2 anvil rollups.
	Devnet = "devnet"

	// Staging is the Omni team's internal staging network, similar to a internal testnet.
	// It connects to real public rollup testnets (e.g. Arbitrum testnet).
	// It is deployed to GCP using terraform.
	// E.g. 1 Erigon, 1 Geth, 4 halo validators, 2 halo sentries, 1 relayer.
	Staging = "staging"

	// Testnet is the Omni public testnet.
	Testnet = "testnet"

	// Mainnet is the Omni public mainnet.
	Mainnet = "mainnet"
)

Variables

This section is empty.

Functions

func BindFlag

func BindFlag(flags *pflag.FlagSet, netConf *string)

BindFlag binds the standard flag to provide network config path at runtime.

func Save

func Save(network Network, path string) error

Save saves the network configuration to the given path.

Types

type Chain

type Chain struct {
	ID                uint64            // Chain ID asa per https://chainlist.org
	Name              string            // Chain name as per https://chainlist.org
	RPCURL            string            // RPC URL of the chain
	AuthRPCURL        string            // RPC URL of the chain with JWT authentication enabled
	PortalAddress     string            // Address of the omni portal contract on the chain
	DeployHeight      uint64            // Height that the portal contracts were deployed
	IsOmni            bool              // Whether this is the Omni chain
	IsEthereum        bool              // Whether this is the ethereum layer1 chain
	BlockPeriod       time.Duration     // Block period of the chain
	FinalizationStrat FinalizationStrat // Finalization strategy of the chain
}

Chain defines the configuration of an execution chain that supports the Omni cross chain protocol. This is most supported Rollup EVM, but also the Omni EVM.

func (Chain) MarshalJSON

func (c Chain) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Chain) UnmarshalJSON

func (c *Chain) UnmarshalJSON(bz []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type FinalizationStrat

type FinalizationStrat string

FinalizationStrat defines the finalization strategy of a chain. This is mostly ethclient.HeadFinalized, but some chains may not support it, like zkEVM chains which would need a much more involved strategy.

func (FinalizationStrat) Verify

func (h FinalizationStrat) Verify() error

type Network

type Network struct {
	Name   string  `json:"name"`   // Name of the network. e.g. "simnet", "testnet", "staging", "mainnet"
	Chains []Chain `json:"chains"` // Chains that are part of the network
}

Network defines a deployment of the Omni cross chain protocol. It spans an omni chain (both execution and consensus) and a set of supported rollup EVMs.

func Load

func Load(path string) (Network, error)

Load loads the network configuration from the given path.

func (Network) Chain

func (n Network) Chain(id uint64) (Chain, bool)

Chain returns the chain config for the given ID or false if it does not exist.

func (Network) ChainIDs

func (n Network) ChainIDs() []uint64

ChainIDs returns the all chain IDs in the network. This is a convenience method.

func (Network) ChainName

func (n Network) ChainName(id uint64) string

ChainName returns the chain name for the given ID or an empty string if it does not exist.

func (Network) ChainNamesByIDs

func (n Network) ChainNamesByIDs() map[uint64]string

ChainNamesByIDs returns the all chain IDs and names in the network. This is a convenience method.

func (Network) EthereumChain

func (n Network) EthereumChain() (Chain, bool)

EthereumChain returns the Eth Layer1 chain config or false if it does not exist.

func (Network) OmniChain

func (n Network) OmniChain() (Chain, bool)

OmniChain returns the Omni execution chain config or false if it does not exist.

func (Network) Validate

func (n Network) Validate() error

Validate returns an error if the configuration is invalid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL