state

package
v0.0.0-...-1d04f91 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeightOrID

type HeightOrID struct {
	Height *big.Int
	ID     *big.Int
}

HeightOrID contains a block height or a block ID.

func (*HeightOrID) NotEmpty

func (h *HeightOrID) NotEmpty() bool

NotEmpty checks whether this is an empty struct.

type State

type State struct {

	// Constants
	GenesisL1Height  *big.Int
	BlockDeadendHash common.Hash
	// contains filtered or unexported fields
}

State contains all states which will be used by driver.

func New

func New(ctx context.Context, rpc *rpc.Client) (*State, error)

New creates a new driver state instance.

func (*State) Close

func (s *State) Close()

Close closes all inner subscriptions.

func (*State) GetHeadBlockID

func (s *State) GetHeadBlockID() *big.Int

GetHeadBlockID reads the last pending block ID concurrent safely.

func (*State) GetL1Current

func (s *State) GetL1Current() *types.Header

GetL1Current reads the L1 current cursor concurrent safely.

func (*State) GetL1Head

func (s *State) GetL1Head() *types.Header

GetL1Head reads the L1 head concurrent safely.

func (*State) GetL2Head

func (s *State) GetL2Head() *types.Header

GetL2Head reads the L2 head concurrent safely.

func (*State) GetLatestVerifiedBlock

func (s *State) GetLatestVerifiedBlock() *VerifiedHeaderInfo

GetLatestVerifiedBlock reads the latest verified L2 block concurrent safely.

func (*State) ResetL1Current

func (s *State) ResetL1Current(
	ctx context.Context,
	heightOrID *HeightOrID,
) (*bindings.MxcL1ClientBlockProposed, *big.Int, error)

ResetL1Current resets the l1Current cursor to the L1 height which emitted a BlockProposed event with given blockID / blockHash.

func (*State) SetL1Current

func (s *State) SetL1Current(h *types.Header)

SetL1Current sets the L1 current cursor concurrent safely.

func (*State) SubL1HeadsFeed

func (s *State) SubL1HeadsFeed(ch chan *types.Header) event.Subscription

SubL1HeadsFeed registers a subscription of new L1 heads.

func (*State) VerifyL2Block

func (s *State) VerifyL2Block(ctx context.Context, height *big.Int, hash common.Hash) error

VerifyL2Block checks whether the given block is in L2 execution engine's local chain.

type VerifiedHeaderInfo

type VerifiedHeaderInfo struct {
	ID     *big.Int
	Hash   common.Hash
	Height *big.Int
}

VerifiedHeaderInfo contains information about a verified L2 block header.

Jump to

Keyboard shortcuts

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