app

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Inputs
	Ain = "ain"
	Uin = "uin"
	// Outputs
	Aout      = "aout"
	Uout      = "uout"
	Cout      = "cout"
	Createout = "createout"
	Updateout = "updateout"
)

Variables

This section is empty.

Functions

func AllocAward

func AllocAward(wasm *wasm.WASM, logger log.Logger) error

func ApplyMessage

func ApplyMessage(vmenv vm.VmInterface, msg types.Message, tokenAddr common.Address) (ret []byte, gas uint64, byteCodeGas uint64, fee *big.Int, refundFee uint64, vmerr error, err error)

Deprecated

func CallWasmContract

func CallWasmContract(wasm *wasm.WASM, sender, contractAddr common.Address, amount *big.Int, input []byte, logger log.Logger) ([]byte, error)

CallWasmContract only be used by chain inner to call wasm contract directly

func GenerateTransaction added in v0.1.2

func GenerateTransaction(txi types.Tx, state *state.StateDB, vmenv *vm.VmFactory) (txo *processTransaction, err error)

func GetCoefficient

func GetCoefficient(statedb types.StateDB, logger log.Logger) *types.Coefficient

func SetPoceeds

func SetPoceeds(wasm *wasm.WASM, coinbase common.Address, amount *big.Int, logger log.Logger) error

Types

type AwardHandle

type AwardHandle func(wasm *wasm.WASM, logger log.Logger) error

type LinkApplication

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

func NewLinkApplication

func NewLinkApplication(db dbm.DB, bc *blockchain.BlockStore, utxoStore *utxo.UtxoStore,
	txService txmgr.CrossState, eventbus *types.EventBus, isTrie bool, brs *blockchain.BalanceRecordStore, poceedHandle PoceedHandle, awardHandle AwardHandle) (*LinkApplication, error)

func (*LinkApplication) Block

func (app *LinkApplication) Block() *types.Block

func (*LinkApplication) BlockChain

func (app *LinkApplication) BlockChain() types.BlockChain

func (*LinkApplication) CheckBlock

func (app *LinkApplication) CheckBlock(block *types.Block) bool

func (*LinkApplication) CheckBlockInCommit

func (app *LinkApplication) CheckBlockInCommit(block *types.Block) bool

XXX DEPRECATED

func (*LinkApplication) CheckTx

func (app *LinkApplication) CheckTx(tx types.Tx, checkBasic bool) error

CheckTx assumes that txs' signature has been verified before.

func (*LinkApplication) CommitBlock

func (app *LinkApplication) CommitBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit, fastsync bool) ([]*types.Validator, error)

func (*LinkApplication) CreateBlock

func (app *LinkApplication) CreateBlock(height uint64, maxTxs int, gasLimit uint64, timeUnix uint64) *types.Block

func (*LinkApplication) GetBalance

func (app *LinkApplication) GetBalance(addr common.Address) *big.Int

func (*LinkApplication) GetLastChangedVals

func (app *LinkApplication) GetLastChangedVals() (height uint64, vals []*types.Validator)

func (*LinkApplication) GetLatestStateDB

func (app *LinkApplication) GetLatestStateDB() *state.StateDB

func (*LinkApplication) GetNonce

func (app *LinkApplication) GetNonce(addr common.Address) uint64

func (*LinkApplication) GetPendingBlock

func (app *LinkApplication) GetPendingBlock() *types.Block

func (*LinkApplication) GetPendingStateDB

func (app *LinkApplication) GetPendingStateDB() *state.StateDB

func (*LinkApplication) GetRecoverValidators

func (app *LinkApplication) GetRecoverValidators(height uint64) []*types.Validator

GetRecoverValidators return both white list and candidates

func (*LinkApplication) GetStorageRoot

func (app *LinkApplication) GetStorageRoot(addr common.Address) common.Hash

func (*LinkApplication) GetUTXOChangeRate added in v0.1.3

func (app *LinkApplication) GetUTXOChangeRate(addr common.Address) (int64, error)

func (*LinkApplication) GetUTXOGas

func (app *LinkApplication) GetUTXOGas() uint64

func (*LinkApplication) GetValidators

func (app *LinkApplication) GetValidators(height uint64) []*types.Validator

func (*LinkApplication) Height

func (app *LinkApplication) Height() uint64

func (*LinkApplication) IsWasmContract

func (app *LinkApplication) IsWasmContract(data []byte) bool

func (*LinkApplication) LoadBlock

func (app *LinkApplication) LoadBlock(height uint64) *types.Block

func (*LinkApplication) LoadBlockCommit

func (app *LinkApplication) LoadBlockCommit(height uint64) *types.Commit

func (*LinkApplication) LoadBlockMeta

func (app *LinkApplication) LoadBlockMeta(height uint64) *types.BlockMeta

