codec

package
v1.4.22 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlockReadCount = metrics.NewCounter("block_read_count", "The number of blocks read by the Console Reader")
View Source
var BlockTotalParseTime = metrics.NewCounter("block_total_parse_time", "The total parse time (wall clock) it took to extract all blocks so far")
View Source
var TransactionReadCount = metrics.NewCounter("trx_read_count", "The number of transactions read by the Console Reader")
View Source
var TrxTotalParseTime = metrics.NewCounter("trx_total_parse_time", "The total parse time (wall clock) it took to extract all transactions so far")

Functions

func CanonicalHex

func CanonicalHex(input string) string

CanonicalHex receives an input and return it's canonical form, i.e. the single unique well-formed which in our case is an all-lower case version with even number of characters.

The only differences with `SanitizeHexInput` here is an additional call to `strings.ToLower` before returning the result.

func CombinePolygonSystemTransactions added in v1.1.11

func CombinePolygonSystemTransactions(traces []*pbeth.TransactionTrace, blockNum uint64, blockHash []byte) (out []*pbeth.TransactionTrace, systemTransactionHashes hashes)

CombinePolygonSystemTransactions will identify transactions that are "system transactions" and merge them into a single transaction with a predictive name, like the `bor` client does. It reorders the calls and logs to match expected output from RPC API.

func ConcatHex

func ConcatHex(with0x bool, in ...string) (out string)

ConcatHex concatenates sanitized hex strings

func DecodeHex

func DecodeHex(input string) ([]byte, error)

func FromHeader

func FromHeader(header *BlockHeader) *pbeth.BlockHeader

func FromHex

func FromHex(input string, tag string) []byte

func FromInt32

func FromInt32(input string, tag string) int32

func FromUint32

func FromUint32(input string, tag string) uint32

func FromUint64

func FromUint64(input string, tag string) uint64

func Has0xPrefix

func Has0xPrefix(input string) bool

func NormalizeSignaturePoint added in v1.1.11

func NormalizeSignaturePoint(value []byte) []byte

func PrefixedHex

func PrefixedHex(input string) string

PrefixedHex is CanonicalHex but with 0x prefix

func SanitizeHex

func SanitizeHex(input string) string

SanitizeHex removes the prefix `0x` if it exists and ensures there is an even number of characters in the string, padding on the left of the string is it's not the case.

func SplitInBoundedChunks

func SplitInBoundedChunks(line string, count int) ([]string, error)

SplitInBoundedChunks splits the line in `count` chunks and returns the slice `chunks[1:count]` (so exclusive end), but will accumulate all trailing chunks within the last (for free-form strings, or JSON objects)

func SplitInChunks

func SplitInChunks(line string, validCounts ...int) ([]string, error)

splitInChunks split the line in chunks and returns the slice `chunks[1:]`, but verifies that there are only exactly one of `validCounts` number of chunks

Types

type BlockHeader

type BlockHeader struct {
	Hash            eth.Hash       `json:"hash"`
	ParentHash      eth.Hash       `json:"parentHash"`
	UncleHash       eth.Hash       `json:"sha3Uncles"`
	Coinbase        eth.Address    `json:"miner"`
	Root            eth.Hash       `json:"stateRoot"`
	TxHash          eth.Hash       `json:"transactionsRoot"`
	ReceiptHash     eth.Hash       `json:"receiptsRoot"`
	Bloom           eth.Hex        `json:"logsBloom"`
	Difficulty      eth.Hex        `json:"difficulty"`
	Number          eth.Uint64     `json:"number"`
	GasLimit        eth.Uint64     `json:"gasLimit"`
	GasUsed         eth.Uint64     `json:"gasUsed"`
	Time            eth.Uint64     `json:"timestamp"`
	Extra           eth.Hex        `json:"extraData"`
	MixDigest       eth.Hash       `json:"mixHash"`
	Nonce           eth.Uint64     `json:"nonce"`
	BaseFeePerGas   eth.Hex        `json:"baseFeePerGas"`
	WithdrawalsHash eth.Hex        `json:"withdrawalsRoot"`
	TxDependency    [][]eth.Uint64 `json:"txDependency"`
}

type BloomFilter added in v1.1.11

type BloomFilter [256]byte

type ConsoleReader

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

ConsoleReader is what reads the `geth` output directly. It builds up some LogEntry objects. See `LogReader to read those entries .

func NewConsoleReader

func NewConsoleReader(logger *zap.Logger, lines chan string) (*ConsoleReader, error)

func (*ConsoleReader) Close

func (c *ConsoleReader) Close()

func (*ConsoleReader) Done

func (l *ConsoleReader) Done() <-chan interface{}

todo: WTF?

func (*ConsoleReader) ProcessData

func (c *ConsoleReader) ProcessData(reader io.Reader) error

func (*ConsoleReader) ReadBlock

func (c *ConsoleReader) ReadBlock() (out *bstream.Block, err error)

func (ConsoleReader) ReadTransaction

func (c ConsoleReader) ReadTransaction() (trace *pbeth.TransactionTrace, err error)

type Log

type Log struct {
	Address eth.Address `json:"address"`
	Topics  []eth.Hash  `json:"topics"`
	Data    eth.Hex     `json:"data"`
}

Jump to

Keyboard shortcuts

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