types

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModeValidator defines a validator node.
	// It's validator key has staked tokens and it actively participates in consensus and is subject to rewards and penalties.
	// It must always be online, otherwise it will get stashed/jailed.
	// [genesis_validator_set=true,pruning=default,consensus=default,special_p2p=false].
	// Note technically a validator node is also a "full node".
	ModeValidator = e2e.ModeValidator

	// ModeArchive defines an archive node.
	// It stores all historical blocks and state, it doesn't delete anything ever. It will require TBs of disk.
	// [genesis_validator_set=false,pruning=none,consensus=default,special_p2p=false].
	// Note technically an archive node is also a "full node".
	ModeArchive Mode = "archive"

	// ModeSeed defines a seed node. It must have a long-lived p2p pubkey and address (encoded in repo).
	// It acts as notice board for external nodes to learn about the network and connect to publicly available nodes.
	// It crawls the network regularly, making it available to new nodes.
	// [genesis_validator_set=false,pruning=default,consensus=default,special_p2p=true].
	// Note technically a seed node is also a "full node".
	ModeSeed = e2e.ModeSeed

	// ModeFull defines a full node. A full node a normal node without a special role.
	// [genesis_validator_set=false,pruning=default,consensus=default,special_p2p=false].
	ModeFull = e2e.ModeFull

	// ModeLight defines a light node. This isn't used yet.
	// [genesis_validator_set=false,pruning=no_data,consensus=light,special_p2p=false]
	// Only light nodes are not also full nodes.
	ModeLight = e2e.ModeLight
)

Variables

This section is empty.

Functions

func PublicRPCByName

func PublicRPCByName(name string) string

PublicRPCByName returns the public chain RPC address by name.

Types

type AnvilChain

type AnvilChain struct {
	Chain       EVMChain // For netconf
	InternalIP  net.IP   // For docker container IP
	ProxyPort   uint32   // For binding
	InternalRPC string   // For JSON-RPC queries from halo/relayer
	ExternalRPC string   // For JSON-RPC queries from e2e app.
	LoadState   string   // File path to load anvil state from
}

AnvilChain represents an anvil chain instance in a omni network.

type ContractName

type ContractName string
const (
	ContractPortal ContractName = "portal"
)

type DeployInfo

type DeployInfo struct {
	Address common.Address
	Height  uint64
}

DeployInfo contains the address and deploy height of a deployed contract.

type DeployInfos

type DeployInfos map[uint64]map[ContractName]DeployInfo

DeployInfos contains the addresses of deployed xdapps and contracts by chainID.

Note that ContractPortal is duplicated both here and in netconf.Chain. That is because netconf is used by halo and relayer and other production apps.

This DeployInfos is similar to netconf, but it is only used by e2e deployment and tests. As soon as any production app needs to use any of these addresses, they should be moved to netconf. TODO(corver): Remove since this is stored in on-chain PortalRegistry.

func LoadDeployInfos

func LoadDeployInfos(file string) (DeployInfos, error)

func (DeployInfos) Addr

func (i DeployInfos) Addr(chainID uint64, contract ContractName) (common.Address, bool)

func (DeployInfos) Save

func (i DeployInfos) Save(file string) error

func (DeployInfos) Set

func (i DeployInfos) Set(chainID uint64, contract ContractName, addr common.Address, height uint64)

type EVMChain

type EVMChain struct {
	evmchain.Metadata
	Shards   []xchain.ShardID
	IsPublic bool
}

EVMChain represents a EVM chain in a omni network.

func AnvilChainsByNames

func AnvilChainsByNames(names []string) ([]EVMChain, error)

AnvilChainsByNames returns the Anvil evm chain definitions by names.

func OmniEVMByNetwork

func OmniEVMByNetwork(network netconf.ID) EVMChain

OmniEVMByNetwork returns the Omni evm chain definition by netconf network.

func PublicChainByName

func PublicChainByName(name string) (EVMChain, error)

PublicChainByName returns the public chain definition by name.

