Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplayBlockExecution ¶
func ReplayBlockExecution( chainID flow.ChainID, rootAddr flow.Address, storage types.BackendStorage, blockSnapshot types.BlockSnapshot, tracer *gethTracer.Tracer, transactionEvents []events.TransactionEventPayload, blockEvent *events.BlockEventPayload, validateResults bool, ) ([]*types.Result, error)
ReplayBlockExecution re-executes transactions of a block using the events emitted when transactions where executed. it updates the state of the given ledger and uses the trace
func ValidateResult ¶
func ValidateResult( res *types.Result, txEvent *events.TransactionEventPayload, ) error
Types ¶
type Replayer ¶
type Replayer struct {
// contains filtered or unexported fields
}
Replayer consumes EVM transaction and block events, re-execute EVM transaction and follows EVM chain. this allows using different tracers and storage solutions.
func NewReplayer ¶
func NewReplayer( chainID flow.ChainID, rootAddr flow.Address, sp types.StorageProvider, bp types.BlockSnapshotProvider, logger zerolog.Logger, tracer *gethTracers.Tracer, validateResults bool, ) *Replayer
NewReplayer constructs a new Replayer
func (*Replayer) ReplayBlock ¶
func (cr *Replayer) ReplayBlock( transactionEvents []events.TransactionEventPayload, blockEvent *events.BlockEventPayload, ) (types.ReplayResultCollector, error)
ReplayBlock replays the execution of the transactions of an EVM block
func (*Replayer) ReplayBlockEvents ¶
func (cr *Replayer) ReplayBlockEvents( transactionEvents []events.TransactionEventPayload, blockEvent *events.BlockEventPayload, ) (types.ReplayResultCollector, []*types.Result, error)
ReplayBlockEvents replays the execution of the transactions of an EVM block using the provided transactionEvents and blockEvents, which include all the context data for re-executing the transactions, and returns the replay result and the result of each transaction. the replay result contains the register updates, and the result of each transaction contains the execution result of each transaction, which is useful for recontstructing the EVM block proposal. this method can be called concurrently if underlying storage tracer and block snapshot provider support concurrency.
Warning! the list of transaction events has to be sorted based on their execution, sometimes the access node might return events out of order it needs to be sorted by txIndex and eventIndex respectively.