actions

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WildcardForkId It match for all forkIds
	WildcardForkId ForkIdType = 0
	// ForkIDIncaberry is the forkId for incaberry
	ForkIDIncaberry = ForkIdType(6) // nolint:gomnd
	// ForkIDEtrog is the forkId for etrog
	ForkIDEtrog = ForkIdType(7) //nolint:gomnd
	// ForkIDElderberry is the forkId for Elderberry
	ForkIDElderberry = ForkIdType(8) //nolint:gomnd
	// ForkID9 is the forkId for 9
	ForkID9 = ForkIdType(9) //nolint:gomnd
)

Variables

View Source
var (

	// ForksIdAll support all forkIds
	ForksIdAll = []ForkIdType{WildcardForkId}

	// ForksIdOnlyElderberry support only elderberry forkId
	ForksIdOnlyElderberry = []ForkIdType{ForkIDElderberry, ForkID9}

	// ForksIdOnlyEtrog support only etrog forkId
	ForksIdOnlyEtrog = []ForkIdType{ForkIDEtrog}

	// ForksIdToIncaberry support all forkIds till incaberry
	ForksIdToIncaberry = []ForkIdType{1, 2, 3, 4, 5, ForkIDIncaberry}
)
View Source
var (
	// ErrInvalidParams is used when the object is not found
	ErrInvalidParams = errors.New("invalid params")
)

Functions

This section is empty.

Types

type CheckL2BlockHash added in v0.6.3

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

CheckL2BlockHash is a struct that implements a checker of L2Block hash

func NewCheckL2BlockHash added in v0.6.3

func NewCheckL2BlockHash(state stateGetL2Block,
	trustedClient trustedRPCGetL2Block,
	initialL2BlockNumber uint64,
	modulusBlockNumber uint64) (*CheckL2BlockHash, error)

NewCheckL2BlockHash creates a new CheckL2BlockHash

func (*CheckL2BlockHash) CheckL2Block added in v0.6.3

func (p *CheckL2BlockHash) CheckL2Block(ctx context.Context, dbTx pgx.Tx) error

CheckL2Block checks the L2Block hash between the local and the trusted

func (*CheckL2BlockHash) GetL2Blocks added in v0.6.3

func (p *CheckL2BlockHash) GetL2Blocks(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.L2Block, *types.Block, error)

GetL2Blocks returns localL2Block and trustedL2Block

func (*CheckL2BlockHash) GetMinimumL2BlockToCheck added in v0.6.3

func (p *CheckL2BlockHash) GetMinimumL2BlockToCheck() uint64

GetMinimumL2BlockToCheck returns the minimum L2Block to check

func (*CheckL2BlockHash) GetNextL2BlockToCheck added in v0.6.3

func (p *CheckL2BlockHash) GetNextL2BlockToCheck(lastLocalL2BlockNumber, minL2BlockNumberToCheck uint64) (bool, uint64)

GetNextL2BlockToCheck returns true is need to check and the blocknumber

type CheckL2BlockProcessorDecorator added in v0.6.3

type CheckL2BlockProcessorDecorator struct {
	L1EventProcessor
	// contains filtered or unexported fields
}

CheckL2BlockProcessorDecorator This class is just a decorator to call CheckL2Block

func NewCheckL2BlockDecorator added in v0.6.3

func NewCheckL2BlockDecorator(l1EventProcessor L1EventProcessor, l2blockChecker *CheckL2BlockHash) *CheckL2BlockProcessorDecorator

NewCheckL2BlockDecorator creates a new CheckL2BlockDecorator

func (*CheckL2BlockProcessorDecorator) Process added in v0.6.3

func (p *CheckL2BlockProcessorDecorator) Process(ctx context.Context, order etherman.Order, l1Block *etherman.Block, dbTx pgx.Tx) error

Process wraps the real Process and after check the L2Blocks

type ForkIdType

type ForkIdType uint64

ForkIdType is the type of the forkId

type L1EventProcessor

type L1EventProcessor interface {
	// Name of the processor
	Name() string
	// SupportedForkIds list of forkId that support (you could use WildcardForkId)
	SupportedForkIds() []ForkIdType
	// SupportedEvents list of events that support (typically one)
	SupportedEvents() []etherman.EventOrder
	// Process a incomming event
	Process(ctx context.Context, order etherman.Order, l1Block *etherman.Block, dbTx pgx.Tx) error
}

L1EventProcessor is the interface for a processor of L1 events The main function is Process that must execute the event

type ProcessorBase

type ProcessorBase[T any] struct {
	SupportedEvent    []etherman.EventOrder
	SupportedForkdIds *[]ForkIdType
}

ProcessorBase is the base struct for all the processors, if reduces the boilerplate implementing the Name, SupportedEvents and SupportedForkIds functions

func (*ProcessorBase[T]) Name

func (g *ProcessorBase[T]) Name() string

Name returns the name of the struct T

func (*ProcessorBase[T]) SupportedEvents

func (p *ProcessorBase[T]) SupportedEvents() []etherman.EventOrder

SupportedEvents returns the supported events in the struct

func (*ProcessorBase[T]) SupportedForkIds

func (p *ProcessorBase[T]) SupportedForkIds() []ForkIdType

SupportedForkIds returns the supported forkIds in the struct or the dafault till incaberry forkId

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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