rpctest

package
v0.0.0-...-92d349b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const Erigon = "erigon"
View Source
const Geth = "geth"

Variables

This section is empty.

Functions

func Bench1

func Bench1(erigonURL, gethURL string, needCompare bool, fullTest bool, blockFrom uint64, blockTo uint64, recordFile string)

bench1 compares response of Erigon with Geth but also can be used for comparing RPCDaemon with Geth parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

use false value - to generate vegeta files, it's faster but we can generate vegeta files for Geth and Erigon

fullTest - if false - then call only methods which RPCDaemon currently supports

func Bench2

func Bench2(erigon_url string)

func Bench3

func Bench3(erigon_url, geth_url string)

func Bench4

func Bench4(erigon_url string)

func Bench5

func Bench5(erigonURL string)

func Bench6

func Bench6(erigon_url string)

func Bench7

func Bench7(erigonURL, gethURL string)

func Bench9

func Bench9(erigonURL, gethURL string, needCompare bool)

bench9 tests eth_getProof

func BenchDebugTraceCall

func BenchDebugTraceCall(erigonURL, gethURL string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

bench12 compares response of Erigon with Geth but also can be used for comparing RPCDaemon with Geth parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

func BenchEthCall

func BenchEthCall(erigonURL, gethURL string, needCompare, latest bool, blockFrom, blockTo uint64, recordFile string, errorFile string)

BenchEthCall compares response of Erigon with Geth but also can be used for comparing RPCDaemon with Geth or infura parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

		    false value - to generate vegeta files, it's faster but we can generate vegeta files for Geth and Erigon
                 recordFile stores all eth_call returned with success
                 errorFile stores information when erigon and geth doesn't return same data

func BenchEthGetBalance

func BenchEthGetBalance(erigonURL, gethURL string, needCompare bool, blockFrom uint64, blockTo uint64)

BenchEthGetBalance compares response of Erigon with Geth but also can be used for comparing RPCDaemon with Geth parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

use false value - to generate vegeta files, it's faster but we can generate vegeta files for Geth and Erigon

func BenchEthGetBlockByNumber

func BenchEthGetBlockByNumber(erigonURL string)

BenchEthGetBlockByNumber generates lots of requests for eth_getBlockByNumber to attempt to reproduce issue where empty results are being returned

func BenchEthGetLogs

func BenchEthGetLogs(erigonURL, gethURL string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

BenchEthGetLogs compares response of Erigon with Geth but also can be used for comparing RPCDaemon with Geth or infura parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

false value - to generate vegeta files, it's faster but we can generate vegeta files for Geth and Erigon
recordFile stores all eth_getlogs returned with success
errorFile stores information when erigon and geth doesn't return same data

func BenchTraceBlock

func BenchTraceBlock(erigonURL, oeURL string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

Compares response of Erigon with Geth but also can be used for comparing RPCDaemon with OpenEthereum parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

func BenchTraceBlockByHash

func BenchTraceBlockByHash(erigonUrl, gethUrl string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

func BenchTraceCall

func BenchTraceCall(erigonURL, oeURL string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

bench1 compares response of Erigon with Geth but also can be used for comparing RPCDaemon with Geth parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

func BenchTraceCallMany

func BenchTraceCallMany(erigonURL, oeURL string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

BenchTraceCallMany compares response of Erigon with Geth but also can be used for comparing RPCDaemon with Geth parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

func BenchTraceFilter

func BenchTraceFilter(erigonURL, oeURL string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

Compares response of Erigon with OpenEthereum but also can be used for comparing RPCDaemon with Geth parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

func BenchTraceReplayTransaction

func BenchTraceReplayTransaction(erigonUrl, gethUrl string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

func BenchTraceTransaction

func BenchTraceTransaction(erigonUrl, gethUrl string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

func BenchTxReceipt

func BenchTxReceipt(erigonURL, gethURL string, needCompare bool, blockFrom uint64, blockTo uint64, recordFile string, errorFile string)

benchTxReceipt compares response of Erigon with Geth but also can be used for comparing RPCDaemon with Geth parameters: needCompare - if false - doesn't call Erigon and doesn't compare responses

func CompareAccountRange

func CompareAccountRange(logger log.Logger, erigonURL, gethURL, tmpDataDir, gethDataDir string, blockFrom uint64, notRegenerateGethData bool)

func Replay

func Replay(erigonURL string, recordFile string) error

Types

type AccountResult

type AccountResult struct {
	Address      libcommon.Address `json:"address"`
	AccountProof []string          `json:"accountProof"`
	Balance      *hexutil.Big      `json:"balance"`
	CodeHash     libcommon.Hash    `json:"codeHash"`
	Nonce        hexutil.Uint64    `json:"nonce"`
	StorageHash  libcommon.Hash    `json:"storageHash"`
	StorageProof []StorageResult   `json:"storageProof"`
}

AccountResult is the result struct for GetProof

type CallResult

type CallResult struct {
	Target      string
	Took        time.Duration
	RequestID   int
	Method      string
	RequestBody string
	Response    []byte
	Result      *fastjson.Value
	Err         error
}

type CommonResponse

type CommonResponse struct {
	Version   string    `json:"jsonrpc"`
	RequestId int       `json:"id"`
	Error     *EthError `json:"error"`
}

type DebugAccountRange

type DebugAccountRange struct {
	CommonResponse
	Result state.IteratorDump `json:"result"`
}

type DebugModifiedAccounts

type DebugModifiedAccounts struct {
	CommonResponse
	Result []libcommon.Address `json:"result"`
}

func (*DebugModifiedAccounts) Print

func (ma *DebugModifiedAccounts) Print()

type DebugStorageRange

type DebugStorageRange struct {
	CommonResponse
	Result StorageRangeResult `json:"result"`
}

type EthBalance

type EthBalance struct {
	CommonResponse
	Balance hexutil.Big `json:"result"`
}

type EthBlockByNumber

type EthBlockByNumber struct {
	CommonResponse
	Result *EthBlockByNumberResult `json:"result"`
}

type EthBlockByNumberResult

type EthBlockByNumberResult struct {
	Difficulty   hexutil.Big       `json:"difficulty"`
	Miner        libcommon.Address `json:"miner"`
	Transactions []EthTransaction  `json:"transactions"`
	TxRoot       libcommon.Hash    `json:"transactionsRoot"`
	Hash         libcommon.Hash    `json:"hash"`
}

type EthBlockNumber

type EthBlockNumber struct {
	CommonResponse
	Number hexutil.Uint64 `json:"result"`
}

type EthError

type EthError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type EthGetLogs

type EthGetLogs struct {
	CommonResponse
	Result []Log `json:"result"`
}

type EthGetProof

type EthGetProof struct {
	CommonResponse
	Result AccountResult `json:"result"`
}

type EthGetTransactionCount

type EthGetTransactionCount struct {
	CommonResponse
	Result hexutil.Uint64 `json:"result"`
}

type EthReceipt

type EthReceipt struct {
	CommonResponse
	Result Receipt `json:"result"`
}

type EthSendRawTransaction

type EthSendRawTransaction struct {
	CommonResponse
	TxnHash libcommon.Hash `json:"result"`
}

type EthTransaction

type EthTransaction struct {
	From     libcommon.Address  `json:"from"`
	To       *libcommon.Address `json:"to"` // Pointer because it might be missing
	Hash     string             `json:"hash"`
	Gas      hexutil.Big        `json:"gas"`
	GasPrice hexutil.Big        `json:"gasPrice"`
	Input    hexutility.Bytes   `json:"input"`
	Value    hexutil.Big        `json:"value"`
}

type EthTxPool

type EthTxPool struct {
	CommonResponse
	Result interface{} `json:"result"`
}

type EthTxTrace

type EthTxTrace struct {
	CommonResponse
	Result EthTxTraceResult `json:"result"`
}

type EthTxTraceResult

type EthTxTraceResult struct {
	Gas         uint64      `json:"gas"`
	Failed      bool        `json:"failed"`
	ReturnValue string      `json:"returnValue"`
	StructLogs  []StructLog `json:"structLogs"`
}

type Log

type Log struct {
	// Consensus fields:
	// address of the contract that generated the event
	Address libcommon.Address `json:"address" gencodec:"required"`
	// list of topics provided by the contract.
	Topics []libcommon.Hash `json:"topics" gencodec:"required"`
	// supplied by the contract, usually ABI-encoded
	Data hexutility.Bytes `json:"data" gencodec:"required"`

	// Derived fields. These fields are filled in by the node
	// but not secured by consensus.
	// block in which the transaction was included
	BlockNumber hexutil.Uint64 `json:"blockNumber"`
	// hash of the transaction
	TxHash libcommon.Hash `json:"transactionHash" gencodec:"required"`
	// index of the transaction in the block
	TxIndex hexutil.Uint `json:"transactionIndex" gencodec:"required"`
	// hash of the block in which the transaction was included
	BlockHash libcommon.Hash `json:"blockHash"`
	// index of the log in the receipt
	Index hexutil.Uint `json:"logIndex" gencodec:"required"`

	// The Removed field is true if this log was reverted due to a chain reorganisation.
	// You must pay attention to this field if you receive logs through a filter query.
	Removed bool `json:"removed"`
}

Log represents a contract log event. These events are generated by the LOG opcode and stored/indexed by the node.

type ParityListStorageKeysResult

type ParityListStorageKeysResult struct {
	CommonResponse
	Result []hexutility.Bytes `json:"result"`
}

type Receipt

type Receipt struct {
	// Consensus fields
	PostState         libcommon.Hash   `json:"root"`
	Status            hexutil.Uint64   `json:"status"`
	CumulativeGasUsed hexutil.Uint64   `json:"cumulativeGasUsed" gencodec:"required"`
	Bloom             hexutility.Bytes `json:"logsBloom"         gencodec:"required"`
	Logs              []*Log           `json:"logs"              gencodec:"required"`

	// Implementation fields (don't reorder!)
	TxHash          libcommon.Hash     `json:"transactionHash" gencodec:"required"`
	ContractAddress *libcommon.Address `json:"contractAddress"`
	GasUsed         hexutil.Uint64     `json:"gasUsed" gencodec:"required"`
}

type RequestGenerator

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

func (*RequestGenerator) Erigon

func (g *RequestGenerator) Erigon(method, body string, response interface{}) CallResult

func (*RequestGenerator) Erigon2

func (g *RequestGenerator) Erigon2(method, body string) CallResult

func (*RequestGenerator) Geth

func (g *RequestGenerator) Geth(method, body string, response interface{}) CallResult

func (*RequestGenerator) Geth2

func (g *RequestGenerator) Geth2(method, body string) CallResult

type StorageRangeResult

type StorageRangeResult struct {
	Storage storageMap      `json:"storage"`
	NextKey *libcommon.Hash `json:"nextKey"` // nil if Storage includes the last key in the trie.
}

StorageRangeResult is the result of a debug_storageRangeAt API call.

type StorageResult

type StorageResult struct {
	Key   string       `json:"key"`
	Value *hexutil.Big `json:"value"`
	Proof []string     `json:"proof"`
}

type StructLog

type StructLog struct {
	Op      string            `json:"op"`
	Pc      uint64            `json:"pc"`
	Depth   uint64            `json:"depth"`
	Error   *EthError         `json:"error"`
	Gas     uint64            `json:"gas"`
	GasCost uint64            `json:"gasCost"`
	Memory  []string          `json:"memory"`
	Stack   []string          `json:"stack"`
	Storage map[string]string `json:"storage"`
}

type TraceCall

type TraceCall struct {
	CommonResponse
	Result TraceCallResult `json:"result"`
}

type TraceCallAction

type TraceCallAction struct {
	From          libcommon.Address `json:"from"`
	To            libcommon.Address `json:"to"`
	Address       libcommon.Address `json:"address"`
	RefundAddress libcommon.Address `json:"refundAddress"`
	Gas           hexutil.Big       `json:"gas"`
	Value         hexutil.Big       `json:"value"`
	Balance       hexutil.Big       `json:"balance"`
	Init          hexutility.Bytes  `json:"init"`
	Input         hexutility.Bytes  `json:"input"`
	CallType      string            `json:"callType"`
}

TraceCallAction is superset of all possible action types

type TraceCallResult

type TraceCallResult struct {
	Output    hexutility.Bytes                         `json:"output"`
	Trace     []TraceCallTrace                         `json:"trace"`
	StateDiff map[libcommon.Address]TraceCallStateDiff `json:"stateDiff"`
}

type TraceCallStateDiff

type TraceCallStateDiff struct {
	Balance interface{}                                             `json:"balance"`
	Nonce   interface{}                                             `json:"nonce"`
	Code    interface{}                                             `json:"code"`
	Storage map[libcommon.Hash]map[string]TraceCallStateDiffStorage `json:"storage"`
}

type TraceCallStateDiffStorage

type TraceCallStateDiffStorage struct {
	From libcommon.Hash `json:"from"`
	To   libcommon.Hash `json:"to"`
}

type TraceCallTrace

type TraceCallTrace struct {
	Type         string                `json:"type"`
	Action       TraceCallAction       `json:"action"`
	Result       *TraceCallTraceResult `json:"result"`
	Subtraces    int                   `json:"subtraces"`
	TraceAddress []int                 `json:"traceAddress"`
	Error        string                `json:"error"`
}

type TraceCallTraceResult

type TraceCallTraceResult struct {
	GasUsed hexutil.Big       `json:"gasUsed"`
	Output  hexutility.Bytes  `json:"output"`
	Address libcommon.Address `json:"address"`
	Code    hexutility.Bytes  `json:"code"`
}

Jump to

Keyboard shortcuts

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