verify

package
v0.0.0-...-15eb78e Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogicSigSanityCheck

func LogicSigSanityCheck(txn *transactions.SignedTxn, groupIndex int, groupCtx *GroupContext) error

LogicSigSanityCheck checks that the signature is valid and that the program is basically well formed. It does not evaluate the logic.

func LogicSigSanityCheckBatchVerify

func LogicSigSanityCheckBatchVerify(txn *transactions.SignedTxn, groupIndex int, groupCtx *GroupContext, batchVerifier *crypto.BatchVerifier) error

LogicSigSanityCheckBatchVerify checks that the signature is valid and that the program is basically well formed. It does not evaluate the logic. it is the caller responsibility to call batchVerifier.verify()

func PaysetGroups

func PaysetGroups(ctx context.Context, payset [][]transactions.SignedTxn, blkHeader bookkeeping.BlockHeader, verificationPool execpool.BacklogPool, cache VerifiedTransactionCache) (err error)

PaysetGroups verifies that the payset have a good signature and that the underlying transactions are properly constructed. Note that this does not check whether a payset is valid against the ledger: a PaysetGroups may be well-formed, but a payset might contain an overspend.

This version of verify is performing the verification over the provided execution pool.

PaysetGroups은 해당 payset이 올바른 서명을 가지고 있고 적절하게 구성된 트랜잭션인지 검증한다.
이 함수는 원장에 대해 이 payset이 유효한지 검증하지 않는다. 이 payset은 well-formed됐을 것이다(다른 부분에서 검증하나보다!!!)
따라서 이 검증은 execution pool에 관한것이다!!!!

func Txn

func Txn(s *transactions.SignedTxn, txnIdx int, groupCtx *GroupContext) error

Txn verifies a SignedTxn as being signed and having no obviously inconsistent data. Block-assembly time checks of LogicSig and accounting rules may still block the txn.

Txn은 서명된 트랜잭션이 올바르게 서명되었고 잘못된 데이터를 가지고 있지 않은지 증명한다. Block-assembly time은 LogicSig를 검사하고 accounting rules은 트랜잭션을 차단할 수 있다.

func TxnBatchVerify

func TxnBatchVerify(s *transactions.SignedTxn, txnIdx int, groupCtx *GroupContext, verifier *crypto.BatchVerifier) error

TxnBatchVerify verifies a SignedTxn having no obviously inconsistent data. Block-assembly time checks of LogicSig and accounting rules may still block the txn. it is the caller responsibility to call batchVerifier.verify()

Types

type GroupContext

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

GroupContext is the set of parameters external to a transaction which stateless checks are performed against.

For efficient caching, these parameters should either be constant or change slowly over time.

Group data are omitted because they are committed to in the transaction and its ID.

GroupContext는 statelss 검사가 수행되는 트랜잭션 외부의 매개 변수 집합이다.
효율적인 캐싱을 위해 이러한 매개변수는 상수이거나 천천히 변경되어야 한다
트랜잭션 그룹의 실제 데이터를 트랜잭션 객체와 트랜잭션 아이디에 포함되어있기 때문에 생략한다.

func PrepareGroupContext

func PrepareGroupContext(group []transactions.SignedTxn, contextHdr bookkeeping.BlockHeader) (*GroupContext, error)

PrepareGroupContext prepares a verification group parameter object for a given transaction group.

func TxnGroup

func TxnGroup(stxs []transactions.SignedTxn, contextHdr bookkeeping.BlockHeader, cache VerifiedTransactionCache) (groupCtx *GroupContext, err error)

TxnGroup verifies a []SignedTxn as being signed and having no obviously inconsistent data.

서명된 트랜잭션 그룹을 검증한다.

func TxnGroupBatchVerify

func TxnGroupBatchVerify(stxs []transactions.SignedTxn, contextHdr bookkeeping.BlockHeader, cache VerifiedTransactionCache, verifier *crypto.BatchVerifier) (groupCtx *GroupContext, err error)

TxnGroupBatchVerify verifies a []SignedTxn having no obviously inconsistent data. it is the caller responsibility to call batchVerifier.verify()

트랜잭션 그룹을 검증한다.

func (*GroupContext) Equal

