Documentation
¶
Index ¶
- Constants
- Variables
- func MockGrantSeqTxAddress() gethcommon.Address
- func NewBlock(parent *types.Block, nodeID common.Address, txs []*types.Transaction, ...) *types.Block
- func NewERC20ContractLibMock() erc20contractlib.ERC20ContractLib
- func NewMgmtContractLibMock() mgmtcontractlib.MgmtContractLib
- func NewMockBlobResolver() l1.BlobResolver
- func NewResolver() *blockResolverInMem
- type BlobResolverInMem
- type BlockWithBlobs
- type EncodedL1Block
- type L1Network
- type Latency
- type MiningConfig
- type MockBlobHasher
- type MockEthNetwork
- type MockSignatureValidator
- 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) BlockListener() (chan *types.Header, ethereum.Subscription)
- func (m *Node) BlockNumber() (uint64, error)
- func (m *Node) BlocksBetween(blockA *types.Header, blockB *types.Header) ([]*types.Header, error)
- func (m *Node) BroadcastTx(tx types.TxData)
- func (m *Node) CallContract(ethereum.CallMsg) ([]byte, error)
- func (m *Node) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (m *Node) EthClient() *ethclient_ethereum.Client
- func (m *Node) FetchHeadBlock() (*types.Header, error)
- func (m *Node) FetchLastBatchSeqNo(gethcommon.Address) (*big.Int, error)
- func (m *Node) GetLogs(fq ethereum.FilterQuery) ([]types.Log, error)
- func (m *Node) HeaderByHash(id gethcommon.Hash) (*types.Header, error)
- func (m *Node) HeaderByNumber(n *big.Int) (*types.Header, error)
- func (m *Node) Info() ethadapter.Info
- func (m *Node) IsBlockAncestor(block *types.Header, proof common.L1BlockHash) bool
- func (m *Node) Nonce(gethcommon.Address) (uint64, error)
- func (m *Node) P2PGossipTx(tx *types.Transaction)
- func (m *Node) P2PReceiveBlock(b EncodedL1Block, p EncodedL1Block)
- func (m *Node) ProcessBlobs(b *types.Block) error
- func (m *Node) PromoteEnclave(id common.EnclaveID)
- func (m *Node) ReconnectIfClosed() 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) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (m *Node) TransactionByHash(hash gethcommon.Hash) (*types.Transaction, bool, error)
- func (m *Node) TransactionReceipt(_ gethcommon.Hash) (*types.Receipt, error)
- type StatsCollector
- type TxDB
Constants ¶
const HeightCommittedBlocks = 15
HeightCommittedBlocks is the number of blocks deep a transaction must be to be considered safe from reorganisations.
Variables ¶
var ( // ContractAddresses maps contract types to their addresses ContractAddresses = map[l1.ContractType][]gethcommon.Address{ l1.MgmtContract: { depositTxAddr, rollupTxAddr, storeSecretTxAddr, requestSecretTxAddr, initializeSecretTxAddr, grantSeqTxAddr, }, l1.MsgBus: { messageBusAddr, }, } )
var MockGenesisBlock = NewBlock(nil, common.HexToAddress("0x0"), []*types.Transaction{}, 0)
Functions ¶
func MockGrantSeqTxAddress ¶ added in v1.0.0
func MockGrantSeqTxAddress() gethcommon.Address
func NewERC20ContractLibMock ¶
func NewERC20ContractLibMock() erc20contractlib.ERC20ContractLib
NewERC20ContractLibMock is an implementation of the erc20contractlib.ERC20ContractLib
func NewMgmtContractLibMock ¶
func NewMgmtContractLibMock() mgmtcontractlib.MgmtContractLib
func NewMockBlobResolver ¶ added in v0.28.0
func NewMockBlobResolver() l1.BlobResolver
func NewResolver ¶
func NewResolver() *blockResolverInMem
Types ¶
type BlobResolverInMem ¶ added in v0.28.0
type BlobResolverInMem struct {
// contains filtered or unexported fields
}
func (*BlobResolverInMem) FetchBlobs ¶ added in v0.28.0
func (b *BlobResolverInMem) FetchBlobs(_ context.Context, _ *types.Header, hashes []gethcommon.Hash) ([]*kzg4844.Blob, error)
func (*BlobResolverInMem) StoreBlobs ¶ added in v0.28.0
func (b *BlobResolverInMem) StoreBlobs(_ uint64, blobs []*kzg4844.Blob) error
type BlockWithBlobs ¶ added in v0.28.0
type EncodedL1Block ¶ added in v1.0.0
type EncodedL1Block []byte
EncodedL1Block the encoded version of an L1 block.
func EncodeBlock ¶ added in v1.0.0
func EncodeBlock(b *types.Block) (EncodedL1Block, error)
func (EncodedL1Block) DecodeBlock ¶ added in v1.0.0
func (eb EncodedL1Block) DecodeBlock() (*types.Block, error)
type L1Network ¶
type L1Network interface { // BroadcastBlock - send the block and the parent to make sure there are no gaps BroadcastBlock(b EncodedL1Block, p EncodedL1Block) BroadcastTx(tx *types.Transaction) }
type MiningConfig ¶
type MockBlobHasher ¶ added in v1.0.0
type MockBlobHasher struct{}
func (MockBlobHasher) BlobHash ¶ added in v1.0.0
func (MockBlobHasher) BlobHash(blob *kzg4844.Blob) (gethcommon.Hash, kzg4844.Commitment, kzg4844.Proof, error)
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 EncodedL1Block, p 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 MockSignatureValidator ¶ added in v1.0.0
type MockSignatureValidator struct{}
func NewMockSignatureValidator ¶ added in v1.0.0
func NewMockSignatureValidator() *MockSignatureValidator
func (*MockSignatureValidator) CheckSequencerSignature ¶ added in v1.0.0
func (sigChecker *MockSignatureValidator) CheckSequencerSignature(_ gethcommon.Hash, _ []byte) error
CheckSequencerSignature - NO-OP
type Node ¶
type Node struct { Network L1Network BlockResolver *blockResolverInMem BlobResolver l1.BlobResolver // contains filtered or unexported fields }
func NewMiner ¶
func NewMiner( id gethcommon.Address, cfg MiningConfig, network L1Network, statsCollector StatsCollector, blobResolver l1.BlobResolver, logger gethlog.Logger, ) *Node
func (*Node) BlockByHash ¶
func (*Node) BlockListener ¶
BlockListener provides stream of latest mock head headers as they are created
func (*Node) BlockNumber ¶
func (*Node) BlocksBetween ¶
func (*Node) BroadcastTx ¶
func (*Node) CallContract ¶
func (*Node) EstimateGas ¶ added in v1.0.0
func (*Node) EthClient ¶
func (m *Node) EthClient() *ethclient_ethereum.Client
func (*Node) FetchLastBatchSeqNo ¶
func (*Node) GetLogs ¶
GetLogs is a mock method - we create logs with topics matching the real contract events
func (*Node) HeaderByHash ¶ added in v1.0.0
func (*Node) HeaderByNumber ¶ added in v1.0.0
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 EncodedL1Block, p 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) PromoteEnclave ¶ added in v1.0.0
func (*Node) ReconnectIfClosed ¶
func (*Node) RemoveSubscription ¶
func (*Node) SendTransaction ¶
func (m *Node) SendTransaction(tx *types.Transaction) error
func (*Node) SuggestGasTipCap ¶ added in v1.0.0
func (*Node) TransactionByHash ¶ added in v1.0.0
func (m *Node) TransactionByHash(hash gethcommon.Hash) (*types.Transaction, bool, error)
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) }