app

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: GPL-3.0 Imports: 81 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppAddressTCP  = "tcp://127.0.0.1:30000"
	AppAddressUNIX = "unix:///var/run/app.sock"

	PrivvalKeyFile   = "config/priv_validator_key.json"
	PrivvalStateFile = "data/priv_validator_state.json"
)
View Source
const (
	EnvInfraType       = "INFRASTRUCTURE_TYPE"
	EnvInfraFile       = "INFRASTRUCTURE_FILE"
	EnvE2EManifest     = "E2E_MANIFEST"
	EnvE2ENode         = "E2E_NODE"
	EnvE2ERPCEndpoints = "E2E_RPC_ENDPOINTS"
	EnvE2EDeployInfo   = "E2E_DEPLOY_INFO"
)

Variables

View Source
var (
	GasPumpTests = []GasPumpTest{
		{
			Recipient:  common.HexToAddress("0x0000000000000000000000000000000000001111"),
			TargetOMNI: big.NewInt(5000000000000000),
		},
		{
			Recipient:  common.HexToAddress("0x0000000000000000000000000000000000002222"),
			TargetOMNI: big.NewInt(10000000000000000),
		},
		{
			Recipient:  common.HexToAddress("0x0000000000000000000000000000000000003333"),
			TargetOMNI: big.NewInt(15000000000000000),
		},
	}
)
View Source
var ToL1BridgeTests = []BridgeTest{
	{
		To:     common.HexToAddress("0x1111111111111111111111111111111111111111"),
		Amount: ether(100),
	},
	{
		To:     common.HexToAddress("0x2222222222222222222222222222222222222222"),
		Amount: ether(100),
	},
	{
		To:     common.HexToAddress("0x3333333333333333333333333333333333333333"),
		Amount: ether(100),
	},
}
View Source
var ToNativeBridgeTests = []BridgeTest{
	{
		To:     common.HexToAddress("0x1111111111111111111111111111111111111111"),
		Amount: ether(1000),
	},
	{
		To:     common.HexToAddress("0x2222222222222222222222222222222222222222"),
		Amount: ether(1000),
	},
	{
		To:     common.HexToAddress("0x3333333333333333333333333333333333333333"),
		Amount: ether(1000),
	},
}

Functions

func CleanInfra

func CleanInfra(ctx context.Context, def Definition) error

CleanInfra stops and removes the infra containers.

func CleanupDir

func CleanupDir(ctx context.Context, dir string) error

CleanupDir cleans up a testnet directory.

func Create3Deploy

func Create3Deploy(ctx context.Context, def Definition, cfg Create3DeployConfig) error

Create3Deploy deploys the Omni Create3 contracts.

func Deploy

func Deploy(ctx context.Context, def Definition, cfg DeployConfig) (*pingpong.XDapp, error)

Deploy a new e2e network. It also starts all services in order to deploy private portals. It also returns an optional deployed ping pong contract is enabled.

func DeployGasApp

func DeployGasApp(ctx context.Context, def Definition) error

DeployGasApp deploys OmniGasPump and OmniGasStation contracts.

func E2ETest

func E2ETest(ctx context.Context, def Definition, cfg E2ETestConfig) error

E2ETest runs a full e2e test.

func ExternalEndpoints

func ExternalEndpoints(def Definition) xchain.RPCEndpoints

ExternalEndpoints returns the evm rpc endpoints for access from outside the docker network.

func FundAccounts

func FundAccounts(ctx context.Context, def Definition, hotOnly bool, dryRun bool) error

FundAccounts funds the EOAs and contracts that need funding to their target balance.

func FundValidatorsForTesting

func FundValidatorsForTesting(ctx context.Context, def Definition) error

FundValidatorsForTesting funds validators in ephemeral networks: devnet and staging. This is required by load generation for periodic validator self-delegation.

func LoadManifest

func LoadManifest(path string) (types.Manifest, error)

LoadManifest loads a manifest from disk.

func LogMetrics

func LogMetrics(ctx context.Context, def Definition) error

func MakeConfig

func MakeConfig(testnet types.Testnet, node *e2e.Node, nodeDir string) (*config.Config, error)

MakeConfig generates a CometBFT config for a node.

func MonitorCProvider

func MonitorCProvider(ctx context.Context, node *e2e.Node, network netconf.Network) error

func MonitorCursors

func MonitorCursors(ctx context.Context, portals map[uint64]netman.Portal, network netconf.Network) error

func NetworkFromDef

func NetworkFromDef(def Definition) netconf.Network

NetworkFromDef returns the network configuration from the definition. Note that this panics if not called after netman.DeployPortals.

func Restart

func Restart(ctx context.Context, def Definition, cfg DeployConfig, upgradeCfg types.ServiceConfig) error

Restart calls docker-compose down-up on all VMs.

func RunERC20Faucet

func RunERC20Faucet(ctx context.Context, def Definition, cfg RunERC20FaucetConfig) error

RunERC20Faucet runs the ERC20 faucet, funding an address from the initial supply recipient.

func SendXMsgs

func SendXMsgs(ctx context.Context, network netconf.ID, netman netman.Manager, backends ethbackend.Backends, count int) error

SendXMsgs sends <count> xmsgs from every chain to every other chain, then waits for them to be mined.

func Setup

func Setup(ctx context.Context, def Definition, depCfg DeployConfig) error

Setup sets up the testnet configuration.

func StartInitial

func StartInitial(ctx context.Context, testnet *e2e.Testnet, p infra.Provider) error

