coverage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveCoverageTracerResults

func RemoveCoverageTracerResults(messageResults *types.MessageResults)

RemoveCoverageTracerResults removes CoverageMaps stored by a CoverageTracer from message results.

Types

type CoverageMaps

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

CoverageMaps represents a data structure used to identify instruction execution coverage of various smart contracts across a transaction or multiple transactions.

func GetCoverageTracerResults

func GetCoverageTracerResults(messageResults *types.MessageResults) *CoverageMaps

GetCoverageTracerResults obtains CoverageMaps stored by a CoverageTracer from message results. This is nil if no CoverageMaps were recorded by a tracer (e.g. CoverageTracer was not attached during this message execution).

func NewCoverageMaps

func NewCoverageMaps() *CoverageMaps

NewCoverageMaps initializes a new CoverageMaps object.

func (*CoverageMaps) Equals

func (a *CoverageMaps) Equals(b *CoverageMaps) bool

Equals checks whether two coverage maps are the same. Equality is determined if the keys and values are all the same.

func (*CoverageMaps) Reset

func (cm *CoverageMaps) Reset()

Reset clears the coverage state for the CoverageMaps.

func (*CoverageMaps) SetCoveredAt

func (cm *CoverageMaps) SetCoveredAt(codeAddress common.Address, codeHash common.Hash, init bool, codeSize int, pc uint64) (bool, error)

SetCoveredAt sets the coverage state of a given program counter location within a codeCoverageData.

func (*CoverageMaps) Update

func (cm *CoverageMaps) Update(coverageMaps *CoverageMaps) (bool, error)

Update updates the current coverage maps with the provided ones. It returns a boolean indicating whether new coverage was achieved, or an error if one was encountered.

type CoverageTracer

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

CoverageTracer implements vm.EVMLogger to collect information such as coverage maps for fuzzing campaigns from EVM execution traces.

func NewCoverageTracer

func NewCoverageTracer() *CoverageTracer

NewCoverageTracer returns a new CoverageTracer.

func (*CoverageTracer) CaptureEnd

func (t *CoverageTracer) CaptureEnd(output []byte, gasUsed uint64, err error)

CaptureEnd is called after a call to finalize tracing completes for the top of a call frame, as defined by vm.EVMLogger.

func (*CoverageTracer) CaptureEnter

func (t *CoverageTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)

CaptureEnter is called upon entering of the call frame, as defined by vm.EVMLogger.

func (*CoverageTracer) CaptureExit

func (t *CoverageTracer) CaptureExit(output []byte, gasUsed uint64, err error)

CaptureExit is called upon exiting of the call frame, as defined by vm.EVMLogger.

func (*CoverageTracer) CaptureFault

func (t *CoverageTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error)

CaptureFault records an execution fault, as defined by vm.EVMLogger.

func (*CoverageTracer) CaptureStart

func (t *CoverageTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)

CaptureStart initializes the tracing operation for the top of a call frame, as defined by vm.EVMLogger.

func (*CoverageTracer) CaptureState

func (t *CoverageTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, vmErr error)

CaptureState records data from an EVM state update, as defined by vm.EVMLogger.

func (*CoverageTracer) CaptureTxEnd

func (t *CoverageTracer) CaptureTxEnd(restGas uint64)

CaptureTxEnd is called upon the end of transaction execution, as defined by vm.EVMLogger.

func (*CoverageTracer) CaptureTxEndSetAdditionalResults

func (t *CoverageTracer) CaptureTxEndSetAdditionalResults(results *types.MessageResults)

CaptureTxEndSetAdditionalResults can be used to set additional results captured from execution tracing. If this tracer is used during transaction execution (block creation), the results can later be queried from the block. This method will only be called on the added tracer if it implements the extended TestChainTracer interface.

func (*CoverageTracer) CaptureTxStart

func (t *CoverageTracer) CaptureTxStart(gasLimit uint64)

CaptureTxStart is called upon the start of transaction execution, as defined by vm.EVMLogger.

Jump to

Keyboard shortcuts

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