func (EVMChain) AttestInterval added in v0.1.9

func (c EVMChain) AttestInterval(network netconf.ID) uint64

AttestInterval returns the a constant interval for which attestations are always required, even if empty..

func (EVMChain) ShardsUint64 added in v0.1.9

func (c EVMChain) ShardsUint64() []uint64

type InfraProvider

type InfraProvider interface {
	infra.Provider

	Upgrade(ctx context.Context, cfg UpgradeConfig) error

	// Clean deletes all containers, networks, and data on disk.
	Clean(ctx context.Context) error
}

type InfrastructureData

type InfrastructureData struct {
	e2e.InfrastructureData

	// VMs maps the VM name to its instance data.
	// Note this differs from e2e.InfrastructureData.Instances, which maps the service names to its instance data.
	VMs map[string]e2e.InstanceData
}

InfrastructureData wraps e2e.InfrastructureData with additional omni-specific fields.

func (InfrastructureData) ServicesByInstance added in v0.1.3

func (d InfrastructureData) ServicesByInstance(data e2e.InstanceData) map[string]bool

ServicesByInstance returns the set of services associated to the instance.

type Manifest

type Manifest struct {
	e2e.Manifest

	Network netconf.ID `toml:"network"`

	// AnvilChains defines the anvil chains to deploy; mock_l1, mock_l2, etc.
	AnvilChains []string `toml:"anvil_chains"`

	// PublicChains defines the public chains to connect to; arb_sepolia, etc.
	PublicChains []string `toml:"public_chains"`

	// MultiOmniEVMs defines whether to deploy one or multiple Omni EVMs.
	MultiOmniEVMs bool `toml:"multi_omni_evms"`

	// OnlyMonitor indicates that the monitor is the only thing that we deploy in this network.
	OnlyMonitor bool `toml:"only_monitor"`

	// PingPongN defines the number of ping pong messages to send. Defaults 3 if 0.
	PingPongN uint64 `toml:"pingpong_n"`

	// Keys contains long-lived private keys (address by type) by node name.
	Keys map[string]map[key.Type]string `toml:"keys"`

	// Perturb defines additional (non-cometBFT) perturbations by service name.
	Perturb map[string][]Perturb `json:"perturb"`

	// Explorer defines whether to deploy the explorer.
	Explorer bool `toml:"explorer"`
}

func (Manifest) OmniEVMs

func (m Manifest) OmniEVMs() map[string]bool

OmniEVMs returns a map of omni evm instances names by <IsArchive> to deploy. If only a single Omni EVM is to be deployed, the name is "omni_evm". Otherwise, the names are "<node>_evm".

func (Manifest) Seeds added in v0.1.3

func (m Manifest) Seeds() map[string]bool

Seeds returns a map of seed nodes by name.

type Mode added in v0.1.3

type Mode = e2e.Mode

Mode defines the halo consensus node mode. Nodes are in general full nodes (light nodes are not supported yet). In some cases, additional roles are defined: validator, archive, seed.

Note that the execution clients only have two modes: "default" and "archive".

e2e.Mode is extended so ModeArchive can be added transparently.

type OmniEVM

type OmniEVM struct {
	Chain        EVMChain // For netconf (all instances must have the same chain)
	InstanceName string   // For docker container name
	AdvertisedIP net.IP   // For setting up NAT on geth bootnode
	ProxyPort    uint32   // For binding
	InternalRPC  string   // For JSON-RPC queries from halo/relayer
	ExternalRPC  string   // For JSON-RPC queries from e2e app.
	IsArchive    bool     // Whether this instance is in archive mode
	JWTSecret    string   // JWT secret for authentication

	// P2P networking
	NodeKey *ecdsa.PrivateKey // Private key
	Enode   *enode.Node       // Public key
	Peers   []*enode.Node     // Peer public keys
}

OmniEVM represents a omni evm instance in a omni network. Similar to e2e.Node for halo instances.

func (OmniEVM) NodeKeyHex

func (o OmniEVM) NodeKeyHex() string

