params

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type L1SetupData added in v0.8.0

type L1SetupData struct {
	// ObscuroStartBlock is the L1 block hash where the Obscuro network activity begins (e.g. mgmt contract deployment)
	ObscuroStartBlock common.Hash
	// MgmtContractAddr defines the management contract address
	MgmtContractAddress common.Address
	// ObxErc20Address - the address of the "OBX" ERC20
	ObxErc20Address common.Address
	// EthErc20Address - the address of the "ETH" ERC20
	EthErc20Address common.Address
	// MessageBusAddr - the address of the L1 message bus.
	MessageBusAddr *common.Address
}

type SimParams

type SimParams struct {
	NumberOfNodes int

	// A critical parameter of the simulation. The value should be as low as possible, as long as the test is still meaningful
	AvgBlockDuration  time.Duration
	AvgNetworkLatency time.Duration // artificial latency injected between sending and receiving messages on the mock network

	SimulationTime time.Duration // how long the simulations should run for

	// EfficiencyThresholds represents an acceptable "dead blocks" percentage for this simulation.
	// dead blocks - Blocks that are produced and gossiped, but don't make it into the canonical chain.
	// We test the results against this threshold to catch eventual protocol errors.
	L1EfficiencyThreshold     float64
	L2EfficiencyThreshold     float64 // number of dead obscuro blocks
	L2ToL1EfficiencyThreshold float64 // number of ethereum blocks that don't include an obscuro node

	// MgmtContractLib allows parsing MgmtContract txs to and from the eth txs
	MgmtContractLib mgmtcontractlib.MgmtContractLib
	// ERC20ContractLib allows parsing ERC20Contract txs to and from the eth txs
	ERC20ContractLib erc20contractlib.ERC20ContractLib

	L1SetupData *L1SetupData

	// Contains all the wallets required by the simulation
	Wallets *SimWallets

	StartPort int  // The port from which to start allocating ports. Must be unique across all simulations.
	IsInMem   bool // Denotes that the sim does not have a full RPC layer.

	ReceiptTimeout time.Duration // How long to wait for transactions to be confirmed.

	StoppingDelay time.Duration // How long to wait between injection and verification
}

SimParams are the parameters for setting up the simulation.

type SimToken

type SimToken struct {
	Name testcommon.ERC20

	L1Owner           wallet.Wallet
	L1ContractAddress *common.Address

	L2Owner           wallet.Wallet
	L2ContractAddress *common.Address
}

SimToken - mapping between the ERC20s on Ethereum and Obscuro. This holds both the contract addresses and the keys of the contract owners, because it needs to sign transactions and deploy contracts. Note: For now the l2 values are taken from the "bridge" inside the Obscuro core.

type SimWallets

type SimWallets struct {
	MCOwnerWallet wallet.Wallet   // owner of the management contract deployed on Ethereum
	NodeWallets   []wallet.Wallet // the keys used by the obscuro nodes to submit rollups to Eth

	SimEthWallets []wallet.Wallet // the wallets of the simulated users on the Ethereum side
	SimObsWallets []wallet.Wallet // and their equivalents on the obscuro side (with a different chainId)

	L2FaucetWallet wallet.Wallet                  // the wallet of the L2 faucet
	Tokens         map[testcommon.ERC20]*SimToken // The supported tokens
}

func NewSimWallets

func NewSimWallets(nrSimWallets int, nNodes int, ethereumChainID int64, obscuroChainID int64) *SimWallets

func (*SimWallets) AllEthAddresses

func (w *SimWallets) AllEthAddresses() []*common.Address

func (*SimWallets) AllEthWallets

func (w *SimWallets) AllEthWallets() []wallet.Wallet

func (*SimWallets) AllObsWallets

func (w *SimWallets) AllObsWallets() []wallet.Wallet

Jump to

Keyboard shortcuts

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