func (*LinkApplication) LoadBlockPart

func (app *LinkApplication) LoadBlockPart(height uint64, index int) *types.Part

func (*LinkApplication) LoadSeenCommit

func (app *LinkApplication) LoadSeenCommit(height uint64) *types.Commit

func (*LinkApplication) LockState

func (app *LinkApplication) LockState()

func (*LinkApplication) Mempool

func (app *LinkApplication) Mempool() types.Mempool

func (*LinkApplication) PreRunBlock

func (app *LinkApplication) PreRunBlock(block *types.Block)

func (*LinkApplication) SetConm

func (app *LinkApplication) SetConm(conM *p2p.ConManager)

func (*LinkApplication) SetLastChangedVals

func (app *LinkApplication) SetLastChangedVals(height uint64, vals []*types.Validator)

func (*LinkApplication) SetLogger

func (app *LinkApplication) SetLogger(l log.Logger)

func (*LinkApplication) SetMempool

func (app *LinkApplication) SetMempool(mempool types.Mempool)

func (*LinkApplication) State

func (app *LinkApplication) State() types.State

func (*LinkApplication) TxMgr

func (app *LinkApplication) TxMgr() types.TxMgr

func (*LinkApplication) UTXOStore

func (app *LinkApplication) UTXOStore() types.UTXOStore

func (*LinkApplication) UnlockState

func (app *LinkApplication) UnlockState()

type Mempool added in v0.1.2

type Mempool struct {
	mock.Mock
}

Mempool is an autogenerated mock type for the Mempool type

func (*Mempool) GetTxFromCache added in v0.1.2

func (_m *Mempool) GetTxFromCache(_a0 common.Hash) types.Tx

GetTxFromCache provides a mock function with given fields: _a0

func (*Mempool) KeyImageExists added in v0.1.2

func (_m *Mempool) KeyImageExists(key cryptonotetypes.Key) bool

KeyImageExists provides a mock function with given fields: key

func (*Mempool) KeyImagePush added in v0.1.2

func (_m *Mempool) KeyImagePush(key cryptonotetypes.Key) bool

KeyImagePush provides a mock function with given fields: key

func (*Mempool) KeyImageRemoveKeys added in v0.1.2

func (_m *Mempool) KeyImageRemoveKeys(_a0 []*cryptonotetypes.Key)

KeyImageRemoveKeys provides a mock function with given fields: _a0

func (*Mempool) KeyImageReset added in v0.1.2

func (_m *Mempool) KeyImageReset()

KeyImageReset provides a mock function with given fields:

func (*Mempool) Lock added in v0.1.2

func (_m *Mempool) Lock()

Lock provides a mock function with given fields:

func (*Mempool) Reap added in v0.1.2

func (_m *Mempool) Reap(maxTxs int) types.Txs

Reap provides a mock function with given fields: maxTxs

func (*Mempool) Unlock added in v0.1.2

func (_m *Mempool) Unlock()

Unlock provides a mock function with given fields:

func (*Mempool) Update added in v0.1.2

func (_m *Mempool) Update(height uint64, txs types.Txs) error

Update provides a mock function with given fields: height, txs

type PoceedHandle

type PoceedHandle func(wasm *wasm.WASM, coinbase common.Address, amount *big.Int, logger log.Logger) error

type ProcessResult

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

func (*ProcessResult) GetReceipts

func (p *ProcessResult) GetReceipts() *types.Receipts

func (*ProcessResult) GetTxsResult

func (p *ProcessResult) GetTxsResult() *types.TxsResult

type Processor

type Processor interface {
	Process(block *types.Block, statedb *state.StateDB, cfg evm.Config) (types.Receipts, []*types.Log, uint64, []types.Tx, []*types.UTXOOutputData, []*lctypes.Key, error)
}

Processor is an interface for processing blocks using a given initial state.

Process takes the block to be processed and the statedb upon which the initial state is based. It should return the receipts generated, amount of gas used in the process and return an error if any of the internal rules failed.

type StateProcessor

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

StateProcessor is a basic Processor, which takes care of transitioning state from one point to another.

StateProcessor implements Processor.

func NewStateProcessor

func NewStateProcessor(bc *blockchain.BlockStore, app *LinkApplication) *StateProcessor

NewStateProcessor initialises a new StateProcessor.

func (*StateProcessor) Process

func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg evm.Config) (types.Receipts, []*types.Log, uint64, []types.Tx, []*types.UTXOOutputData, []*lctypes.Key, error)

type TransitionResult added in v0.1.2

type TransitionResult struct {
	Rets        [][]byte
	Gas         uint64
	ByteCodeGas uint64
	Fee         *big.Int
	Addrs       []common.Address
	Otxs        []types.BalanceRecord
	RefundFee   uint64
}

Jump to

Keyboard shortcuts

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