verifier

package
v3.11.5 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExpiredTx    = errors.New("expired tx")
	ErrNotArrivedTx = errors.New("not arrived tx")
	ErrInvalidMode  = errors.New("invalid mode")
)

values

Functions

func NewBaseTx

func NewBaseTx(blk, parent *block.Block, witnessList *blockcache.WitnessList) (*tx.Tx, error)

NewBaseTx is new baseTx

Types

type Config

type Config struct {
	Mode        int
	Timeout     time.Duration
	TxTimeLimit time.Duration
	Thread      int
}

Config config of verifier

type Executor added in v3.7.0

type Executor struct {
}

func (*Executor) Exec added in v3.7.0

func (v *Executor) Exec(bh *block.BlockHead, db database.IMultiValue, t *tx.Tx, limit time.Duration) (*tx.TxReceipt, error)

Exec exec single tx and flush changes to db

func (*Executor) Gen added in v3.7.0

func (v *Executor) Gen(blk, parent *block.Block, witnessList *blockcache.WitnessList, db database.IMultiValue, iter *txpool.SortedTxMap, c *Config) (droplist []*tx.Tx, errs []error, err error)

Gen gen block

func (*Executor) Try added in v3.7.0

func (v *Executor) Try(bh *block.BlockHead, db database.IMultiValue, t *tx.Tx, limit time.Duration) (*tx.TxReceipt, error)

Try exec tx and only return receipt

type Provider

type Provider interface {
	Tx() *tx.Tx
	Return(*tx.Tx)
	Drop(t *tx.Tx, err error)
	Close()
}

type ProviderImpl

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

ProviderImpl impl of provider

func NewProvider

func NewProvider(pool *txpool.SortedTxMap) *ProviderImpl

NewProvider ...

func (*ProviderImpl) Close

func (p *ProviderImpl) Close()

Close drop bad tx here

func (*ProviderImpl) Drop

func (p *ProviderImpl) Drop(t *tx.Tx, err error)

Drop drop bad tx

func (*ProviderImpl) List

func (p *ProviderImpl) List() (a []*tx.Tx, b []error)

List list tx and errors of drop txs

func (*ProviderImpl) Return

func (p *ProviderImpl) Return(t *tx.Tx)

Return send tx to pool

func (*ProviderImpl) Tx

func (p *ProviderImpl) Tx() *tx.Tx

Tx get next tx

type Simulator

type Simulator struct {
	Visitor  *database.Visitor
	Verifier *Verifier
	Head     *block.BlockHead
	Logger   *ilog.Logger
	Mvcc     db.MVCCDB
	GasLimit int64
}

Simulator of txs and contract

func NewSimulator

func NewSimulator() *Simulator

NewSimulator get a simulator with default settings

func (*Simulator) Call

func (s *Simulator) Call(contractName, abi, args string, publisher string, auth *account.KeyPair, otherArgs ...any) (*tx.TxReceipt, error)

Call abi with basic settings

func (*Simulator) CallTx

func (s *Simulator) CallTx(trx *tx.Tx, publisher string, auth *account.KeyPair) (*tx.TxReceipt, error)

CallTx with user defiened tx

func (*Simulator) Clear

func (s *Simulator) Clear()

Clear mvccdb

func (*Simulator) Compile

func (s *Simulator) Compile(id, src, abi string) (*contract.Contract, error)

Compile files

func (*Simulator) DeployContract

func (s *Simulator) DeployContract(c *contract.Contract, publisher string, kp *account.KeyPair) (string, *tx.TxReceipt, error)

DeployContract via system.iost/setCode

func (*Simulator) DeploySystemContract

func (s *Simulator) DeploySystemContract(c *contract.Contract, publisher string, kp *account.KeyPair) (*tx.TxReceipt, error)

DeploySystemContract via system.iost/initSetCode

func (*Simulator) GetGas

func (s *Simulator) GetGas(id string) int64

GetGas ...

func (*Simulator) GetRAM

func (s *Simulator) GetRAM(id string) int64

GetRAM of id

func (*Simulator) RunTx

func (s *Simulator) RunTx(stx *tx.Tx) (*tx.TxReceipt, error)

RunTx run tx with signed tx

func (*Simulator) SetAccount

func (s *Simulator) SetAccount(acc *account.Account)

SetAccount ...

func (*Simulator) SetBlockHead

func (s *Simulator) SetBlockHead(head *block.BlockHead)

SetBlockHead ...

func (*Simulator) SetContract

func (s *Simulator) SetContract(c *contract.Contract)

SetContract without run init

func (*Simulator) SetGas

func (s *Simulator) SetGas(id string, i int64)

SetGas to id

func (*Simulator) SetRAM

func (s *Simulator) SetRAM(id string, r int64)

SetRAM to id

type Verifier

type Verifier struct {
}

Verifier ..

func (*Verifier) Verify

func (v *Verifier) Verify(blk, parent *block.Block, witnessList *blockcache.WitnessList, db database.IMultiValue, c *Config) error

Verify verify block generated by Verifier

Jump to

Keyboard shortcuts

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