vm

package
v0.2.17-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(*VM)

Opt is for changing VM during initialization.

func WithLogger

func WithLogger(logger log.Log) Opt

WithLogger sets logger for VM.

type Request

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

Request used to implement 2-step validation flow. After Parse is executed - conservative cache may do validation and skip Verify if transaction can't be executed.

func (*Request) Parse

func (r *Request) Parse() (*core.Header, error)

Parse header from the raw transaction.

func (*Request) Verify

func (r *Request) Verify() bool

Verify transaction. Will panic if called without Parse completing successfully.

type VM

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

VM handles modifications to the account state.

func New

func New(db *sql.Database, opts ...Opt) *VM

New returns VM instance.

func (*VM) Apply

func (v *VM) Apply(lid types.LayerID, txs []types.RawTx, rewards []types.AnyReward) ([]types.TransactionID, error)

Apply transactions.

func (*VM) ApplyGenesis

func (v *VM) ApplyGenesis(genesis []types.Account) error

ApplyGenesis saves list of accounts for genesis.

func (*VM) GetNonce

func (v *VM) GetNonce(address core.Address) (core.Nonce, error)

GetNonce returns expected next nonce for the address.

func (*VM) Validation

func (v *VM) Validation(raw types.RawTx) *Request

Validation initializes validation request.

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
templates

Jump to

Keyboard shortcuts

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