verifier

package
v0.0.0-...-5fdeb2f Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: LGPL-3.0 Imports: 20 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

func Resolve

func Resolve(mappers []map[string]database.Access) (accept, drop []int)

Resolve Resolve conflict of parallel exec

Types

type Batch

type Batch struct {
	Txs      []*tx.Tx
	Receipts []*tx.TxReceipt
}

Batch tx batch in parallel

func NewBatch

func NewBatch() *Batch

NewBatch make a new batch pointer

type Batcher

type Batcher interface {
	Batch(bh *block.BlockHead, db database.IMultiValue, provider Provider, limit time.Duration, thread int) *Batch
	Verify(bh *block.BlockHead, db database.IMultiValue, checkFunc func(e vm.Isolator, t *tx.Tx, r *tx.TxReceipt) error, b *Batch) error
}

Batcher batch generator and verifier

func NewBatcher

func NewBatcher() Batcher

NewBatcher init of Batcher

type Config

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

Config config of verifier

type Info

type Info struct {
	Mode   int   `json:"mode"`
	Thread int   `json:"thread"`
	Batch  []int `json:"batch"`
}

Info info in block

type Provider

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

Provider of tx

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) (*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.empow/setCode

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) Exec

func (v *Verifier) 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 (*Verifier) Gen

func (v *Verifier) 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 (*Verifier) Try

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

Try exec tx and only return receipt

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