Documentation ¶
Index ¶
Constants ¶
const ( FileEntryMinSize uint32 = 17 // 1+4+4+8 BookmarkEntryType EntryType = 176 )
const ( ResultEntryMinSize = uint32(9) // Command errors CmdErrOK = 0 CmdErrAlreadyStarted = 1 CmdErrAlreadyStopped = 2 CmdErrBadFromEntry = 3 CmdErrInvalidCommand = 9 )
const (
BookmarkTypeStart byte = 0
)
const HeaderSize = 29
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bookmark ¶
func NewL2BlockBookmark ¶
type CommandError ¶
type CommandError uint32
type EndL2Block ¶
type EndL2Block struct { L2BlockNumber uint64 // 8 bytes L2Blockhash common.Hash // 32 bytes StateRoot common.Hash // 32 bytes }
func DecodeEndL2Block ¶
func DecodeEndL2Block(data []byte) (*EndL2Block, error)
DecodeEndL2Block decodes a EndL2Block from a byte array
type EntryType ¶
type EntryType uint32
const ( // EntryTypeL2Block represents a L2 block EntryTypeGerUpdate EntryType = 4 )
const ( // EntryTypeL2Tx represents a L2 transaction EntryTypeL2Tx EntryType = 2 )
type FileEntry ¶
type FileEntry struct { PacketType uint8 // 2:Data entry, 0:Padding, (1:Header) Length uint32 // Length of the entry EntryType EntryType // e.g. 1:L2 block, 2:L2 tx, 176: bookmark EntryNum uint64 // Entry number (sequential starting with 0) Data []byte }
func DecodeFileEntry ¶
Decode/convert from binary bytes slice to FileEntry type
func (*FileEntry) IsBlockEnd ¶
func (*FileEntry) IsBlockStart ¶
func (*FileEntry) IsBookmark ¶
func (*FileEntry) IsGerUpdate ¶
type FullL2Block ¶
type FullL2Block struct { BatchNumber uint64 L2BlockNumber uint64 Timestamp int64 GlobalExitRoot common.Hash Coinbase common.Address ForkId uint16 L2Blockhash common.Hash StateRoot common.Hash L2Txs []L2Transaction ParentHash common.Hash }
func ParseFullL2Block ¶
func ParseFullL2Block(startL2Block *StartL2Block, endL2Block *EndL2Block, l2Txs *[]L2Transaction) *FullL2Block
ParseFullL2Block parses a FullL2Block from a StartL2Block, EndL2Block and a slice of L2Transactions
type GerUpdate ¶
type GerUpdate struct { BatchNumber uint64 // 8 bytes Timestamp uint64 // 8 bytes GlobalExitRoot common.Hash // 32 bytes Coinbase common.Address // 20 bytes ForkId uint16 // 2 bytes StateRoot common.Hash // 32 bytes }
StartL2Block represents a zkEvm block
func DecodeGerUpdate ¶
decodes a StartL2Block from a byte array
func (*GerUpdate) EncodeToBytes ¶
type HeaderEntry ¶
type HeaderEntry struct { PacketType uint8 // 1:Header HeadLength uint32 // 29 StreamType StreamType // 1:Sequencer TotalLength uint64 // Total bytes used in the file TotalEntries uint64 // Total number of data entries (entry type 2) }
func DecodeHeaderEntry ¶
func DecodeHeaderEntry(b []byte) (*HeaderEntry, error)
Decode/convert from binary bytes slice to a header entry type
type L2Transaction ¶
type L2Transaction struct { EffectiveGasPricePercentage uint8 // 1 byte IsValid uint8 // 1 byte StateRoot common.Hash // 32 bytes EncodedLength uint32 // 4 bytes Encoded []byte }
L2Transaction represents a zkEvm transaction
func DecodeL2Transaction ¶
func DecodeL2Transaction(data []byte) (*L2Transaction, error)
DecodeL2Transaction decodes a L2 transaction from a byte array
type ResultEntry ¶
type ResultEntry struct { PacketType uint8 // 0xff:Result Length uint32 ErrorNum uint32 // 0:No error ErrorStr []byte }
func DecodeResultEntry ¶
func DecodeResultEntry(b []byte) (*ResultEntry, error)
Decode/convert from binary bytes slice to an entry type
func (*ResultEntry) GetError ¶
func (r *ResultEntry) GetError() error
returns the error string if the result error number is not OK returns nil otherwise
type StartL2Block ¶
type StartL2Block struct { BatchNumber uint64 // 8 bytes L2BlockNumber uint64 // 8 bytes Timestamp int64 // 8 bytes GlobalExitRoot common.Hash // 32 bytes Coinbase common.Address // 20 bytes ForkId uint16 // 2 bytes }
StartL2Block represents a zkEvm block
func DecodeStartL2Block ¶
func DecodeStartL2Block(data []byte) (*StartL2Block, error)
decodes a StartL2Block from a byte array
type StreamType ¶
type StreamType uint64