Documentation ¶
Index ¶
- Constants
- Variables
- func ValidateTransaction(tx *gethTypes.Transaction, head *gethTypes.Header, signer gethTypes.Signer, ...) error
- type Block
- type BlockEvents
- type BloomsHeight
- type CadenceEvents
- func (c *CadenceEvents) Block() *Block
- func (c *CadenceEvents) BlockEventPayload() *events.BlockEventPayload
- func (c *CadenceEvents) CadenceBlockID() flow.Identifier
- func (c *CadenceEvents) CadenceHeight() uint64
- func (c *CadenceEvents) Empty() bool
- func (c *CadenceEvents) Length() int
- func (c *CadenceEvents) Receipts() []*Receipt
- func (c *CadenceEvents) Transactions() []Transaction
- func (c *CadenceEvents) TxEventPayloads() []events.TransactionEventPayload
- type DirectCall
- func (dc DirectCall) AccessList() gethTypes.AccessList
- func (dc DirectCall) BlobGas() uint64
- func (dc DirectCall) BlobGasFeeCap() *big.Int
- func (dc DirectCall) BlobHashes() []common.Hash
- func (dc DirectCall) Data() []byte
- func (dc DirectCall) From() (common.Address, error)
- func (dc DirectCall) Gas() uint64
- func (dc DirectCall) GasFeeCap() *big.Int
- func (dc DirectCall) GasPrice() *big.Int
- func (dc DirectCall) GasTipCap() *big.Int
- func (dc DirectCall) MarshalBinary() ([]byte, error)
- func (dc DirectCall) Nonce() uint64
- func (dc DirectCall) RawSignatureValues() (v *big.Int, r *big.Int, s *big.Int)
- func (dc DirectCall) Size() uint64
- func (dc DirectCall) To() *common.Address
- func (dc DirectCall) Type() uint8
- func (dc DirectCall) Value() *big.Int
- type Engine
- type EngineStatus
- type Publisher
- type Receipt
- type SequentialHeight
- type Subscriber
- type Subscription
- type Transaction
- type TransactionCall
Constants ¶
const ( BlockExecutedQualifiedIdentifier = string(events.EventTypeBlockExecuted) TransactionExecutedQualifiedIdentifier = string(events.EventTypeTransactionExecuted) )
const ( // TxSlotSize is used to calculate how many data slots a single transaction // takes up based on its size. The slots are used as DoS protection, ensuring // that validating a new transaction remains a constant operation (in reality // O(maxslots), where max slots are 4 currently). TxSlotSize = 32 * 1024 // TxMaxSize is the maximum size a single transaction can have. This field has // non-trivial consequences: larger transactions are significantly harder and // more expensive to propagate; larger transactions also take more resources // to validate whether they fit into the pool or not. TxMaxSize = 4 * TxSlotSize // 128KB )
Variables ¶
var ( LatestBlockNumber = big.NewInt(-2) EarliestBlockNumber = big.NewInt(0) )
var ErrInvalidHeight = errors.New("invalid height")
Functions ¶
func ValidateTransaction ¶ added in v0.21.0
func ValidateTransaction( tx *gethTypes.Transaction, head *gethTypes.Header, signer gethTypes.Signer, opts *txpool.ValidationOptions, ) error
Types ¶
type Block ¶ added in v0.25.0
type Block struct { *types.Block // We define fixed hash in case where types.Block format changes which // will produce a different hash on Block.Hash() calculation since it // will have more fields than before, so we make sure the hash we calculated // with the previous format is fixed by assigning it to this field and then // on hash calculation we check if this field is set we just return it. // We must make the FixedHash exported so RLP encoding preserves it. FixedHash gethCommon.Hash TransactionHashes []gethCommon.Hash }
func GenesisBlock ¶ added in v0.25.0
func NewBlockFromBytes ¶ added in v0.25.0
type BlockEvents ¶ added in v0.12.0
type BlockEvents struct { Events *CadenceEvents Err error }
BlockEvents is a wrapper around events streamed, and it also contains an error
func NewBlockEvents ¶ added in v0.12.0
func NewBlockEvents(events flow.BlockEvents) BlockEvents
func NewBlockEventsError ¶ added in v0.12.0
func NewBlockEventsError(err error) BlockEvents
type BloomsHeight ¶ added in v0.25.0
type CadenceEvents ¶ added in v0.6.0
type CadenceEvents struct {
// contains filtered or unexported fields
}
CadenceEvents contains Flow emitted events containing one or zero evm block executed event, and multiple or zero evm transaction events.
func NewCadenceEvents ¶ added in v0.6.0
func NewCadenceEvents(events flow.BlockEvents) (*CadenceEvents, error)
NewCadenceEvents decodes the events into evm types.
func (*CadenceEvents) Block ¶ added in v0.25.0
func (c *CadenceEvents) Block() *Block
Block evm block. If event doesn't contain EVM block the return value is nil.
func (*CadenceEvents) BlockEventPayload ¶ added in v1.0.0
func (c *CadenceEvents) BlockEventPayload() *events.BlockEventPayload
BlockEventPayload returns the EVM.BlockExecuted event payload. If the Flow block events do not contain an EVM block, the return value is nil.
func (*CadenceEvents) CadenceBlockID ¶ added in v0.16.0
func (c *CadenceEvents) CadenceBlockID() flow.Identifier
CadenceBlockID returns the Flow Cadence block ID.
func (*CadenceEvents) CadenceHeight ¶ added in v0.6.0
func (c *CadenceEvents) CadenceHeight() uint64
CadenceHeight returns the Flow Cadence height at which the events were emitted.
func (*CadenceEvents) Empty ¶ added in v0.6.0
func (c *CadenceEvents) Empty() bool
Empty checks if there is an EVM block included in the events. If there are no evm block or transactions events this is a heartbeat event.
func (*CadenceEvents) Length ¶ added in v0.6.0
func (c *CadenceEvents) Length() int
Length of the Cadence events emitted.
func (*CadenceEvents) Receipts ¶ added in v0.25.0
func (c *CadenceEvents) Receipts() []*Receipt
Receipts included in the EVM block, if event doesn't contain EVM transactions the return value is nil.
func (*CadenceEvents) Transactions ¶ added in v0.6.0
func (c *CadenceEvents) Transactions() []Transaction
Transactions included in the EVM block, if event doesn't contain EVM transactions the return value is nil.
func (*CadenceEvents) TxEventPayloads ¶ added in v1.0.0
func (c *CadenceEvents) TxEventPayloads() []events.TransactionEventPayload
TxEventPayloads returns the EVM.TransactionExecuted event payloads for the current EVM block. If the Flow block events do not contain any EVM transactions the return value is nil.
type DirectCall ¶ added in v0.4.0
type DirectCall struct {
*types.DirectCall
}
func (DirectCall) AccessList ¶ added in v0.20.0
func (dc DirectCall) AccessList() gethTypes.AccessList
func (DirectCall) BlobGas ¶ added in v0.4.0
func (dc DirectCall) BlobGas() uint64
func (DirectCall) BlobGasFeeCap ¶ added in v0.20.0
func (dc DirectCall) BlobGasFeeCap() *big.Int
func (DirectCall) BlobHashes ¶ added in v0.20.0
func (dc DirectCall) BlobHashes() []common.Hash
func (DirectCall) Data ¶ added in v0.4.0
func (dc DirectCall) Data() []byte
func (DirectCall) Gas ¶ added in v0.4.0
func (dc DirectCall) Gas() uint64
func (DirectCall) GasFeeCap ¶ added in v0.20.0
func (dc DirectCall) GasFeeCap() *big.Int
func (DirectCall) GasPrice ¶ added in v0.4.0
func (dc DirectCall) GasPrice() *big.Int
func (DirectCall) GasTipCap ¶ added in v0.20.0
func (dc DirectCall) GasTipCap() *big.Int
func (DirectCall) MarshalBinary ¶ added in v0.4.0
func (dc DirectCall) MarshalBinary() ([]byte, error)
func (DirectCall) Nonce ¶ added in v0.4.0
func (dc DirectCall) Nonce() uint64
func (DirectCall) RawSignatureValues ¶ added in v0.4.0
func (DirectCall) Size ¶ added in v0.4.0
func (dc DirectCall) Size() uint64
func (DirectCall) To ¶ added in v0.4.0
func (dc DirectCall) To() *common.Address
func (DirectCall) Type ¶ added in v0.4.0
func (dc DirectCall) Type() uint8
func (DirectCall) Value ¶ added in v0.4.0
func (dc DirectCall) Value() *big.Int
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) Done ¶ added in v0.36.5
func (e *EngineStatus) Done() <-chan struct{}
func (*EngineStatus) MarkDone ¶
func (e *EngineStatus) MarkDone()
func (*EngineStatus) MarkReady ¶
func (e *EngineStatus) MarkReady()
func (*EngineStatus) MarkStopped ¶
func (e *EngineStatus) MarkStopped()
func (*EngineStatus) Ready ¶ added in v0.36.5
func (e *EngineStatus) Ready() <-chan struct{}
func (*EngineStatus) Stopped ¶ added in v0.36.5
func (e *EngineStatus) Stopped() <-chan struct{}
type Publisher ¶ added in v0.23.1
type Publisher[T any] struct { // contains filtered or unexported fields }
func NewPublisher ¶ added in v0.23.1
func (*Publisher[T]) Subscribe ¶ added in v0.23.1
func (p *Publisher[T]) Subscribe(s Subscriber[T])
func (*Publisher[T]) Unsubscribe ¶ added in v0.23.1
func (p *Publisher[T]) Unsubscribe(s Subscriber[T])
type Receipt ¶ added in v0.30.1
type Receipt struct { Type uint8 `json:"type,omitempty"` PostState []byte `json:"root"` Status uint64 `json:"status"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed"` Bloom gethTypes.Bloom `json:"logsBloom"` Logs []*gethTypes.Log `json:"logs"` TxHash common.Hash `json:"transactionHash"` ContractAddress common.Address `json:"contractAddress"` GasUsed uint64 `json:"gasUsed"` EffectiveGasPrice *big.Int `json:"effectiveGasPrice"` BlobGasUsed uint64 `json:"blobGasUsed,omitempty"` BlobGasPrice *big.Int `json:"blobGasPrice,omitempty"` BlockHash common.Hash `json:"blockHash,omitempty"` BlockNumber *big.Int `json:"blockNumber,omitempty"` TransactionIndex uint `json:"transactionIndex"` RevertReason []byte `json:"revertReason"` PrecompiledCalls []byte }
Receipt 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
func NewReceipt ¶ added in v0.30.1
func ReceiptsFromBytes ¶ added in v0.30.1
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 Subscriber ¶ added in v0.23.1
type Subscription ¶ added in v0.23.1
type Subscription[T any] struct { // contains filtered or unexported fields }
func NewSubscription ¶ added in v0.23.1
func NewSubscription[T any](logger zerolog.Logger, callback func(T) error) *Subscription[T]
func (*Subscription[T]) Error ¶ added in v0.23.1
func (b *Subscription[T]) Error() <-chan error
func (*Subscription[T]) Notify ¶ added in v0.23.1
func (b *Subscription[T]) Notify(data T)
type Transaction ¶ added in v0.4.0
type Transaction interface { Hash() common.Hash RawSignatureValues() (v *big.Int, r *big.Int, s *big.Int) From() (common.Address, error) To() *common.Address Data() []byte Nonce() uint64 Value() *big.Int Type() uint8 Gas() uint64 GasFeeCap() *big.Int GasTipCap() *big.Int GasPrice() *big.Int BlobGas() uint64 BlobGasFeeCap() *big.Int BlobHashes() []common.Hash Size() uint64 AccessList() gethTypes.AccessList MarshalBinary() ([]byte, error) }
func UnmarshalTransaction ¶ added in v0.4.0
func UnmarshalTransaction(value []byte) (Transaction, error)
type TransactionCall ¶ added in v0.4.0
type TransactionCall struct {
*gethTypes.Transaction
}
func (TransactionCall) From ¶ added in v0.4.0
func (tc TransactionCall) From() (common.Address, error)
func (TransactionCall) Hash ¶ added in v0.4.0
func (tc TransactionCall) Hash() common.Hash
func (TransactionCall) MarshalBinary ¶ added in v0.4.0
func (tc TransactionCall) MarshalBinary() ([]byte, error)