Documentation ¶
Index ¶
- Variables
- func AcceptableCompactCertWeight(votersHdr bookkeeping.BlockHeader, firstValid basics.Round, ...) uint64
- func CompactCertParams(votersHdr bookkeeping.BlockHeader, hdr bookkeeping.BlockHeader) (res compactcert.Params, err error)
- func Eval(ctx context.Context, l LedgerForEvaluator, blk bookkeeping.Block, ...) (ledgercore.StateDelta, error)
- func MakeDebugBalances(l LedgerForCowBase, round basics.Round, proto protocol.ConsensusVersion, ...) apply.Balances
- type BlockEvaluator
- func (eval *BlockEvaluator) GenerateBlock() (*ledgercore.ValidatedBlock, error)
- func (eval *BlockEvaluator) PaySetSize() int
- func (eval *BlockEvaluator) ProcessBlockForIndexer(block *bookkeeping.Block) (ledgercore.StateDelta, []transactions.SignedTxnInBlock, error)
- func (eval *BlockEvaluator) ResetTxnBytes()
- func (eval *BlockEvaluator) Round() basics.Round
- func (eval *BlockEvaluator) TestTransaction(txn transactions.SignedTxn, cow *roundCowState) error
- func (eval *BlockEvaluator) TestTransactionGroup(txgroup []transactions.SignedTxn) error
- func (eval *BlockEvaluator) TestingTxnCounter() uint64
- func (eval *BlockEvaluator) Transaction(txn transactions.SignedTxn, ad transactions.ApplyData) error
- func (eval *BlockEvaluator) TransactionGroup(txads []transactions.SignedTxnWithAD) error
- type EvaluatorOptions
- type LedgerForCowBase
- type LedgerForEvaluator
Constants ¶
This section is empty.
Variables ¶
var ErrRoundZero = errors.New("cannot start evaluator for round 0")
ErrRoundZero is self-explanatory
Functions ¶
func AcceptableCompactCertWeight ¶
func AcceptableCompactCertWeight(votersHdr bookkeeping.BlockHeader, firstValid basics.Round, logger logging.Logger) uint64
AcceptableCompactCertWeight computes the acceptable signed weight of a compact cert if it were to appear in a transaction with a particular firstValid round. Earlier rounds require a smaller cert. votersHdr specifies the block that contains the Merkle commitment of the voters for this compact cert (and thus the compact cert is for votersHdr.Round() + CompactCertRounds).
logger must not be nil; use at least logging.Base()
AcceptableCompactCertWeight는 특정 firstValid 라운드가 있는 트랜잭션에 나타날 경우 컴팩트 인증서의 허용 가능한 서명 가중치를 계산합니다. 이전 라운드에는 더 작은 인증서가 필요합니다. VotersHdr은 이 컴팩트 인증서에 대한 투표자들의 Merkle 약속을 포함하는 블록을 지정합니다(따라서 컴팩트 인증서는 votersHdr.Round() + CompactCertRounds에 대한 것입니다). 로거는 nil이 아니어야 합니다. 최소한 logging.Base()를 사용하십시오.
func CompactCertParams ¶
func CompactCertParams(votersHdr bookkeeping.BlockHeader, hdr bookkeeping.BlockHeader) (res compactcert.Params, err error)
CompactCertParams computes the parameters for building or verifying a compact cert for block hdr, using voters from block votersHdr.
CompactCertParams는 블록 votersHdr의 투권자를 사용하여 블록 헤더에 대한 컴팩트 인증서를 빌드하거나 확인하기 위한 매개변수를 계산합니다
func Eval ¶
func Eval(ctx context.Context, l LedgerForEvaluator, blk bookkeeping.Block, validate bool, txcache verify.VerifiedTransactionCache, executionPool execpool.BacklogPool, certVoteAddresses []basics.Address) (ledgercore.StateDelta, error)
Eval is the main evaluator entrypoint (in addition to StartEvaluator) used by Ledger.Validate() Ledger.AddBlock() Ledger.trackerEvalVerified()(accountUpdates.loadFromDisk())
Validate: Eval(ctx, l, blk, true, txcache, executionPool) AddBlock: Eval(context.Background(), l, blk, false, txcache, nil) tracker: Eval(context.Background(), l, blk, false, txcache, nil)
evaluator의 메인 진입점이다.
func MakeDebugBalances ¶
func MakeDebugBalances(l LedgerForCowBase, round basics.Round, proto protocol.ConsensusVersion, prevTimestamp int64) apply.Balances
MakeDebugBalances creates a ledger suitable for dryrun and debugger
Types ¶
type BlockEvaluator ¶
type BlockEvaluator struct {
// contains filtered or unexported fields
}
BlockEvaluator represents an in-progress evaluation of a block against the ledger.
BlockEvaluator는 원장에 등록할 블록을 검증하는데 사용하는 객체이다.
func StartEvaluator ¶
func StartEvaluator(l LedgerForEvaluator, hdr bookkeeping.BlockHeader, evalOpts EvaluatorOptions) (*BlockEvaluator, error)
StartEvaluator creates a BlockEvaluator, given a ledger and a block header of the block that the caller is planning to evaluate. If the length of the payset being evaluated is known in advance, a paysetHint >= 0 can be passed, avoiding unnecessary payset slice growth.
검증하길 원하는 블록의 블록헤더와 주어진 원장과 대한 BlockEvaluator를 생성한다.
func (*BlockEvaluator) GenerateBlock ¶
func (eval *BlockEvaluator) GenerateBlock() (*ledgercore.ValidatedBlock, error)
GenerateBlock produces a complete block from the BlockEvaluator. This is used during proposal to get an actual block that will be proposed, after feeding in tentative transactions into this block evaluator.
After a call to GenerateBlock, the BlockEvaluator can still be used to accept transactions. However, to guard against reuse, subsequent calls to GenerateBlock on the same BlockEvaluator will fail.
GenerateBlock은 BlockEvaluator에서 완전한 블록을 생성합니다. 이것은 proposal될 실제 블록을 얻기위해 proposal 과정에서 사용된다. GenerateBlock을 호출한 후에도 BlockEvaluator를 사용하여 트랜잭션을 수락할 수 있습니다. 그러나 재사용을 방지하기 위해 동일한 BlockEvaluator에서 GenerateBlock은 한번만 호출할 수 있다.
func (*BlockEvaluator) PaySetSize ¶
func (eval *BlockEvaluator) PaySetSize() int
PaySetSize returns the number of top-level transactions that have been added to the block evaluator so far.
func (*BlockEvaluator) ProcessBlockForIndexer ¶
func (eval *BlockEvaluator) ProcessBlockForIndexer(block *bookkeeping.Block) (ledgercore.StateDelta, []transactions.SignedTxnInBlock, error)
ProcessBlockForIndexer ..
func (*BlockEvaluator) ResetTxnBytes ¶
func (eval *BlockEvaluator) ResetTxnBytes()
ResetTxnBytes resets the number of bytes tracked by the BlockEvaluator to zero. This is a specialized operation used by the transaction pool to simulate the effect of putting pending transactions in multiple blocks.
func (*BlockEvaluator) Round ¶
func (eval *BlockEvaluator) Round() basics.Round
Round returns the round number of the block being evaluated by the BlockEvaluator.
func (*BlockEvaluator) TestTransaction ¶
func (eval *BlockEvaluator) TestTransaction(txn transactions.SignedTxn, cow *roundCowState) error
TestTransaction performs basic duplicate detection and well-formedness checks on a single transaction, but does not actually add the transaction to the block evaluator, or modify the block evaluator state in any other visible way.
func (*BlockEvaluator) TestTransactionGroup ¶
func (eval *BlockEvaluator) TestTransactionGroup(txgroup []transactions.SignedTxn) error
TestTransactionGroup performs basic duplicate detection and well-formedness checks on a transaction group, but does not actually add the transactions to the block evaluator, or modify the block evaluator state in any other visible way.
func (*BlockEvaluator) TestingTxnCounter ¶
func (eval *BlockEvaluator) TestingTxnCounter() uint64
TestingTxnCounter - the method returns the current evaluator transaction counter. The method is used for testing purposes only.
func (*BlockEvaluator) Transaction ¶
func (eval *BlockEvaluator) Transaction(txn transactions.SignedTxn, ad transactions.ApplyData) error
Transaction tentatively adds a new transaction as part of this block evaluation. If the transaction cannot be added to the block without violating some constraints, an error is returned and the block evaluator state is unchanged.
func (*BlockEvaluator) TransactionGroup ¶
func (eval *BlockEvaluator) TransactionGroup(txads []transactions.SignedTxnWithAD) error
TransactionGroup tentatively adds a new transaction group as part of this block evaluation. If the transaction group cannot be added to the block without violating some constraints, an error is returned and the block evaluator state is unchanged.
type EvaluatorOptions ¶
type EvaluatorOptions struct { PaysetHint int Validate bool Generate bool MaxTxnBytesPerBlock int ProtoParams *config.ConsensusParams }
EvaluatorOptions defines the evaluator creation options
type LedgerForCowBase ¶
type LedgerForCowBase interface { BlockHdr(basics.Round) (bookkeeping.BlockHeader, error) CheckDup(config.ConsensusParams, basics.Round, basics.Round, basics.Round, transactions.Txid, ledgercore.Txlease) error LookupWithoutRewards(basics.Round, basics.Address) (basics.AccountData, basics.Round, error) GetCreatorForRound(basics.Round, basics.CreatableIndex, basics.CreatableType) (basics.Address, bool, error) }
LedgerForCowBase represents subset of Ledger functionality needed for cow business
LedgerForCowBase는 cow(copy on write) 비즈니스에 필요한 Ledger 기능의 하위 집합을 나타냅니다
type LedgerForEvaluator ¶
type LedgerForEvaluator interface { LedgerForCowBase GenesisHash() crypto.Digest GenesisProto() config.ConsensusParams LatestTotals() (basics.Round, ledgercore.AccountTotals, error) CompactCertVoters(basics.Round) (*ledgercore.VotersForRound, error) GetLedgerRootDir() string }
LedgerForEvaluator defines the ledger interface needed by the evaluator.