preconfblocks

package
v0.0.0-...-e0763e2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT, MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogSkipper

func LogSkipper(c echo.Context) bool

LogSkipper implements the `middleware.Skipper` interface.

Types

type BuildPreconfBlockRequestBody

type BuildPreconfBlockRequestBody struct {
	// @param ExecutableData engine.ExecutableData the data necessary to execute an EL payload.
	ExecutableData *ExecutableData `json:"executableData"`
}

BuildPreconfBlockRequestBody represents a request body when handling preconf blocks creation requests.

type BuildPreconfBlockResponseBody

type BuildPreconfBlockResponseBody struct {
	// @param blockHeader types.Header of the preconf block
	BlockHeader *types.Header `json:"blockHeader"`
}

BuildPreconfBlockResponseBody represents a response body when handling preconf blocks creation requests.

type ExecutableData

type ExecutableData struct {
	ParentHash   common.Hash    `json:"parentHash"`
	FeeRecipient common.Address `json:"feeRecipient"`
	Number       uint64         `json:"blockNumber"`
	GasLimit     uint64         `json:"gasLimit"`
	Timestamp    uint64         `json:"timestamp"`
	// Transactions list with RLP encoded at first, then zlib compressed.
	Transactions  hexutil.Bytes `json:"transactions"`
	ExtraData     hexutil.Bytes `json:"extraData"`
	BaseFeePerGas uint64        `json:"baseFeePerGas"`
}

ExecutableData is the data necessary to execute an EL payload.

type Lookahead

type Lookahead struct {
	CurrOperator common.Address
	NextOperator common.Address
	UpdatedAt    time.Time
}

type PreconfBlockAPIServer

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

@license.name MIT @license.url https://github.com/taikoxyz/taiko-mono/blob/main/LICENSE.md PreconfBlockAPIServer represents a preconfirmation block server instance.

func New

func New(
	cors string,
	jwtSecret []byte,
	chainSyncer preconfBlockChainSyncer,
	cli *rpc.Client,
) (*PreconfBlockAPIServer, error)

New creates a new preconf blcok server instance, and starts the server.

func (*PreconfBlockAPIServer) BuildPreconfBlock

func (s *PreconfBlockAPIServer) BuildPreconfBlock(c echo.Context) error

BuildPreconfBlock handles a preconfirmation block creation request, if the preconfirmation block creation body in request are valid, it will insert the correspoinding the preconfirmation block to the backend L2 execution engine and return a success response.

	@Summary 	    Insert a preconfirmation block to the L2 execution engine.
	@Description	Insert a preconfirmation block to the L2 execution engine, if the preconfirmation block creation
	@Description	body in request are valid, it will insert the correspoinding the
 	@Description	preconfirmation block to the backend L2 execution engine and return a success response.
	@Param  	body body BuildPreconfBlockRequestBody true "preconf block creation request body"
	@Accept	  json
	@Produce	json
	@Success	200		{object} BuildPreconfBlockResponseBody
	@Router		/preconfBlocks [post]

func (*PreconfBlockAPIServer) HealthCheck

func (s *PreconfBlockAPIServer) HealthCheck(c echo.Context) error

HealthCheck is the endpoints for probes.

@Summary		Get current server health status
@ID			   	health-check
@Accept			json
@Produce		json
@Success		200	{object} string
@Router			/healthz [get]

func (*PreconfBlockAPIServer) OnUnsafeL2Payload

func (s *PreconfBlockAPIServer) OnUnsafeL2Payload(
	ctx context.Context,
	from peer.ID,
	msg *eth.ExecutionPayloadEnvelope,
) error

OnUnsafeL2Payload implements the p2p.GossipIn interface.

func (*PreconfBlockAPIServer) P2PSequencerAddress

func (s *PreconfBlockAPIServer) P2PSequencerAddress() common.Address

P2PSequencerAddress implements the p2p.GossipRuntimeConfig interface.

func (*PreconfBlockAPIServer) P2PSequencerAddresses

func (s *PreconfBlockAPIServer) P2PSequencerAddresses() []common.Address

P2PSequencerAddresses implements the p2p.PreconfGossipRuntimeConfig interface.

func (*PreconfBlockAPIServer) RemovePreconfBlocks

func (s *PreconfBlockAPIServer) RemovePreconfBlocks(c echo.Context) error

RemovePreconfBlocks removes the backend L2 execution engine preconf head.

	@Description	Remove all preconf blocks from the blockchain beyond the specified block height,
  @Description	ensuring the latest block ID does not exceed the given height. This method will fail if
  @Description	the block with an ID one greater than the specified height is not a preconf block. If the
  @Description	specified block height is greater than the latest preconf block ID, the method will succeed
  @Description	without modifying the blockchain.
	@Param      body body RemovePreconfBlocksRequestBody true "preconf blocks removing request body"
	@Accept			json
	@Produce		json
	@Success		200	{object} RemovePreconfBlocksResponseBody
	@Router			/preconfBlocks [delete]

func (*PreconfBlockAPIServer) SetP2PNode

func (s *PreconfBlockAPIServer) SetP2PNode(p2pNode *p2p.NodeP2P)

func (*PreconfBlockAPIServer) SetP2PSigner

func (s *PreconfBlockAPIServer) SetP2PSigner(p2pSigner p2p.Signer)

func (*PreconfBlockAPIServer) Shutdown

func (s *PreconfBlockAPIServer) Shutdown(ctx context.Context) error

Shutdown shuts down the HTTP server.

func (*PreconfBlockAPIServer) Start

func (s *PreconfBlockAPIServer) Start(port uint64) error

Start starts the HTTP server.

func (*PreconfBlockAPIServer) UpdateLookahead

func (s *PreconfBlockAPIServer) UpdateLookahead(l *Lookahead)

type RemovePreconfBlocksRequestBody

type RemovePreconfBlocksRequestBody struct {
	// @param newLastBlockID uint64 New last block ID of the blockchain, it should
	// @param not smaller than the canonical chain's highest block ID.
	NewLastBlockID uint64 `json:"newLastBlockId"`
}

RemovePreconfBlocksRequestBody represents a request body when resetting the backend L2 execution engine preconf head.

type RemovePreconfBlocksResponseBody

type RemovePreconfBlocksResponseBody struct {
	// @param lastBlockID uint64 Current highest block ID of the blockchain (including preconf blocks)
	LastBlockID uint64 `json:"lastBlockId"`
	// @param lastProposedBlockID uint64 Highest block ID of the cnonical chain
	LastProposedBlockID uint64 `json:"lastProposedBlockID"`
	// @param headsRemoved uint64 Number of preconf heads removed
	HeadsRemoved uint64 `json:"headsRemoved"`
}

RemovePreconfBlocksResponseBody represents a response body when resetting the backend L2 execution engine preconf head.

Jump to

Keyboard shortcuts

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