Documentation
¶
Index ¶
- Constants
- Variables
- func Decay(rawValue *big.Int) *big.Int
- func EqualZero(number *big.Int) bool
- func GreaterThanZero(number *big.Int) bool
- func Min(x, y uint64) uint64
- func ProportionAlgorithm(numerator *big.Int, denominator *big.Int, total *big.Int) *big.Int
- func RegisterEvaluator(opPtr interface{}, evalCreator EvaluatorCreator)
- func RegisterEvaluatorWithMinHardFork(opPtr interface{}, evalCreator EvaluatorCreator, minHardFork uint64)
- func StringToBigInt(n string) *big.Int
- func SumItemsWvp(items []IItem) *big.Int
- type AccountCreateEvaluator
- type AccountUpdateEvaluator
- type AcquireTicketEvaluator
- type ApplyDelegate
- type AuthFetcher
- func (f *AuthFetcher) BlockApplied(b *prototype.SignedBlock)
- func (f *AuthFetcher) BlockCommitted(blockNum uint64)
- func (f *AuthFetcher) BlockReverted(blockNum uint64)
- func (f *AuthFetcher) CacheCount() int64
- func (f *AuthFetcher) CheckPublicKey(account string, key *prototype.PublicKeyType) error
- func (f *AuthFetcher) Discard(account string)
- func (f *AuthFetcher) GetPublicKey(account string) (*prototype.PublicKeyType, error)
- func (f *AuthFetcher) HitRate() (rate float64)
- type BaseDelegate
- type BaseEvaluator
- type BlockIceberg
- func (b *BlockIceberg) BeginBlock(blockNum uint64) error
- func (b *BlockIceberg) EndBlock(commit bool) error
- func (b *BlockIceberg) FinalizeBlock(blockNum uint64) error
- func (b *BlockIceberg) LastFinalizedBlock() (blockNum uint64, err error)
- func (b *BlockIceberg) LatestBlock() (blockNum uint64, inProgress bool, err error)
- func (b *BlockIceberg) LatestBlockApplyHash() uint64
- func (b *BlockIceberg) LatestBlockApplyHashUnpacked() (version, hash uint32)
- func (b *BlockIceberg) RevertBlock(blockNum uint64) error
- type BpEnableEvaluator
- type BpRegisterEvaluator
- type BpUpdateEvaluator
- type BpVoteEvaluator
- type ContractApplyEvaluator
- type ContractDeployEvaluator
- type ConvertVestEvaluator
- type DappItem
- type DefaultTrxScheduler
- type DelegateVestEvaluator
- type DynamicGlobalPropsRW
- func (dgp *DynamicGlobalPropsRW) GetProps() *prototype.DynamicProperties
- func (dgp *DynamicGlobalPropsRW) HeadBlockTime() *prototype.TimePointSec
- func (dgp *DynamicGlobalPropsRW) ModifyProps(modifier func(oldProps *prototype.DynamicProperties))
- func (dgp *DynamicGlobalPropsRW) TransferFromStakeVest(value *prototype.Vest)
- func (dgp *DynamicGlobalPropsRW) TransferFromVest(value *prototype.Vest)
- func (dgp *DynamicGlobalPropsRW) TransferToStakeVest(value *prototype.Coin)
- func (dgp *DynamicGlobalPropsRW) TransferToVest(value *prototype.Coin)
- func (dgp *DynamicGlobalPropsRW) UpdateTicketIncomeAndNum(income *prototype.Vest, count uint64)
- type Economist
- type EvaluatorCreator
- type FollowEvaluator
- type IItem
- type ITrxMgrPlugin
- type ITrxScheduler
- type InBlockTrxChecker
- type InBlockTrxEntry
- type InternalContractApplyEvaluator
- type Item
- type MultiTrxsApplier
- type PostEvaluator
- type PostItem
- type PropBasedTrxScheduler
- type ReplyEvaluator
- type SingleTrxApplier
- type StakeEvaluator
- type TaposChecker
- type TransferEvaluator
- type TransferToVestEvaluator
- type TrxCallback
- type TrxContext
- func (p *TrxContext) CheckNet(db iservices.IDatabaseRW, sizeInBytes uint64)
- func (p *TrxContext) ContractABI(owner, contract string) string
- func (p *TrxContext) ContractCall(...)
- func (p *TrxContext) CurrentRecordID() (rid uint64)
- func (p *TrxContext) Database() iservices.IDatabaseRW
- func (p *TrxContext) DeductAllCpu(db iservices.IDatabaseRW)
- func (p *TrxContext) DeductAllNet(db iservices.IDatabaseRW)
- func (p *TrxContext) DeductStamina(caller string, spent uint64)
- func (p *TrxContext) DiscardAccountCache(name string)
- func (p *TrxContext) Error(code uint32, msg string)
- func (p *TrxContext) Finalize()
- func (p *TrxContext) GetBlockProducers() (names []string)
- func (p *TrxContext) GetCpuUse() uint64
- func (p *TrxContext) GetNetUse() uint64
- func (p *TrxContext) GetVmRemainCpuStamina(name string) uint64
- func (p *TrxContext) GlobalProp() iservices.IGlobalPropRW
- func (p *TrxContext) HardFork() uint64
- func (p *TrxContext) HasGasFee() bool
- func (p *TrxContext) Log(msg string)
- func (p *TrxContext) Logger() *logrus.Logger
- func (p *TrxContext) NewRecordID() (rid uint64)
- func (p *TrxContext) RecordOperationStaminaFee()
- func (p *TrxContext) RecordStaminaFee(caller string, spent uint64)
- func (p *TrxContext) RequireAuth(name string) (err error)
- func (p *TrxContext) SetStatus(s uint32)
- func (p *TrxContext) StartNextOp(opIdx int, op *prototype.Operation)
- func (p *TrxContext) StateChangeContext() *blocklog.StateChangeContext
- func (p *TrxContext) TransferFromContractToContract(fromContract, fromOwner, toContract, toOwner string, amount uint64)
- func (p *TrxContext) TransferFromContractToUser(contract, owner, to string, amount uint64)
- func (p *TrxContext) TransferFromContractToUserVest(contract, owner, to string, amount uint64)
- func (p *TrxContext) TransferFromUserToContract(from, contract, owner string, amount uint64)
- func (p *TrxContext) VMInjector() vminjector.Injector
- func (p *TrxContext) VmCache() *vmcache.VmCache
- type TrxEntry
- func (e *TrxEntry) CheckExpiration(blockTime uint32) error
- func (e *TrxEntry) CheckInBlockTrxs(checker *InBlockTrxChecker) error
- func (e *TrxEntry) CheckSignerKey(fetcher *AuthFetcher) error
- func (e *TrxEntry) CheckTapos(checker *TaposChecker) error
- func (e *TrxEntry) Deliver()
- func (e *TrxEntry) GetTrxResult() *prototype.TransactionWrapperWithInfo
- func (e *TrxEntry) GetTrxSigner() string
- func (e *TrxEntry) GetTrxSigningKey() *prototype.PublicKeyType
- func (e *TrxEntry) GetTrxSize() int
- func (e *TrxEntry) InitCheck() error
- func (e *TrxEntry) SetError(err error) error
- type TrxMgr
- func (m *TrxMgr) AddTrx(trx *prototype.SignedTransaction, callback TrxCallback) error
- func (m *TrxMgr) BlockApplied(b *prototype.SignedBlock)
- func (m *TrxMgr) BlockCommitted(blockNum uint64)
- func (m *TrxMgr) BlockReverted(blockNum uint64)
- func (m *TrxMgr) CheckBlockTrxs(b *prototype.SignedBlock) (entries []*TrxEntry, err error)
- func (m *TrxMgr) DiscardAccountCache(name string)
- func (m *TrxMgr) FetchTrx(blockTime uint32, maxCount, maxSize int) (entries []*TrxEntry)
- func (m *TrxMgr) ReturnTrx(entries ...*TrxEntry)
- func (m *TrxMgr) WaitingCount() int
- type TrxPool
- func (c *TrxPool) CalculateUserMaxStamina(db iservices.IDatabaseRW, name string) uint64
- func (c *TrxPool) CheckNetForRPC(name string, db iservices.IDatabaseRW, sizeInBytes uint64) (bool, uint64, uint64)
- func (c *TrxPool) Commit(num uint64)
- func (c *TrxPool) DiscardAccountCache(name string)
- func (c *TrxPool) EstimateStamina(trx *prototype.SignedTransaction) (invoice *prototype.TransactionReceiptWithInfo)
- func (c *TrxPool) GenerateAndApplyBlock(bpName string, pre *prototype.Sha256, timestamp uint32, ...) (*prototype.SignedBlock, error)
- func (c *TrxPool) GetBlockProducerTopN(n uint32) ([]string, []*prototype.PublicKeyType)
- func (c *TrxPool) GetFinalizedNum() (uint64, error)
- func (c *TrxPool) GetHeadBlockNum() (uint64, error)
- func (c *TrxPool) GetProps() *prototype.DynamicProperties
- func (c *TrxPool) GetShuffledBpList() ([]string, []*prototype.PublicKeyType, uint64)
- func (c *TrxPool) HardFork() uint64
- func (c *TrxPool) HeadBlockTime() *prototype.TimePointSec
- func (c *TrxPool) ModifyProps(modifier func(oldProps *prototype.DynamicProperties))
- func (c *TrxPool) Open()
- func (c *TrxPool) PayGas(db iservices.IDatabaseRW, trxContext *TrxContext)
- func (c *TrxPool) PopBlock(num uint64) error
- func (c *TrxPool) PreShuffle() error
- func (c *TrxPool) PushBlock(blk *prototype.SignedBlock, skip prototype.SkipFlag) (err error)
- func (c *TrxPool) PushTrxToPending(trx *prototype.SignedTransaction) (err error)
- func (c *TrxPool) SetShuffle(s common.ShuffleFunc)
- func (c *TrxPool) SetShuffledBpList(names []string, keys []*prototype.PublicKeyType, seq uint64)
- func (c *TrxPool) ShareTicketBonus() (err error)
- func (c *TrxPool) Start(node *node.Node) error
- func (c *TrxPool) Stop() error
- func (c *TrxPool) ValidateAddress(name string, pubKey *prototype.PublicKeyType) bool
- type UnDelegateVestEvaluator
- type UnStakeEvaluator
- type VoteByTicketEvaluator
- type VoteEvaluator
- type VoteItem
Constants ¶
const CashoutCompleted uint64 = math.MaxUint64
const (
GENESIS_TAG = "after_init_genesis"
)
Variables ¶
var (
SingleId int32 = constants.SingletonId
)
Functions ¶
func GreaterThanZero ¶ added in v1.0.2
func ProportionAlgorithm ¶ added in v1.0.2
func RegisterEvaluator ¶ added in v1.0.2
func RegisterEvaluator(opPtr interface{}, evalCreator EvaluatorCreator)
func RegisterEvaluatorWithMinHardFork ¶ added in v1.0.8
func RegisterEvaluatorWithMinHardFork(opPtr interface{}, evalCreator EvaluatorCreator, minHardFork uint64)
func StringToBigInt ¶ added in v1.0.2
func SumItemsWvp ¶ added in v1.0.2
Types ¶
type AccountCreateEvaluator ¶
type AccountCreateEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*AccountCreateEvaluator) Apply ¶
func (ev *AccountCreateEvaluator) Apply()
type AccountUpdateEvaluator ¶ added in v1.0.2
type AccountUpdateEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*AccountUpdateEvaluator) Apply ¶ added in v1.0.2
func (ev *AccountUpdateEvaluator) Apply()
type AcquireTicketEvaluator ¶ added in v1.0.2
type AcquireTicketEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*AcquireTicketEvaluator) Apply ¶ added in v1.0.2
func (ev *AcquireTicketEvaluator) Apply()
type ApplyDelegate ¶ added in v1.0.2
type ApplyDelegate interface { Database() iservices.IDatabaseRW GlobalProp() iservices.IGlobalPropRW VMInjector() vminjector.Injector Logger() *logrus.Logger HardFork() uint64 }
type AuthFetcher ¶ added in v1.0.2
type AuthFetcher struct {
// contains filtered or unexported fields
}
AuthFetcher queries the public key of specified account. It's designed for best performance by using a memory cache.
func NewAuthFetcher ¶ added in v1.0.2
func NewAuthFetcher(db iservices.IDatabaseRW, logger *logrus.Logger, headBlockNum, lastCommitBlockNum uint64) *AuthFetcher
NewAuthFetcher creates an instance of AuthFetcher
func (*AuthFetcher) BlockApplied ¶ added in v1.0.2
func (f *AuthFetcher) BlockApplied(b *prototype.SignedBlock)
BlockApplied *MUST* be called *AFTER* a block was successfully applied.
func (*AuthFetcher) BlockCommitted ¶ added in v1.0.2
func (f *AuthFetcher) BlockCommitted(blockNum uint64)
BlockCommitted *SHOULD* be called *AFTER* a block was successfully committed.
func (*AuthFetcher) BlockReverted ¶ added in v1.0.2
func (f *AuthFetcher) BlockReverted(blockNum uint64)
BlockReverted *MUST* be called *AFTER* a block was successfully reverted.
func (*AuthFetcher) CacheCount ¶ added in v1.0.2
func (f *AuthFetcher) CacheCount() int64
CacheCount returns number of cached {accountName, publicKey} pairs.
func (*AuthFetcher) CheckPublicKey ¶ added in v1.0.2
func (f *AuthFetcher) CheckPublicKey(account string, key *prototype.PublicKeyType) error
CheckPublicKey checks if given account and its public key are matched.
func (*AuthFetcher) Discard ¶ added in v1.0.2
func (f *AuthFetcher) Discard(account string)
Discard remove specified account from cache.
func (*AuthFetcher) GetPublicKey ¶ added in v1.0.2
func (f *AuthFetcher) GetPublicKey(account string) (*prototype.PublicKeyType, error)
GetPublicKey returns the public key of given account. It returns a nil-key and an error if given account not found.
func (*AuthFetcher) HitRate ¶ added in v1.0.2
func (f *AuthFetcher) HitRate() (rate float64)
HitRate returns cache hit rate, in range [0, 1]. Hit rate is the most important factor of AuthFetcher's performance, which is roughly proportional to 1/(1-hit_rate). If the rate is constantly below 0.99, we should consider increasing sAuthCacheMaxSize.
type BaseDelegate ¶ added in v1.0.2
type BaseDelegate struct {
// contains filtered or unexported fields
}
func (*BaseDelegate) Database ¶ added in v1.0.2
func (d *BaseDelegate) Database() iservices.IDatabaseRW
func (*BaseDelegate) GlobalProp ¶ added in v1.0.2
func (d *BaseDelegate) GlobalProp() iservices.IGlobalPropRW
func (*BaseDelegate) HardFork ¶ added in v1.0.2
func (d *BaseDelegate) HardFork() uint64
func (*BaseDelegate) Logger ¶ added in v1.0.2
func (d *BaseDelegate) Logger() *logrus.Logger
func (*BaseDelegate) VMInjector ¶ added in v1.0.2
func (d *BaseDelegate) VMInjector() vminjector.Injector
type BaseEvaluator ¶
type BaseEvaluator interface {
Apply()
}
func GetBaseEvaluator ¶ added in v1.0.2
func GetBaseEvaluator(delegate ApplyDelegate, op *prototype.Operation, currentHardfork uint64) BaseEvaluator
type BlockIceberg ¶ added in v1.0.2
type BlockIceberg struct {
// contains filtered or unexported fields
}
the block iceberg
func NewBlockIceberg ¶ added in v1.0.2
func NewBlockIceberg(db iservices.IDatabaseService, logger *logrus.Logger, enableBAH bool) *BlockIceberg
NewBlockIceberg() returns an instance of block iceberg.
func (*BlockIceberg) BeginBlock ¶ added in v1.0.2
func (b *BlockIceberg) BeginBlock(blockNum uint64) error
func (*BlockIceberg) EndBlock ¶ added in v1.0.2
func (b *BlockIceberg) EndBlock(commit bool) error
func (*BlockIceberg) FinalizeBlock ¶ added in v1.0.2
func (b *BlockIceberg) FinalizeBlock(blockNum uint64) error
func (*BlockIceberg) LastFinalizedBlock ¶ added in v1.0.2
func (b *BlockIceberg) LastFinalizedBlock() (blockNum uint64, err error)
func (*BlockIceberg) LatestBlock ¶ added in v1.0.2
func (b *BlockIceberg) LatestBlock() (blockNum uint64, inProgress bool, err error)
func (*BlockIceberg) LatestBlockApplyHash ¶ added in v1.0.2
func (b *BlockIceberg) LatestBlockApplyHash() uint64
func (*BlockIceberg) LatestBlockApplyHashUnpacked ¶ added in v1.0.2
func (b *BlockIceberg) LatestBlockApplyHashUnpacked() (version, hash uint32)
func (*BlockIceberg) RevertBlock ¶ added in v1.0.2
func (b *BlockIceberg) RevertBlock(blockNum uint64) error
type BpEnableEvaluator ¶ added in v1.0.2
type BpEnableEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*BpEnableEvaluator) Apply ¶ added in v1.0.2
func (ev *BpEnableEvaluator) Apply()
type BpRegisterEvaluator ¶
type BpRegisterEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*BpRegisterEvaluator) Apply ¶
func (ev *BpRegisterEvaluator) Apply()
type BpUpdateEvaluator ¶ added in v1.0.2
type BpUpdateEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*BpUpdateEvaluator) Apply ¶ added in v1.0.2
func (ev *BpUpdateEvaluator) Apply()
type BpVoteEvaluator ¶
type BpVoteEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*BpVoteEvaluator) Apply ¶
func (ev *BpVoteEvaluator) Apply()
type ContractApplyEvaluator ¶ added in v1.0.2
type ContractApplyEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*ContractApplyEvaluator) Apply ¶ added in v1.0.2
func (ev *ContractApplyEvaluator) Apply()
type ContractDeployEvaluator ¶ added in v1.0.2
type ContractDeployEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*ContractDeployEvaluator) Apply ¶ added in v1.0.2
func (ev *ContractDeployEvaluator) Apply()
type ConvertVestEvaluator ¶ added in v1.0.2
type ConvertVestEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*ConvertVestEvaluator) Apply ¶ added in v1.0.2
func (ev *ConvertVestEvaluator) Apply()
type DappItem ¶ added in v1.0.2
type DappItem struct { Item // contains filtered or unexported fields }
type DefaultTrxScheduler ¶ added in v1.0.2
type DefaultTrxScheduler struct{}
DefaultTrxScheduler schedules nothing. It just outputs a single sub-group with all incoming transactions.
func (DefaultTrxScheduler) ScheduleTrxs ¶ added in v1.0.2
func (s DefaultTrxScheduler) ScheduleTrxs(trxs []*TrxEntry) [][]*TrxEntry
type DelegateVestEvaluator ¶ added in v1.0.8
type DelegateVestEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*DelegateVestEvaluator) Apply ¶ added in v1.0.8
func (ev *DelegateVestEvaluator) Apply()
type DynamicGlobalPropsRW ¶ added in v1.0.2
type DynamicGlobalPropsRW struct {
// contains filtered or unexported fields
}
func (*DynamicGlobalPropsRW) GetProps ¶ added in v1.0.2
func (dgp *DynamicGlobalPropsRW) GetProps() *prototype.DynamicProperties
func (*DynamicGlobalPropsRW) HeadBlockTime ¶ added in v1.0.2
func (dgp *DynamicGlobalPropsRW) HeadBlockTime() *prototype.TimePointSec
func (*DynamicGlobalPropsRW) ModifyProps ¶ added in v1.0.2
func (dgp *DynamicGlobalPropsRW) ModifyProps(modifier func(oldProps *prototype.DynamicProperties))
func (*DynamicGlobalPropsRW) TransferFromStakeVest ¶ added in v1.0.2
func (dgp *DynamicGlobalPropsRW) TransferFromStakeVest(value *prototype.Vest)
func (*DynamicGlobalPropsRW) TransferFromVest ¶ added in v1.0.2
func (dgp *DynamicGlobalPropsRW) TransferFromVest(value *prototype.Vest)
func (*DynamicGlobalPropsRW) TransferToStakeVest ¶ added in v1.0.2
func (dgp *DynamicGlobalPropsRW) TransferToStakeVest(value *prototype.Coin)
func (*DynamicGlobalPropsRW) TransferToVest ¶ added in v1.0.2
func (dgp *DynamicGlobalPropsRW) TransferToVest(value *prototype.Coin)
func (*DynamicGlobalPropsRW) UpdateTicketIncomeAndNum ¶ added in v1.0.2
func (dgp *DynamicGlobalPropsRW) UpdateTicketIncomeAndNum(income *prototype.Vest, count uint64)
type Economist ¶ added in v1.0.2
type Economist struct {
// contains filtered or unexported fields
}
func NewEconomist ¶ added in v1.0.2
func (*Economist) DeliverDelegatedVests ¶ added in v1.0.8
func (e *Economist) DeliverDelegatedVests()
func (*Economist) SetStateChangeContext ¶ added in v1.0.2
func (e *Economist) SetStateChangeContext(ctx *blocklog.StateChangeContext)
type EvaluatorCreator ¶ added in v1.0.2
type EvaluatorCreator func(delegate ApplyDelegate, op prototype.BaseOperation) BaseEvaluator
type FollowEvaluator ¶
type FollowEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*FollowEvaluator) Apply ¶
func (ev *FollowEvaluator) Apply()
type ITrxMgrPlugin ¶ added in v1.0.2
type ITrxMgrPlugin interface { BlockApplied(b *prototype.SignedBlock) // called once after a block is successfully applied. BlockReverted(blockNum uint64) // called once after a block is successfully reverted. BlockCommitted(blockNum uint64) // called once after a block is successfully committed. }
ITrxMgrPlugin is an interface of manager plugins.
type ITrxScheduler ¶ added in v1.0.2
ITrxScheduler is a scheduler for multiple transactions. Its purpose is to split an incoming transaction group into multiple independent sub-groups. Sub-groups are safe for concurrent application while transactions of the same sub-group are dependent and must be applied in order.
type InBlockTrxChecker ¶ added in v1.0.2
type InBlockTrxChecker struct {
// contains filtered or unexported fields
}
InBlockTrxChecker checks if a given transaction can be found in latest blocks.
func NewInBlockTrxChecker ¶ added in v1.0.2
func NewInBlockTrxChecker(db iservices.IDatabaseRW, logger *logrus.Logger, last uint64) *InBlockTrxChecker
NewInBlockTrxChecker creates an instance of InBlockTrxChecker.
func (*InBlockTrxChecker) BlockApplied ¶ added in v1.0.2
func (c *InBlockTrxChecker) BlockApplied(b *prototype.SignedBlock)
BlockApplied *MUST* be called *AFTER* a block was successfully applied.
func (*InBlockTrxChecker) BlockCommitted ¶ added in v1.0.2
func (c *InBlockTrxChecker) BlockCommitted(blockNum uint64)
BlockCommitted *SHOULD* be called *AFTER* a block was successfully committed.
func (*InBlockTrxChecker) BlockReverted ¶ added in v1.0.2
func (c *InBlockTrxChecker) BlockReverted(blockNum uint64)
BlockReverted *MUST* be called *AFTER* a block was successfully reverted.
func (*InBlockTrxChecker) Has ¶ added in v1.0.2
func (c *InBlockTrxChecker) Has(trx *prototype.SignedTransaction) bool
Has checks if a given transaction can be found in latest blocks.
type InBlockTrxEntry ¶ added in v1.0.2
type InBlockTrxEntry struct {
// contains filtered or unexported fields
}
InBlockTrxEntry represents all transactions in a block
func NewInBlockEntry ¶ added in v1.0.2
func NewInBlockEntry(data []byte) *InBlockTrxEntry
NewInBlockEntry creates an instance of InBlockTrxEntry
type InternalContractApplyEvaluator ¶ added in v1.0.2
type InternalContractApplyEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*InternalContractApplyEvaluator) Apply ¶ added in v1.0.2
func (ev *InternalContractApplyEvaluator) Apply()
type MultiTrxsApplier ¶ added in v1.0.2
type MultiTrxsApplier struct {
// contains filtered or unexported fields
}
MultiTrxsApplier concurrently applies multiple transactions.
func NewMultiTrxsApplier ¶ added in v1.0.2
func NewMultiTrxsApplier(db iservices.IDatabaseService, singleApplier SingleTrxApplier, blockNum uint64) *MultiTrxsApplier
func (*MultiTrxsApplier) Apply ¶ added in v1.0.2
func (a *MultiTrxsApplier) Apply(trxs []*TrxEntry)
type PostEvaluator ¶
type PostEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*PostEvaluator) Apply ¶
func (ev *PostEvaluator) Apply()
type PostItem ¶ added in v1.0.2
type PostItem struct { Item // contains filtered or unexported fields }
type PropBasedTrxScheduler ¶ added in v1.0.2
type PropBasedTrxScheduler struct{}
PropBasedTrxScheduler split sub-groups based on affected properties of each transaction.
func (PropBasedTrxScheduler) ScheduleTrxs ¶ added in v1.0.2
func (s PropBasedTrxScheduler) ScheduleTrxs(trxs []*TrxEntry) [][]*TrxEntry
type ReplyEvaluator ¶
type ReplyEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*ReplyEvaluator) Apply ¶
func (ev *ReplyEvaluator) Apply()
type SingleTrxApplier ¶ added in v1.0.2
type SingleTrxApplier func(iservices.IDatabasePatch, *TrxEntry, uint64)
type StakeEvaluator ¶ added in v1.0.2
type StakeEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*StakeEvaluator) Apply ¶ added in v1.0.2
func (ev *StakeEvaluator) Apply()
type TaposChecker ¶ added in v1.0.2
type TaposChecker struct {
// contains filtered or unexported fields
}
func NewTaposChecker ¶ added in v1.0.2
func NewTaposChecker(db iservices.IDatabaseRW, logger *logrus.Logger, lastBlock uint64) *TaposChecker
NewTaposChecker creates an instance of TaposChecker
func (*TaposChecker) BlockApplied ¶ added in v1.0.2
func (c *TaposChecker) BlockApplied(b *prototype.SignedBlock)
BlockApplied *MUST* be called *AFTER* a block was successfully applied.
func (*TaposChecker) BlockCommitted ¶ added in v1.0.2
func (c *TaposChecker) BlockCommitted(blockNum uint64)
BlockCommitted *MUST* be called *AFTER* a block was successfully committed.
func (*TaposChecker) BlockReverted ¶ added in v1.0.2
func (c *TaposChecker) BlockReverted(blockNum uint64)
BlockReverted *MUST* be called *AFTER* a block was successfully reverted.
func (*TaposChecker) Check ¶ added in v1.0.2
func (c *TaposChecker) Check(trx *prototype.Transaction) error
Check checks if given transaction's tapos data is valid.
type TransferEvaluator ¶
type TransferEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*TransferEvaluator) Apply ¶
func (ev *TransferEvaluator) Apply()
type TransferToVestEvaluator ¶ added in v1.0.2
type TransferToVestEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*TransferToVestEvaluator) Apply ¶ added in v1.0.2
func (ev *TransferToVestEvaluator) Apply()
type TrxCallback ¶ added in v1.0.2
type TrxCallback func(result *prototype.TransactionWrapperWithInfo)
TrxCallback is the type of callback function reporting transaction process results.
type TrxContext ¶ added in v1.0.2
type TrxContext struct { vminjector.Injector DynamicGlobalPropsRW Wrapper *prototype.TransactionWrapperWithInfo // contains filtered or unexported fields }
func NewTrxContext ¶ added in v1.0.2
func NewTrxContext(wrapper *prototype.TransactionWrapperWithInfo, db iservices.IDatabaseRW, signer string, control *TrxPool, stateChangeCtx *blocklog.StateChangeContext) *TrxContext
func (*TrxContext) CheckNet ¶ added in v1.0.2
func (p *TrxContext) CheckNet(db iservices.IDatabaseRW, sizeInBytes uint64)
func (*TrxContext) ContractABI ¶ added in v1.0.2
func (p *TrxContext) ContractABI(owner, contract string) string
func (*TrxContext) ContractCall ¶ added in v1.0.2
func (*TrxContext) CurrentRecordID ¶ added in v1.0.8
func (p *TrxContext) CurrentRecordID() (rid uint64)
func (*TrxContext) Database ¶ added in v1.0.2
func (p *TrxContext) Database() iservices.IDatabaseRW
func (*TrxContext) DeductAllCpu ¶ added in v1.0.2
func (p *TrxContext) DeductAllCpu(db iservices.IDatabaseRW)
func (*TrxContext) DeductAllNet ¶ added in v1.0.2
func (p *TrxContext) DeductAllNet(db iservices.IDatabaseRW)
func (*TrxContext) DeductStamina ¶ added in v1.0.2
func (p *TrxContext) DeductStamina(caller string, spent uint64)
func (*TrxContext) DiscardAccountCache ¶ added in v1.0.2
func (p *TrxContext) DiscardAccountCache(name string)
func (*TrxContext) Error ¶ added in v1.0.2
func (p *TrxContext) Error(code uint32, msg string)
func (*TrxContext) Finalize ¶ added in v1.0.2
func (p *TrxContext) Finalize()
func (*TrxContext) GetBlockProducers ¶ added in v1.0.2
func (p *TrxContext) GetBlockProducers() (names []string)
func (*TrxContext) GetCpuUse ¶ added in v1.0.2
func (p *TrxContext) GetCpuUse() uint64
func (*TrxContext) GetNetUse ¶ added in v1.0.2
func (p *TrxContext) GetNetUse() uint64
func (*TrxContext) GetVmRemainCpuStamina ¶ added in v1.0.2
func (p *TrxContext) GetVmRemainCpuStamina(name string) uint64
func (*TrxContext) GlobalProp ¶ added in v1.0.2
func (p *TrxContext) GlobalProp() iservices.IGlobalPropRW
func (*TrxContext) HardFork ¶ added in v1.0.2
func (p *TrxContext) HardFork() uint64
func (*TrxContext) HasGasFee ¶ added in v1.0.2
func (p *TrxContext) HasGasFee() bool
func (*TrxContext) Log ¶ added in v1.0.2
func (p *TrxContext) Log(msg string)
func (*TrxContext) Logger ¶ added in v1.0.2
func (p *TrxContext) Logger() *logrus.Logger
func (*TrxContext) NewRecordID ¶ added in v1.0.8
func (p *TrxContext) NewRecordID() (rid uint64)
func (*TrxContext) RecordOperationStaminaFee ¶ added in v1.0.2
func (p *TrxContext) RecordOperationStaminaFee()
func (*TrxContext) RecordStaminaFee ¶ added in v1.0.2
func (p *TrxContext) RecordStaminaFee(caller string, spent uint64)
func (*TrxContext) RequireAuth ¶ added in v1.0.2
func (p *TrxContext) RequireAuth(name string) (err error)
func (*TrxContext) SetStatus ¶ added in v1.0.2
func (p *TrxContext) SetStatus(s uint32)
func (*TrxContext) StartNextOp ¶ added in v1.0.2
func (p *TrxContext) StartNextOp(opIdx int, op *prototype.Operation)
func (*TrxContext) StateChangeContext ¶ added in v1.0.2
func (p *TrxContext) StateChangeContext() *blocklog.StateChangeContext
func (*TrxContext) TransferFromContractToContract ¶ added in v1.0.2
func (p *TrxContext) TransferFromContractToContract(fromContract, fromOwner, toContract, toOwner string, amount uint64)
func (*TrxContext) TransferFromContractToUser ¶ added in v1.0.2
func (p *TrxContext) TransferFromContractToUser(contract, owner, to string, amount uint64)
vm transfer just modify db data
func (*TrxContext) TransferFromContractToUserVest ¶ added in v1.0.4
func (p *TrxContext) TransferFromContractToUserVest(contract, owner, to string, amount uint64)
func (*TrxContext) TransferFromUserToContract ¶ added in v1.0.2
func (p *TrxContext) TransferFromUserToContract(from, contract, owner string, amount uint64)
func (*TrxContext) VMInjector ¶ added in v1.0.2
func (p *TrxContext) VMInjector() vminjector.Injector
func (*TrxContext) VmCache ¶ added in v1.0.2
func (p *TrxContext) VmCache() *vmcache.VmCache
type TrxEntry ¶ added in v1.0.2
type TrxEntry struct {
// contains filtered or unexported fields
}
TrxEntry is a wrapper of a transaction with extra information.
func NewTrxMgrEntry ¶ added in v1.0.2
func NewTrxMgrEntry(chainId prototype.ChainId, trx *prototype.SignedTransaction, callback TrxCallback) *TrxEntry
NewTrxMgrEntry creates an instance of TrxEntry.
func (*TrxEntry) CheckExpiration ¶ added in v1.0.2
CheckExpiration checks if the transaction is valid based on its expiration.
func (*TrxEntry) CheckInBlockTrxs ¶ added in v1.0.2
func (e *TrxEntry) CheckInBlockTrxs(checker *InBlockTrxChecker) error
CheckInBlockTrxs checks if the transaction is a duplicate of any old transaction.
func (*TrxEntry) CheckSignerKey ¶ added in v1.0.2
func (e *TrxEntry) CheckSignerKey(fetcher *AuthFetcher) error
CheckSignerKey checks if the transaction is signed by correct public key.
func (*TrxEntry) CheckTapos ¶ added in v1.0.2
func (e *TrxEntry) CheckTapos(checker *TaposChecker) error
CheckTapos checks if the transaction is valid based on its tapos information.
func (*TrxEntry) Deliver ¶ added in v1.0.2
func (e *TrxEntry) Deliver()
Deliver calls entry's callback function.
func (*TrxEntry) GetTrxResult ¶ added in v1.0.2
func (e *TrxEntry) GetTrxResult() *prototype.TransactionWrapperWithInfo
func (*TrxEntry) GetTrxSigner ¶ added in v1.0.2
func (*TrxEntry) GetTrxSigningKey ¶ added in v1.0.2
func (e *TrxEntry) GetTrxSigningKey() *prototype.PublicKeyType
func (*TrxEntry) GetTrxSize ¶ added in v1.0.2
type TrxMgr ¶ added in v1.0.2
type TrxMgr struct {
// contains filtered or unexported fields
}
The transaction manager.
func NewTrxMgr ¶ added in v1.0.2
func NewTrxMgr(chainId prototype.ChainId, db iservices.IDatabaseRW, logger *logrus.Logger, lastBlock, commitBlock uint64) *TrxMgr
NewTrxMgr creates an instance of TrxMgr.
func (*TrxMgr) AddTrx ¶ added in v1.0.2
func (m *TrxMgr) AddTrx(trx *prototype.SignedTransaction, callback TrxCallback) error
AddTrx processes an incoming transaction. AddTrx returns nil if the incoming transaction is accepted, otherwise an error is returned. If a non-nil callback is given, it will be called once asynchronously with the final process result.
func (*TrxMgr) BlockApplied ¶ added in v1.0.2
func (m *TrxMgr) BlockApplied(b *prototype.SignedBlock)
BlockApplied *MUST* be called *AFTER* a block was successfully applied.
func (*TrxMgr) BlockCommitted ¶ added in v1.0.2
BlockCommitted *MUST* be called *AFTER* a block was successfully committed.
func (*TrxMgr) BlockReverted ¶ added in v1.0.2
BlockReverted *MUST* be called *AFTER* a block was successfully reverted.
func (*TrxMgr) CheckBlockTrxs ¶ added in v1.0.2
func (m *TrxMgr) CheckBlockTrxs(b *prototype.SignedBlock) (entries []*TrxEntry, err error)
CheckBlockTrxs checks if transactions of a block are valid. If everything is ok, CheckBlockTrxs returns a TrxEntry slice for transactions and nil error, otherwise, a nil slice and an error is returned.
func (*TrxMgr) DiscardAccountCache ¶ added in v1.0.2
func (*TrxMgr) FetchTrx ¶ added in v1.0.2
FetchTrx fetches a batch of transactions from waiting pool. Block producer should call FetchTrx to collect transactions of new blocks.
func (*TrxMgr) ReturnTrx ¶ added in v1.0.2
ReturnTrx notifies that some previously fetched transactions can't be packed into a block due to errors. Block producer should call ReturnTrx for transactions that failed being applied.
func (*TrxMgr) WaitingCount ¶ added in v1.0.2
WaitingCount returns number of transactions that are waiting to be packed to blocks.
type TrxPool ¶ added in v1.0.2
func NewController ¶
service constructor
func (*TrxPool) CalculateUserMaxStamina ¶ added in v1.0.2
func (c *TrxPool) CalculateUserMaxStamina(db iservices.IDatabaseRW, name string) uint64
func (*TrxPool) CheckNetForRPC ¶ added in v1.0.2
func (*TrxPool) DiscardAccountCache ¶ added in v1.0.2
func (*TrxPool) EstimateStamina ¶ added in v1.0.2
func (c *TrxPool) EstimateStamina(trx *prototype.SignedTransaction) (invoice *prototype.TransactionReceiptWithInfo)
func (*TrxPool) GenerateAndApplyBlock ¶ added in v1.0.2
func (*TrxPool) GetBlockProducerTopN ¶ added in v1.0.2
func (c *TrxPool) GetBlockProducerTopN(n uint32) ([]string, []*prototype.PublicKeyType)
func (*TrxPool) GetFinalizedNum ¶ added in v1.0.2
func (*TrxPool) GetHeadBlockNum ¶ added in v1.0.2
func (*TrxPool) GetProps ¶ added in v1.0.2
func (c *TrxPool) GetProps() *prototype.DynamicProperties
func (*TrxPool) GetShuffledBpList ¶ added in v1.0.2
func (c *TrxPool) GetShuffledBpList() ([]string, []*prototype.PublicKeyType, uint64)
func (*TrxPool) HeadBlockTime ¶ added in v1.0.2
func (c *TrxPool) HeadBlockTime() *prototype.TimePointSec
func (*TrxPool) ModifyProps ¶ added in v1.0.2
func (c *TrxPool) ModifyProps(modifier func(oldProps *prototype.DynamicProperties))
func (*TrxPool) PayGas ¶ added in v1.0.2
func (c *TrxPool) PayGas(db iservices.IDatabaseRW, trxContext *TrxContext)
func (*TrxPool) PreShuffle ¶ added in v1.0.2
func (*TrxPool) PushTrxToPending ¶ added in v1.0.2
func (c *TrxPool) PushTrxToPending(trx *prototype.SignedTransaction) (err error)
func (*TrxPool) SetShuffle ¶ added in v1.0.2
func (c *TrxPool) SetShuffle(s common.ShuffleFunc)
func (*TrxPool) SetShuffledBpList ¶ added in v1.0.2
func (c *TrxPool) SetShuffledBpList(names []string, keys []*prototype.PublicKeyType, seq uint64)
func (*TrxPool) ShareTicketBonus ¶ added in v1.0.2
func (*TrxPool) ValidateAddress ¶ added in v1.0.2
func (c *TrxPool) ValidateAddress(name string, pubKey *prototype.PublicKeyType) bool
type UnDelegateVestEvaluator ¶ added in v1.0.8
type UnDelegateVestEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*UnDelegateVestEvaluator) Apply ¶ added in v1.0.8
func (ev *UnDelegateVestEvaluator) Apply()
type UnStakeEvaluator ¶ added in v1.0.2
type UnStakeEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*UnStakeEvaluator) Apply ¶ added in v1.0.2
func (ev *UnStakeEvaluator) Apply()
type VoteByTicketEvaluator ¶ added in v1.0.2
type VoteByTicketEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*VoteByTicketEvaluator) Apply ¶ added in v1.0.2
func (ev *VoteByTicketEvaluator) Apply()
type VoteEvaluator ¶
type VoteEvaluator struct { BaseEvaluator BaseDelegate // contains filtered or unexported fields }
func (*VoteEvaluator) Apply ¶
func (ev *VoteEvaluator) Apply()