Documentation ¶
Index ¶
- Constants
- func NewBlockContext(chainID flow.ChainID, height uint64, timestamp uint64, ...) (types.BlockContext, error)
- func ReconstructProposal(blockEvent *events.BlockEventPayload, results []*types.Result) *types.BlockProposal
- func UseBlockHashCorrection(chainID flow.ChainID, evmHeightOfCurrentBlock uint64, queriedEVMHeight uint64) (gethCommon.Hash, bool)
- type BasicProvider
- type Blocks
- type Meta
Constants ¶
const BlockStoreLatestBlockMetaKey = "LatestBlockMeta"
Variables ¶
This section is empty.
Functions ¶
func NewBlockContext ¶
func NewBlockContext( chainID flow.ChainID, height uint64, timestamp uint64, getHashByHeight func(uint64) gethCommon.Hash, prevRandao gethCommon.Hash, tracer *tracers.Tracer, ) (types.BlockContext, error)
NewBlockContext creates a new block context for the given chain ID and height. This is for use in offchain re-execution of transactions. It includes special casing for some historical block heights:
- On Mainnet and Testnet the block hash list was stuck in a loop of 256 block hashes until fixed. https://github.com/onflow/flow-go/issues/6552
- The coinbase address was different on testnet until https://github.com/onflow/flow-evm-gateway/pull/491.
func ReconstructProposal ¶
func ReconstructProposal( blockEvent *events.BlockEventPayload, results []*types.Result, ) *types.BlockProposal
func UseBlockHashCorrection ¶
func UseBlockHashCorrection(chainID flow.ChainID, evmHeightOfCurrentBlock uint64, queriedEVMHeight uint64) (gethCommon.Hash, bool)
UseBlockHashCorrection returns the block hash correction for the given chain ID, EVM height, and queried EVM height, and a boolean indicating whether the correction should be used.
Types ¶
type BasicProvider ¶
type BasicProvider struct {
// contains filtered or unexported fields
}
BasicProvider implements a ledger-backed basic block snapshot provider it assumes sequential progress on blocks and expects a a OnBlockReceived call before block execution and a follow up OnBlockExecuted call after block execution.
func NewBasicProvider ¶
func NewBasicProvider( chainID flow.ChainID, storage types.BackendStorage, rootAddr flow.Address, ) (*BasicProvider, error)
func (*BasicProvider) GetSnapshotAt ¶
func (p *BasicProvider) GetSnapshotAt(height uint64) ( types.BlockSnapshot, error, )
GetSnapshotAt returns a block snapshot at the given height Snapshot at a height is not available until `OnBlockReceived` is called for that height.
func (*BasicProvider) OnBlockExecuted ¶
func (p *BasicProvider) OnBlockExecuted( height uint64, resCol types.ReplayResultCollector, blockProposal *types.BlockProposal, ) error
OnBlockExecuted should be called after executing blocks.
func (*BasicProvider) OnBlockReceived ¶
func (p *BasicProvider) OnBlockReceived(blockEvent *events.BlockEventPayload) error
OnBlockReceived should be called before executing blocks.
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
Blocks facilitates access to the recent block hash values and also the latest executed block meta data
func NewBlocks ¶
func NewBlocks( chainID flow.ChainID, rootAddress flow.Address, storage types.BackendStorage, ) (*Blocks, error)
NewBlocks constructs a new blocks type
func (*Blocks) BlockContext ¶
func (b *Blocks) BlockContext() (types.BlockContext, error)
BlockContext constructs a block context for the latest block
func (*Blocks) BlockHash ¶
func (b *Blocks) BlockHash(height uint64) (gethCommon.Hash, error)
BlockHash returns the block hash for the given height
func (*Blocks) LatestBlock ¶
func (*Blocks) PushBlockHash ¶
func (b *Blocks) PushBlockHash( height uint64, hash gethCommon.Hash, ) error
PushBlockHash pushes a new block block hash into the storage
func (*Blocks) PushBlockMeta ¶
PushBlock pushes a new block into the storage
type Meta ¶
type Meta struct { Height uint64 Timestamp uint64 Random gethCommon.Hash }
Meta holds meta data about a block
func MetaFromEncoded ¶
MetaFromEncoded constructs a Meta from encoded data