l2

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockToBatch

func BlockToBatch(config *rollup.Config, block *types.Block) (*derive.BatchData, error)

BlockToBatch converts a L2 block to batch-data. Invalid L2 blocks may return an error.

func ComputeL2OutputRoot

func ComputeL2OutputRoot(l2OutputRootVersion eth.Bytes32, blockHash common.Hash, blockRoot common.Hash, storageRoot common.Hash) eth.Bytes32

Types

type AccountResult

type AccountResult struct {
	AccountProof []hexutil.Bytes `json:"accountProof"`

	Address     common.Address `json:"address"`
	Balance     *hexutil.Big   `json:"balance"`
	CodeHash    common.Hash    `json:"codeHash"`
	Nonce       hexutil.Uint64 `json:"nonce"`
	StorageHash common.Hash    `json:"storageHash"`
}

func (*AccountResult) Verify

func (res *AccountResult) Verify(stateRoot common.Hash) error

Verify an account proof from the getProof RPC. See https://eips.ethereum.org/EIPS/eip-1186

type ReadOnlySource

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

func NewReadOnlySource

func NewReadOnlySource(l2Node client.RPC, l2Client client.Client, genesis *rollup.Genesis, log log.Logger) (*ReadOnlySource, error)

func (*ReadOnlySource) BlockByNumber

func (s *ReadOnlySource) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

func (*ReadOnlySource) GetBlockHeader

func (s *ReadOnlySource) GetBlockHeader(ctx context.Context, blockTag string) (*types.Header, error)

func (*ReadOnlySource) GetProof

func (s *ReadOnlySource) GetProof(ctx context.Context, address common.Address, blockTag string) (*AccountResult, error)

func (*ReadOnlySource) L2BlockRefByHash

func (s *ReadOnlySource) L2BlockRefByHash(ctx context.Context, l2Hash common.Hash) (eth.L2BlockRef, error)

L2BlockRefByHash returns the block & parent ids based on the supplied hash. The returned BlockRef may not be in the canonical chain

func (*ReadOnlySource) L2BlockRefByNumber

func (s *ReadOnlySource) L2BlockRefByNumber(ctx context.Context, l2Num *big.Int) (eth.L2BlockRef, error)

L2BlockRefByNumber returns the canonical block and parent ids.

type Source

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

func NewSource

func NewSource(l2Node client.RPC, l2Client client.Client, genesis *rollup.Genesis, log log.Logger) (*Source, error)

func (*Source) Close

func (s *Source) Close()

func (*Source) ForkchoiceUpdate

func (s *Source) ForkchoiceUpdate(ctx context.Context, fc *eth.ForkchoiceState, attributes *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)

ForkchoiceUpdate updates the forkchoice on the execution client. If attributes is not nil, the engine client will also begin building a block based on attributes after the new head block and return the payload ID. May return an error in ForkChoiceResult, but the error is marshalled into the error return

func (*Source) GetPayload

func (s *Source) GetPayload(ctx context.Context, payloadId eth.PayloadID) (*eth.ExecutionPayload, error)

GetPayload gets the execution payload associated with the PayloadId

func (*Source) L2BlockRefByHash

func (s *Source) L2BlockRefByHash(ctx context.Context, l2Hash common.Hash) (eth.L2BlockRef, error)

L2BlockRefByHash returns the block & parent ids based on the supplied hash. The returned BlockRef may not be in the canonical chain

func (*Source) L2BlockRefByNumber

func (s *Source) L2BlockRefByNumber(ctx context.Context, l2Num *big.Int) (eth.L2BlockRef, error)

L2BlockRefByNumber returns the canonical block and parent ids.

func (*Source) L2BlockRefHead

func (s *Source) L2BlockRefHead(ctx context.Context) (eth.L2BlockRef, error)

L2BlockRefHead returns the canonical block and parent ids.

func (*Source) NewPayload

func (s *Source) NewPayload(ctx context.Context, payload *eth.ExecutionPayload) (*eth.PayloadStatusV1, error)

ExecutePayload executes a built block on the execution engine and returns an error if it was not successful.

func (*Source) PayloadByHash

func (s *Source) PayloadByHash(ctx context.Context, hash common.Hash) (*eth.ExecutionPayload, error)

func (*Source) PayloadByNumber

func (s *Source) PayloadByNumber(ctx context.Context, number uint64) (*eth.ExecutionPayload, error)

Jump to

Keyboard shortcuts

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