Documentation ¶
Index ¶
- Variables
- func DecodeBlock(event cadence.Event) (*types.Block, error)
- func DecodeReceipt(event cadence.Event) (*gethTypes.Receipt, error)
- func DecodeTransaction(event cadence.Event) (*gethTypes.Transaction, error)
- func IsBlockExecutedEvent(event cadence.Event) bool
- func IsRecoverableError(err error) bool
- func IsTransactionExecutedEvent(event cadence.Event) bool
- type Engine
- type EngineStatus
- type RecoverableError
- type RestartableEngine
- type SequentialHeight
- type StorageReceipt
Constants ¶
This section is empty.
Variables ¶
var BlockExecutedEventType = (flow.EVMLocation{}).TypeID(nil, string(types.EventTypeBlockExecuted))
var (
ErrDisconnected = NewRecoverableError(errors.New("disconnected"))
)
var ErrInvalidHeight = errors.New("invalid height")
var TransactionExecutedEventType = (flow.EVMLocation{}).TypeID(nil, string(types.EventTypeTransactionExecuted))
Functions ¶
func DecodeBlock ¶
DecodeBlock takes a cadence event that contains executed block payload and decodes it into the Block type.
func DecodeReceipt ¶
DecodeReceipt takes a cadence event for transaction executed and decodes it into the receipt.
func DecodeTransaction ¶
func DecodeTransaction(event cadence.Event) (*gethTypes.Transaction, error)
DecodeTransaction takes a cadence event for transaction executed and decodes it into the transaction.
func IsBlockExecutedEvent ¶
IsBlockExecutedEvent checks whether event contains block executed data.
func IsRecoverableError ¶ added in v0.2.0
Types ¶
type Engine ¶
type Engine interface { // Run the engine with context, errors are not expected. Run(ctx context.Context) error // Stop the engine. Stop() // Done signals the engine was stopped. Done() <-chan struct{} // Ready signals the engine was started. Ready() <-chan struct{} }
Engine defines a processing unit
type EngineStatus ¶
type EngineStatus struct {
// contains filtered or unexported fields
}
func NewEngineStatus ¶
func NewEngineStatus() *EngineStatus
func (*EngineStatus) IsDone ¶
func (e *EngineStatus) IsDone() <-chan struct{}
func (*EngineStatus) IsReady ¶
func (e *EngineStatus) IsReady() <-chan struct{}
func (*EngineStatus) IsStopped ¶
func (e *EngineStatus) IsStopped() <-chan struct{}
func (*EngineStatus) MarkDone ¶
func (e *EngineStatus) MarkDone()
func (*EngineStatus) MarkReady ¶
func (e *EngineStatus) MarkReady()
func (*EngineStatus) MarkStopped ¶
func (e *EngineStatus) MarkStopped()
type RecoverableError ¶ added in v0.2.0
type RecoverableError struct {
// contains filtered or unexported fields
}
RecoverableError is used to signal any types of errors that if encountered could be retried again
func NewRecoverableError ¶ added in v0.2.0
func NewRecoverableError(err error) RecoverableError
func (RecoverableError) Error ¶ added in v0.2.0
func (r RecoverableError) Error() string
func (RecoverableError) Unwrap ¶ added in v0.2.0
func (r RecoverableError) Unwrap() error
type RestartableEngine ¶
type RestartableEngine struct {
// contains filtered or unexported fields
}
RestartableEngine is an engine wrapper that tries to restart the engine in case of starting errors.
The strategy of the restarts contains Fibonacci backoff time and limited number of retries that can be configured. Here are backoff values for different retries provided: 1s 1s 2s 3s 5s 8s 13s 21s 34s 55s 1m29s 2m24s 3m53s 6m17s 10m10s 16m27s 26m37s 43m4s 1h9m41s
func NewRestartableEngine ¶ added in v0.2.0
func NewRestartableEngine(engine Engine, retries uint, logger zerolog.Logger) *RestartableEngine
func (*RestartableEngine) Done ¶
func (r *RestartableEngine) Done() <-chan struct{}
func (*RestartableEngine) Ready ¶
func (r *RestartableEngine) Ready() <-chan struct{}
func (*RestartableEngine) Stop ¶
func (r *RestartableEngine) Stop()
type SequentialHeight ¶
type SequentialHeight struct {
// contains filtered or unexported fields
}
SequentialHeight tracks a block height and enforces rules about the valid next height.
func NewSequentialHeight ¶
func NewSequentialHeight(init uint64) *SequentialHeight
func (*SequentialHeight) Increment ¶
func (s *SequentialHeight) Increment(nextHeight uint64) error
Increment the height value according to the rules. A valid next height must be either incremented by one, or must be the same as previous height to make the action idempotent. Expected errors: if the height is not incremented according to the rules a ErrInvalidHeight error is returned
func (*SequentialHeight) Load ¶
func (s *SequentialHeight) Load() uint64
type StorageReceipt ¶
type StorageReceipt struct { Type uint8 PostState []byte Status uint64 CumulativeGasUsed uint64 // todo we could skip bloom to optimize storage and dynamically recalculate it Bloom gethTypes.Bloom Logs []*gethTypes.Log TxHash common.Hash ContractAddress common.Address GasUsed uint64 EffectiveGasPrice *big.Int BlobGasUsed uint64 BlobGasPrice *big.Int BlockHash common.Hash BlockNumber *big.Int TransactionIndex uint }
StorageReceipt is a receipt representation for storage.
This struct copies the geth.Receipt type found here: https://github.com/ethereum/go-ethereum/blob/9bbb9df18549d6f81c3d1f4fc6c65f71bc92490d/core/types/receipt.go#L52 the reason is if we use geth.Receipt some values will be skipped when RLP encoding which is because geth node has the data locally, but we don't in evm gateway, so we can not reproduce those values and we need to store them