NodeKeyHex returns the hex-encoded node key. Used for geth's config.

type Perturb added in v0.1.5

type Perturb string

Perturb defines non-cometBFT perturbations of components like omni_evm.

const (
	PerturbUnknown Perturb = ""
	// PerturbRestart defines a perturbation that restarts a docker container.
	PerturbRestart Perturb = "restart"
	// PerturbStopStart defines a perturbation that stops and then starts a docker container.
	PerturbStopStart Perturb = "stopstart"
	// PerturbRollback defines a perturbation that stops a halo node, performs a rollback, then starts it again.
	PerturbRollback Perturb = "rollback"

	// PerturbFuzzyHeadDropBlocks defines a perturbation that enables fuzzyhead dropping xblock for a while.
	PerturbFuzzyHeadDropBlocks Perturb = "fuzzyhead_dropblocks"
	// PerturbFuzzyHeadDropMsgs defines a perturbation that enables fuzzyhead drop xmsgs for a while.
	PerturbFuzzyHeadDropMsgs Perturb = "fuzzyhead_dropmsgs"
	// PerturbFuzzyHeadAttRoot defines a perturbation that enables fuzzyhead inconsistent attestation root for a while.
	PerturbFuzzyHeadAttRoot Perturb = "fuzzyhead_attroot"
	// PerturbFuzzyHeadMoreMsgs defines a perturbation that enables fuzzyhead more/duplicate xmsgs for a while.
	PerturbFuzzyHeadMoreMsgs Perturb = "fuzzyhead_moremsgs"
)

type PublicChain

type PublicChain struct {
	// contains filtered or unexported fields
}

PublicChain represents a public chain in a omni network.

func NewPublicChain added in v0.1.3

func NewPublicChain(chain EVMChain, rpcAddresses []string) PublicChain

func (PublicChain) Chain

func (c PublicChain) Chain() EVMChain

Chain returns the EVM chain.

func (PublicChain) NextRPCAddress added in v0.1.3

func (c PublicChain) NextRPCAddress() string

NextRPCAddress returns the next RPC address in the list.

type Testnet

type Testnet struct {
	*e2e.Testnet
	Network      netconf.ID
	OmniEVMs     []OmniEVM
	AnvilChains  []AnvilChain
	PublicChains []PublicChain
	OnlyMonitor  bool
	Explorer     bool
	Perturb      map[string][]Perturb
}

Testnet wraps e2e.Omega with additional omni-specific fields.

func (Testnet) BroadcastNode added in v0.1.4

func (t Testnet) BroadcastNode() *e2e.Node

BroadcastNode returns a halo node to use for RPC queries broadcasts. It prefers a validator nodes since we have an issue with mempool+p2p+startup where txs get stuck in non-validator mempool immediately after startup if not connected to peers yet. Also avoid validators that are not started immediately.

func (Testnet) BroadcastOmniEVM added in v0.1.3

func (t Testnet) BroadcastOmniEVM() OmniEVM

BroadcastOmniEVM returns a Omni EVM to use for e2e app tx broadcasts. It prefers a validator nodes since we have an issue with mempool+p2p+startup where txs get stuck in non-validator mempool immediately after startup if not connected to peers yet. Also avoid validators that are not started immediately.

func (Testnet) HasOmniEVM

func (t Testnet) HasOmniEVM() bool

func (Testnet) HasPerturbations added in v0.1.5

func (t Testnet) HasPerturbations() bool

HasPerturbations returns whether the network has any perturbations.

func (Testnet) RandomHaloAddr added in v0.1.3

func (t Testnet) RandomHaloAddr() string

RandomHaloAddr returns a random halo address for cprovider and cometBFT rpc clients. It uses the internal IP address of a random node that isn't delayed or a seed.

type UpgradeConfig added in v0.1.3

type UpgradeConfig struct {
	ServiceRegexp string
}

func DefaultUpgradeConfig added in v0.1.3

func DefaultUpgradeConfig() UpgradeConfig

Jump to

Keyboard shortcuts

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