simulation

package
v0.23.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: AGPL-3.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EnclavePublicKeyHex is the public key of the enclave.
	// todo (@stefan) - retrieve this key from the management contract instead
	EnclavePublicKeyHex = "034d3b7e63a8bcd532ee3d1d6ecad9d67fca7821981a044551f0f0cbec74d0bc5e"
)

Variables

View Source
var SequencerGasKeys, _ = crypto.GenerateKey()

Functions

func ExtractDataFromEthereumChain

func ExtractDataFromEthereumChain(
	startBlock *types.Block,
	endBlock *types.Block,
	node ethadapter.EthClient,
	s *Simulation,
	nodeIdx int,
) ([]gethcommon.Hash, []*common.ExtRollup, *big.Int, int, uint64, types.Receipts)

ExtractDataFromEthereumChain returns the deposits, rollups, total amount deposited and length of the blockchain between the start block and the end block.

func FindNotIncludedL2Txs

func FindNotIncludedL2Txs(ctx context.Context, nodeIdx int, rpcHandles *network.RPCHandles, txInjector *TransactionInjector) (int, int, int)

FindNotIncludedL2Txs returns the number of transfers and withdrawals that were injected but are not present in the L2 blockchain.

func NextNonce

func NextNonce(ctx context.Context, clients *network.RPCHandles, w wallet.Wallet) uint64

Types

type GasBridgingRecord

type GasBridgingRecord struct {
	L1BridgeTx     *types.Transaction
	ReceiverWallet wallet.Wallet
}

type OutputStats

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

OutputStats decouples the processing of data and the collection of statistics there's a bit more to do around this, this serves as a first iteration

func NewOutputStats

func NewOutputStats(simulation *Simulation) *OutputStats

NewOutputStats processes the simulation and retrieves the output statistics

func (*OutputStats) String

func (o *OutputStats) String() string

type Simulation

type Simulation struct {
	RPCHandles       *network.RPCHandles
	AvgBlockDuration uint64
	TxInjector       *TransactionInjector
	SimulationTime   time.Duration
	Stats            *stats.Stats
	Params           *params.SimParams
	LogChannels      map[string][]chan common.IDAndLog // Maps an owner to the channels on which they receive logs for each client.
	Subscriptions    []ethereum.Subscription           // A slice of all created event subscriptions.
	// contains filtered or unexported fields
}

Simulation represents all the data required to inject transactions on a network

func (*Simulation) Start

func (s *Simulation) Start()

Start executes the simulation given all the Params. Injects transactions.

func (*Simulation) Stop

func (s *Simulation) Stop()

type TransactionInjector

type TransactionInjector struct {
	// counters
	TxTracker *txInjectorTracker
	// contains filtered or unexported fields
}

TransactionInjector is a structure that generates, issues and tracks transactions

func NewTransactionInjector

func NewTransactionInjector(
	avgBlockDuration time.Duration,
	stats *simstats.Stats,
	rpcHandles *network.RPCHandles,
	wallets *params.SimWallets,
	mgmtContractAddr *gethcommon.Address,
	mgmtContractLib mgmtcontractlib.MgmtContractLib,
	erc20ContractLib erc20contractlib.ERC20ContractLib,
	txsToIssue int,
	params *params.SimParams,
) *TransactionInjector

NewTransactionInjector returns a transaction manager with a given number of obsWallets

func (*TransactionInjector) Start

func (ti *TransactionInjector) Start()

Start begins the execution on the TransactionInjector Deposits an initial balance in to each wallet Generates and issues L1 and L2 transactions to the network

func (*TransactionInjector) Stop

func (ti *TransactionInjector) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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