state

package
v0.0.0-...-3966bb1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State struct {

	// Constants
	GenesisL1Height  *big.Int
	OnTakeForkHeight *big.Int
	// 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) IsOnTake

func (s *State) IsOnTake(num *big.Int) bool

IsOnTake returns whether num is either equal to the ontake block or greater.

func (*State) ResetL1Current

func (s *State) ResetL1Current(ctx context.Context, blockID *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.

Jump to

Keyboard shortcuts

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