func (g *GroupContext) Equal(other *GroupContext) bool

Equal compares two group contexts to see if they would represent the same verification context for a given transaction.

type VerifiedTransactionCache

type VerifiedTransactionCache interface {
	// Add adds a given transaction group and it's associated group context to the cache. If any of the transactions already appear
	// in the cache, the new entry overrides the old one.
	// 서명된 트랜잭션 정보를 캐시에 저장한다.
	Add(txgroup []transactions.SignedTxn, groupCtx *GroupContext)

	// AddPayset works in a similar way to Add, but is intended for adding an array of transaction groups, along with their corresponding contexts.
	// 서명된 트랜잭션 배열 정보를 캐시에 저장한다.
	AddPayset(txgroup [][]transactions.SignedTxn, groupCtxs []*GroupContext) error

	// GetUnverifiedTranscationGroups compares the provided payset against the currently cached transactions and figure which transaction groups aren't fully cached.
	// GetUnverifiedTranscationGroups는 서명된 트랜잭션 세트를 현재 캐시된 트랜잭션과 비교하고 완전히 캐시되지 않은 트랜잭션 그룹을 파악합니다.
	GetUnverifiedTranscationGroups(payset [][]transactions.SignedTxn, CurrSpecAddrs transactions.SpecialAddresses, CurrProto protocol.ConsensusVersion) [][]transactions.SignedTxn

	// UpdatePinned replaces the pinned entries with the one provided in the pinnedTxns map. This is typically expected to be a subset of the
	// already-pinned transactions. If a transaction is not currently pinned, and it's can't be found in the cache, a errMissingPinnedEntry error would be generated.
	// UpdatePinned는 고정된 항목을 pinnedTxns 맵에 제공된 항목으로 바꿉니다(고정된 캐시에 있는 데이터를 인풋 트랜잭션집합으로 변경하는 것 같다)
	UpdatePinned(pinnedTxns map[transactions.Txid]transactions.SignedTxn) error

	// Pin function would mark the given transaction group as pinned.
	// 인풋 트랜잭션그룹을 pin 캐시에 넣는다
	Pin(txgroup []transactions.SignedTxn) error
}

VerifiedTransactionCache provides a cached store of recently verified transactions. The cache is desiged two have two separate "levels". On the bottom tier, the cache would be using a cyclic buffer, where old transactions would end up overridden by new ones. In order to support transactions that goes into the transaction pool, we have a higher tier of pinned cache. Pinned transactions would not be cycled-away by new incoming transactions, and would only get eliminated by updates to the transaction pool, which would inform the cache of updates to the pinned items.

VerifiedTransactionCache는 최근 검증된 트랜잭션들을 저장하는 캐시다.
캐시는 두개의 레벨이 있다.
아래쪽 부분의 캐시는 순환버퍼를 사용해서 오래된 트랜잭션은 새로운 트랜잭션에게 덮어진다.
트랜잭션풀로 들어가는 트랜잭션들을 지원하기 위해 윗 부분의 캐시는 고정되어있다.
고정 캐시에 있는 트랜잭션은 트랜잭션풀로 이동했다는 업데이트가 있을 때만 캐시에서 제거된다.

func GetMockedCache

func GetMockedCache(alwaysVerified bool) VerifiedTransactionCache

GetMockedCache returns a mocked transaction cache implementation

func MakeVerifiedTransactionCache

func MakeVerifiedTransactionCache(cacheSize int) VerifiedTransactionCache

MakeVerifiedTransactionCache creates an instance of verifiedTransactionCache and returns it.

type VerifiedTxnCacheError

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

VerifiedTxnCacheError helps to identify the errors of a cache error and diffrentiate these from a general verification errors.

VerifiedTxnCacheError는 캐시 오류의 오류를 식별하고 일반 확인 오류와 구별하는 데 도움이 된다.

func (*VerifiedTxnCacheError) Error

func (e *VerifiedTxnCacheError) Error() string

Error formats the underlying error message

func (*VerifiedTxnCacheError) Unwrap

func (e *VerifiedTxnCacheError) Unwrap() error

Unwrap provides access to the underlying error

Jump to

Keyboard shortcuts

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