StartInitial starts the initial nodes (start_at==0).

func StartMonitoringReceipts

func StartMonitoringReceipts(ctx context.Context, def Definition) func() error

StartMonitoringReceipts starts goroutines that streams all xblock receipts ensuring all are successful. It returns a stopfunc that returns an error if any failed receipt was detected before the stopfunc was called.

func StartRemaining

func StartRemaining(ctx context.Context, testnet *e2e.Testnet, p infra.Provider) error

StartRemaining starts the remaining nodes (start_at>0).

func StartSendingXMsgs

func StartSendingXMsgs(ctx context.Context, network netconf.ID, netman netman.Manager, backends ethbackend.Backends, batches ...int) <-chan error

func StartValidatorUpdates

func StartValidatorUpdates(ctx context.Context, def Definition) func() error

func Test

func Test(ctx context.Context, def Definition, verbose bool) error

Test runs test cases under tests/.

func TestnetFromManifest

func TestnetFromManifest(ctx context.Context, manifest types.Manifest, infd types.InfrastructureData, cfg DefinitionConfig) (types.Testnet, error)

func Upgrade

func Upgrade(ctx context.Context, def Definition, cfg DeployConfig, upgradeCfg types.ServiceConfig) error

Upgrade generates all local artifacts, but only copies the dynamic artifacts (excl genesis) to the VMs. It then calls docker-compose up.

func Wait

func Wait(ctx context.Context, testnet *e2e.Testnet, blocks int64) error

Wait waits for a number of blocks to be produced, and for all nodes to catch up with it.

func WaitAllSubmissions

func WaitAllSubmissions(ctx context.Context, network netconf.Network, portals map[uint64]netman.Portal, minimum uint64) error

func WaitUntil

func WaitUntil(ctx context.Context, testnet *e2e.Testnet, height int64) error

WaitUntil waits until a given height has been reached.

Types

type BridgeTest

type BridgeTest struct {
	To     common.Address
	Amount *big.Int
}

type Create3DeployConfig

type Create3DeployConfig struct {
	ChainID uint64 // chain id of the chain to deploy to
}

func (Create3DeployConfig) Validate

func (cfg Create3DeployConfig) Validate() error

Validate validates the Create3DeployConfig.

type Definition

type Definition struct {
	Manifest types.Manifest
	Testnet  types.Testnet // Note that testnet is the cometBFT term.
	Infra    types.InfraProvider
	Cfg      DefinitionConfig // Original config used to construct the Definition.
	// contains filtered or unexported fields
}

Definition defines a e2e network. All (sub)commands of the e2e cli requires a definition operate. Armed with a definition, a e2e network can be deployed, started, tested, stopped, etc.

func MakeDefinition

func MakeDefinition(ctx context.Context, cfg DefinitionConfig, commandName string) (Definition, error)

func (Definition) Backends

func (d Definition) Backends() ethbackend.Backends

Backends returns the backends.

func (Definition) DeployInfos

func (d Definition) DeployInfos() types.DeployInfos

DeployInfos returns the deploy information of the OmniPortal and OmniAVS contracts. Note this panics if not called after netman.DeployPortals.

func (Definition) InitLazyNetwork

func (d Definition) InitLazyNetwork() error

InitLazyNetwork initializes the lazy network, which is the backends and netman.

func (Definition) Netman

func (d Definition) Netman() netman.Manager

Netman returns the netman.

type DefinitionConfig

type DefinitionConfig struct {
	AgentSecrets agent.Secrets

	ManifestFile  string
	InfraProvider string

	// Secrets (not required for devnet)
	DeployKeyFile string
	FireAPIKey    string
	FireKeyPath   string
	RPCOverrides  map[string]string // map[chainName]rpcURL1,rpcURL2,...

	InfraDataFile string // Not required for docker provider
	OmniImgTag    string // OmniImgTag is the docker image tag used for halo and relayer.

	TracingEndpoint string
	TracingHeaders  string
}

DefinitionConfig is the configuration required to create a full Definition.

func DefaultDefinitionConfig

func DefaultDefinitionConfig(ctx context.Context) DefinitionConfig

DefaultDefinitionConfig returns a default configuration for a Definition.

type DeployConfig

type DeployConfig struct {
	PingPongN uint64 // Number of hops per ping pong.
	PingPongP uint64 // Number of parallel ping pongs to start per edge.
	PingPongL uint64 // Number of parallel ping pongs to use Latest confirmation level.
	// contains filtered or unexported fields
}

func DefaultDeployConfig

func DefaultDeployConfig() DeployConfig

type E2ETestConfig

type E2ETestConfig struct {
	Preserve bool
}

E2ETestConfig is the configuration required to run a full e2e test.

func DefaultE2ETestConfig

func DefaultE2ETestConfig() E2ETestConfig

DefaultE2ETestConfig returns a default configuration for a e2e test.

type GasPumpTest

type GasPumpTest struct {
	Recipient  common.Address
	TargetOMNI *big.Int
}

type RunERC20FaucetConfig

type RunERC20FaucetConfig struct {
	AddrToFund string // Hex address to fund.
	Amount     uint64 // Amount to fund.
}

func DefaultRunERC20FaucetConfig

func DefaultRunERC20FaucetConfig() RunERC20FaucetConfig

Directories

Path Synopsis
Package eoa defines well-known (non-fireblocks) eoa private keys used in an omni network.
Package eoa defines well-known (non-fireblocks) eoa private keys used in an omni network.

Jump to

Keyboard shortcuts

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