Documentation ¶
Index ¶
- Variables
- func NewBlock(parent *types.Block, nodeID common.Address, txs []*types.Transaction) *types.Block
- func NewERC20ContractLibMock() erc20contractlib.ERC20ContractLib
- func NewMgmtContractLibMock() mgmtcontractlib.MgmtContractLib
- func NewResolver() db.BlockResolver
- type L1Network
- type MiningConfig
- type MockEthNetwork
- type Node
- func (m *Node) Alive() bool
- func (m *Node) BalanceAt(gethcommon.Address, *big.Int) (*big.Int, error)
- func (m *Node) BlockByHash(id gethcommon.Hash) (*types.Block, error)
- func (m *Node) BlockByNumber(n *big.Int) (*types.Block, error)
- func (m *Node) BlockListener() (chan *types.Header, ethereum.Subscription)
- func (m *Node) BlockNumber() (uint64, error)
- func (m *Node) BlocksBetween(blockA *types.Block, blockB *types.Block) []*types.Block
- func (m *Node) BroadcastTx(tx types.TxData)
- func (m *Node) CallContract(ethereum.CallMsg) ([]byte, error)
- func (m *Node) EstimateGasAndGasPrice(txData types.TxData, from gethcommon.Address) (types.TxData, error)
- func (m *Node) EthClient() *ethclient_ethereum.Client
- func (m *Node) FetchHeadBlock() (*types.Block, error)
- func (m *Node) Info() ethadapter.Info
- func (m *Node) IsBlockAncestor(block *types.Block, proof common.L1BlockHash) bool
- func (m *Node) Nonce(gethcommon.Address) (uint64, error)
- func (m *Node) P2PGossipTx(tx *types.Transaction)
- func (m *Node) P2PReceiveBlock(b common.EncodedL1Block, p common.EncodedL1Block)
- func (m *Node) Reconnect() error
- func (m *Node) RemoveSubscription(id uuid.UUID)
- func (m *Node) SendTransaction(tx *types.Transaction) error
- func (m *Node) Start()
- func (m *Node) Stop()
- func (m *Node) TransactionReceipt(_ gethcommon.Hash) (*types.Receipt, error)
- type StatsCollector
- type TxDB
Constants ¶
This section is empty.
Variables ¶
var MockGenesisBlock = NewBlock(nil, common.HexToAddress("0x0"), []*types.Transaction{})
Functions ¶
func NewERC20ContractLibMock ¶
func NewERC20ContractLibMock() erc20contractlib.ERC20ContractLib
NewERC20ContractLibMock is an implementation of the erc20contractlib.ERC20ContractLib
func NewMgmtContractLibMock ¶
func NewMgmtContractLibMock() mgmtcontractlib.MgmtContractLib
func NewResolver ¶
func NewResolver() db.BlockResolver
Types ¶
type L1Network ¶
type L1Network interface { // BroadcastBlock - send the block and the parent to make sure there are no gaps BroadcastBlock(b common.EncodedL1Block, p common.EncodedL1Block) BroadcastTx(tx *types.Transaction) }
type MiningConfig ¶
type MockEthNetwork ¶
type MockEthNetwork struct { CurrentNode *Node AllNodes []*Node Stats *stats.Stats // contains filtered or unexported fields }
MockEthNetwork - models a full network including artificial random latencies This is the gateway through which the mock L1 nodes communicate with each other
func NewMockEthNetwork ¶
func NewMockEthNetwork(avgBlockDuration time.Duration, avgLatency time.Duration, stats *stats.Stats) *MockEthNetwork
NewMockEthNetwork returns an instance of a configured L1 Network (no nodes)
func (*MockEthNetwork) BroadcastBlock ¶
func (n *MockEthNetwork) BroadcastBlock(b common.EncodedL1Block, p common.EncodedL1Block)
BroadcastBlock broadcast a block to the l1 nodes
func (*MockEthNetwork) BroadcastTx ¶
func (n *MockEthNetwork) BroadcastTx(tx *types.Transaction)
BroadcastTx Broadcasts the L1 tx containing the rollup to the L1 network
type Node ¶
type Node struct { Network L1Network Resolver db.BlockResolver // contains filtered or unexported fields }
func NewMiner ¶
func NewMiner( id gethcommon.Address, cfg MiningConfig, network L1Network, statsCollector StatsCollector, ) *Node
func (*Node) BlockByHash ¶
func (*Node) BlockListener ¶
BlockListener provides stream of latest mock head headers as they are created
func (*Node) BlockNumber ¶ added in v0.7.0
func (*Node) BlocksBetween ¶
func (*Node) BroadcastTx ¶
func (*Node) CallContract ¶
func (*Node) EstimateGasAndGasPrice ¶ added in v0.8.0
func (*Node) EthClient ¶
func (m *Node) EthClient() *ethclient_ethereum.Client
func (*Node) Info ¶
func (m *Node) Info() ethadapter.Info
func (*Node) IsBlockAncestor ¶
func (*Node) P2PGossipTx ¶
func (m *Node) P2PGossipTx(tx *types.Transaction)
P2PGossipTx receive rollups to publish from the linked aggregators
func (*Node) P2PReceiveBlock ¶
func (m *Node) P2PReceiveBlock(b common.EncodedL1Block, p common.EncodedL1Block)
P2PReceiveBlock is called by counterparties when there is a block to broadcast All it does is drop the blocks in a channel for processing.
func (*Node) RemoveSubscription ¶ added in v0.8.0
func (*Node) SendTransaction ¶
func (m *Node) SendTransaction(tx *types.Transaction) error
func (*Node) Start ¶
func (m *Node) Start()
Start runs an infinite loop that listens to the two block producing channels and processes them.
func (*Node) TransactionReceipt ¶
type StatsCollector ¶
type StatsCollector interface { // L1Reorg registers when a miner has to process a reorg (a winning block from a fork) L1Reorg(id gethcommon.Address) }