testvector

package
v0.0.3-RC24 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallTrace

type CallTrace struct {
	Context *TransactionContext `json:"context,omitempty"`
	Steps   []*TransactionStep  `json:"steps,omitempty"`
}

CallTrace represents the batch call trace.

type Container

type Container struct {
	E2E *E2E
}

Container is a wrapper for test vectors.

func NewContainer

func NewContainer(testVectorPath string, aferoFs afero.Fs) (*Container, error)

NewContainer is the Container constructor.

func (*Container) FindBytecode

func (c *Container) FindBytecode(inputKey string) (bytecode string, err error)

FindBytecode searches for the given key on the value fields of all the genesisRaw items present and returns the associated bytecode field on match.

func (*Container) FindProcessBatchResponse

func (c *Container) FindProcessBatchResponse(batchL2Data string) (*ProcessBatchResponse, error)

FindProcessBatchResponse searches for the responses to a process batch request identified by tge batch L2 data.

func (*Container) FindSMTValue

func (c *Container) FindSMTValue(inputKey, oldRoot string) (value, newRoot string, err error)

FindSMTValue searches for the given key on all the genesisRaw items present, checking also that the given root was the root returned by the previous item. If both the value and the root of the previous item match it returns the associated value and new root.

type Contract

type Contract struct {
	Address string `json:"address,omitempty"`
	Caller  string `json:"caller,omitempty"`
	Value   string `json:"value,omitempty"`
	Data    string `json:"data,omitempty"`
	Gas     string `json:"gas,omitempty"`
}

Contract contains information about SCs executed in a batch.

type E2E

type E2E struct {
	Items []*E2EItem
}

E2E contains all the test vectors.

type E2EItem

type E2EItem struct {
	BatchL2Data    string
	GlobalExitRoot string
	Traces         *Traces
	GenesisRaw     []*state.GenesisAction
}

E2EItem contains an end-to-end test vector.

type Log

type Log struct {
	Data        []string
	Topics      []string
	Address     string
	BatchNumber uint64 `json:"batch_number"`
	TxHash      string `json:"tx_hash"`
	TxIndex     uint32 `json:"tx_index"`
	BatchHash   string `json:"batch_hash"`
	Index       uint32
}

Log represent logs emitted by LOG opcode.

type ProcessBatchResponse

type ProcessBatchResponse struct {
	CumulativeGasUsed   string                        `json:"cumulative_gas_used,omitempty"`
	Responses           []*ProcessTransactionResponse `json:"responses,omitempty"`
	NewStateRoot        string                        `json:"new_state_root,omitempty"`
	NewLocalExitRoot    string                        `json:"new_local_exit_root,omitempty"`
	CntKeccakHashes     uint32                        `json:"cnt_keccak_hashes,omitempty"`
	CntPoseidonHashes   uint32                        `json:"cnt_poseidon_hashes,omitempty"`
	CntPoseidonPaddings uint32                        `json:"cnt_poseidon_paddings,omitempty"`
	CntMemAligns        uint32                        `json:"cnt_mem_aligns,omitempty"`
	CntArithmetics      uint32                        `json:"cnt_arithmetics,omitempty"`
	CntBinaries         uint32                        `json:"cnt_binaries,omitempty"`
	CntSteps            uint32                        `json:"cnt_steps,omitempty"`
}

ProcessBatchResponse contains information about the executor response to a ProcessBatch request.

type ProcessTransactionResponse

type ProcessTransactionResponse struct {
	TxHash                 string `json:"tx_hash"`
	Type                   uint32
	GasLeft                string `json:"gas_left"`
	GasUsed                string `json:"gas_used"`
	GasRefunded            string `json:"gas_refunded"`
	StateRoot              string `json:"state_root"`
	Logs                   []*Log
	UnprocessedTransaction bool       `json:"unprocessed_transaction,omitempty"`
	CallTrace              *CallTrace `json:"call_trace,omitempty"`
}

ProcessTransactionResponse contains information about the executor response to a transaction execution.

type Traces

type Traces struct {
	BatchHash     string
	OldStateRoot  string `json:"old_state_root"`
	GlobalHash    string
	NumBatch      uint64
	Timestamp     uint64
	SequencerAddr string

	*ProcessBatchResponse
}

Traces represents executor processing traces.

type TransactionContext

type TransactionContext struct {
	From          string `json:"from,omitempty"`
	To            string `json:"to,omitempty"`
	Type          string `json:"type,omitempty"`
	Data          string `json:"data,omitempty"`
	Gas           string `json:"gas,omitempty"`
	Value         string `json:"value,omitempty"`
	Batch         string `json:"batch,omitempty"`
	Output        string `json:"output,omitempty"`
	GasUsed       string `json:"gas_used,omitempty"`
	ExecutionTime string `json:"execution_time,omitempty"`
	OldStateRoot  string `json:"old_state_root,omitempty"`
	GasPrice      string `json:"gasPrice,omitempty"`
}

TransactionContext represents a transaction's context.

type TransactionStep

type TransactionStep struct {
	Depth        uint32 `json:"depth,omitempty"`
	Pc           uint64 `json:"pc,omitempty"`
	RemainingGas string `json:"remaining_gas,omitempty"`
	OpCode       string
	GasRefund    string `json:"gas_refund,omitempty"`
	Op           string `json:"op,omitempty"`
	Error        string
	StateRoot    string    `json:"state_root"`
	Contract     *Contract `json:"contract,omitempty"`
	ReturnData   []string  `json:"return_data,omitempty"`
	GasCost      string    `json:"gas_cost"`
	Stack        []string
	Memory       []string
}

TransactionStep represents a transaction's step.

Jump to

Keyboard shortcuts

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