Documentation ¶
Index ¶
- Constants
- Variables
- func CanTransfer(am vm.AccountManager, addr common.Address, amount *big.Int) bool
- func GetHashFn(ref *types.Header, chain BlockLoader) vm.GetHashFunc
- func IntrinsicGas(txType uint16, data []byte, txMessage string) (uint64, error)
- func NewEVMContext(tx *types.Transaction, header *types.Header, txIndex uint, ...) vm.Context
- func Transfer(am vm.AccountManager, sender, recipient common.Address, amount *big.Int)
- type BlockLoader
- type BoxTxEnv
- type CandidateVoteEnv
- type ModifySigners
- type RunAssetEnv
- func (r *RunAssetEnv) CreateAssetTx(sender common.Address, data []byte, txHash common.Hash) error
- func (r *RunAssetEnv) IssueAssetTx(sender, receiver common.Address, txHash common.Hash, data []byte) error
- func (r *RunAssetEnv) ModifyAssetProfileTx(sender common.Address, data []byte) error
- func (r *RunAssetEnv) ReplenishAssetTx(sender, receiver common.Address, data []byte) error
- type SetMultisigAccountEnv
- type TxProcessor
- func (p *TxProcessor) ApplyTxs(header *types.Header, txs types.Transactions, timeLimitSecond int64) (types.Transactions, types.Transactions, uint64)
- func (p *TxProcessor) PreExecutionTransaction(ctx context.Context, accM *account.ReadOnlyManager, header *types.Header, ...) ([]byte, uint64, error)
- func (p *TxProcessor) Process(header *types.Header, txs types.Transactions) (uint64, error)
Constants ¶
const ( MaxDeputyHostLength = 128 StandardNodeIdLength = 128 SignerWeightThreshold = 100 MaxSignersNumber = 100 )
Variables ¶
var ( ErrIssueAssetAmount = errors.New("issue asset amount can't be 0 or nil") ErrIssueAssetMetaData = errors.New("the length of metaData more than limit") ErrReplenishAssetAmount = errors.New("replenish asset amount can't be 0 or nil") ErrAssetIssuer = errors.New("issue asset transaction's sender must the asset issuer") ErrFrozenAsset = errors.New("can't replenish the frozen assets") ErrIsReplenishable = errors.New("asset's \"IsReplenishable\" is false") ErrIsDivisible = errors.New("this \"isDivisible == false\" kind of asset can't be replenished") ErrNotEqualAssetCode = errors.New("assetCode not equal") ErrModifyAssetInfo = errors.New("missing required field 'info' for ModifyAssetInfo") ErrMarshalAssetLength = errors.New("the length of data by marshal asset more than max length") ErrAssetCategory = errors.New("assert's Category not exist") ErrModifyAssetTxSender = errors.New("the sender does not have permission to modify this asset") )
var ( ErrNestedBoxTx = errors.New("box transaction cannot be a sub transaction") ErrApplyBoxTxsTimeout = errors.New("apply box txs timeout") )
var ( ErrOfAgainVote = errors.New("already voted the same as candidate node") ErrOfNotCandidateNode = errors.New("node address is not candidate account") ErrOfRegisterNodeID = errors.New("can't get nodeId of RegisterInfo") ErrOfRegisterHost = errors.New("can't get host of RegisterInfo") ErrOfRegisterPort = errors.New("can't get port of RegisterInfo") ErrAgainRegister = errors.New("cannot register again after unregistering") ErrInsufficientBalance = errors.New("insufficient balance for transfer") )
var ( ErrAddressRepeat = errors.New("cannot set two identical addresses") ErrWeight = errors.New("signer weight error") ErrTempAccount = errors.New("temp account format error") ErrSignersNumber = errors.New("cannot exceed the maximum number of signers") ErrRepeatSetTempAddress = errors.New("the temp address's multisig has been set up") )
var ( ErrInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas") ErrInvalidTxInBlock = errors.New("block contains invalid transaction") ErrInvalidGenesis = errors.New("can't process genesis block") ErrInvalidHost = errors.New("the length of host field in transaction is out of max length limit") ErrInvalidAddress = errors.New("invalid address") ErrInvalidNodeId = errors.New("invalid nodeId") ErrTxNotSign = errors.New("the transaction is not signed") ErrTotalWeight = errors.New("insufficient total weight of signatories") ErrSignerAndFromUnequally = errors.New("the signer and from of transaction are not equal") ErrGasPayer = errors.New("the gasPayer error") ErrSetMulisig = errors.New("from and to must be equal") ErrAddressType = errors.New("address type wrong") ErrTempAddress = errors.New("the issuer part in temp address is incorrect") )
Functions ¶
func CanTransfer ¶
CanTransfer checks whether there are enough funds in the address' account to make a transfer. This does not take the necessary gas in to account to make the transfer valid.
func GetHashFn ¶
func GetHashFn(ref *types.Header, chain BlockLoader) vm.GetHashFunc
GetHashFn returns a GetHashFunc which retrieves header hashes by number
func IntrinsicGas ¶
IntrinsicGas computes the 'intrinsic gas' for a message with the given data.
func NewEVMContext ¶
func NewEVMContext(tx *types.Transaction, header *types.Header, txIndex uint, blockHash common.Hash, chain BlockLoader) vm.Context
NewEVMContext creates a new context for use in the EVM.
Types ¶
type BlockLoader ¶
type BlockLoader interface { // GetBlockByHash returns the hash corresponding to their hash. GetBlockByHash(hash common.Hash) *types.Block // GetBlockByHash returns the hash corresponding to their hash. GetParentByHeight(height uint32, sonBlockHash common.Hash) *types.Block }
BlockLoader supports retrieving headers and consensus parameters from the current blockchain to be used during transaction processing.
type BoxTxEnv ¶
type BoxTxEnv struct {
// contains filtered or unexported fields
}
func NewBoxTxEnv ¶
func NewBoxTxEnv(p *TxProcessor) *BoxTxEnv
type CandidateVoteEnv ¶
type CandidateVoteEnv struct { CanTransfer func(vm.AccountManager, common.Address, *big.Int) bool Transfer func(vm.AccountManager, common.Address, common.Address, *big.Int) // contains filtered or unexported fields }
func NewCandidateVoteEnv ¶
func NewCandidateVoteEnv(am *account.Manager) *CandidateVoteEnv
func (*CandidateVoteEnv) CallVoteTx ¶
CallVoteTx voting transaction call
func (*CandidateVoteEnv) RegisterOrUpdateToCandidate ¶
func (c *CandidateVoteEnv) RegisterOrUpdateToCandidate(tx *types.Transaction, initialSenderBalance *big.Int) error
RegisterOrUpdateToCandidate candidate node account transaction call
type ModifySigners ¶
type RunAssetEnv ¶
type RunAssetEnv struct {
// contains filtered or unexported fields
}
func NewRunAssetEnv ¶
func NewRunAssetEnv(am *account.Manager) *RunAssetEnv
func (*RunAssetEnv) CreateAssetTx ¶
CreateAssetTx
func (*RunAssetEnv) IssueAssetTx ¶
func (r *RunAssetEnv) IssueAssetTx(sender, receiver common.Address, txHash common.Hash, data []byte) error
IssueAssetTx
func (*RunAssetEnv) ModifyAssetProfileTx ¶
func (r *RunAssetEnv) ModifyAssetProfileTx(sender common.Address, data []byte) error
ModifyAssetProfileTx
func (*RunAssetEnv) ReplenishAssetTx ¶
func (r *RunAssetEnv) ReplenishAssetTx(sender, receiver common.Address, data []byte) error
ReplenishAssetTx
type SetMultisigAccountEnv ¶
type SetMultisigAccountEnv struct {
// contains filtered or unexported fields
}
func NewSetMultisigAccountEnv ¶
func NewSetMultisigAccountEnv(am *account.Manager) *SetMultisigAccountEnv
func (*SetMultisigAccountEnv) ModifyMultisigTx ¶
func (s *SetMultisigAccountEnv) ModifyMultisigTx(from, to common.Address, data []byte) error
ModifyMultisigTx
type TxProcessor ¶
type TxProcessor struct { ChainID uint16 // contains filtered or unexported fields }
func NewTxProcessor ¶
func NewTxProcessor(issueRewardAddress common.Address, chainID uint16, blockLoader BlockLoader, am *account.Manager, db protocol.ChainDB) *TxProcessor
func (*TxProcessor) ApplyTxs ¶
func (p *TxProcessor) ApplyTxs(header *types.Header, txs types.Transactions, timeLimitSecond int64) (types.Transactions, types.Transactions, uint64)
ApplyTxs picks and processes transactions from miner's tx pool.
func (*TxProcessor) PreExecutionTransaction ¶
func (p *TxProcessor) PreExecutionTransaction(ctx context.Context, accM *account.ReadOnlyManager, header *types.Header, to *common.Address, txType uint16, data hexutil.Bytes, blockHash common.Hash, timeout time.Duration) ([]byte, uint64, error)
PreExecutionTransaction pre-execute transactions and contracts.
func (*TxProcessor) Process ¶
func (p *TxProcessor) Process(header *types.Header, txs types.Transactions) (uint64, error)
Process processes all transactions in a block. Change accounts' data and execute contract codes.