Documentation
¶
Index ¶
- func NewExecutorServiceHandler(executor execution.Executor, opts ...connect.HandlerOption) http.Handler
- type Client
- func (c *Client) ExecuteTxs(ctx context.Context, txs [][]byte, blockHeight uint64, timestamp time.Time, ...) (updatedStateRoot []byte, err error)
- func (c *Client) FilterTxs(ctx context.Context, txs [][]byte, maxBytes, maxGas uint64, ...) ([]execution.FilterStatus, error)
- func (c *Client) GetExecutionInfo(ctx context.Context) (execution.ExecutionInfo, error)
- func (c *Client) GetTxs(ctx context.Context) ([][]byte, error)
- func (c *Client) InitChain(ctx context.Context, genesisTime time.Time, initialHeight uint64, ...) (stateRoot []byte, err error)
- func (c *Client) SetFinal(ctx context.Context, blockHeight uint64) error
- type Server
- func (s *Server) ExecuteTxs(ctx context.Context, req *connect.Request[pb.ExecuteTxsRequest]) (*connect.Response[pb.ExecuteTxsResponse], error)
- func (s *Server) FilterTxs(ctx context.Context, req *connect.Request[pb.FilterTxsRequest]) (*connect.Response[pb.FilterTxsResponse], error)
- func (s *Server) GetExecutionInfo(ctx context.Context, req *connect.Request[pb.GetExecutionInfoRequest]) (*connect.Response[pb.GetExecutionInfoResponse], error)
- func (s *Server) GetTxs(ctx context.Context, req *connect.Request[pb.GetTxsRequest]) (*connect.Response[pb.GetTxsResponse], error)
- func (s *Server) InitChain(ctx context.Context, req *connect.Request[pb.InitChainRequest]) (*connect.Response[pb.InitChainResponse], error)
- func (s *Server) SetFinal(ctx context.Context, req *connect.Request[pb.SetFinalRequest]) (*connect.Response[pb.SetFinalResponse], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExecutorServiceHandler ¶
func NewExecutorServiceHandler(executor execution.Executor, opts ...connect.HandlerOption) http.Handler
NewExecutorServiceHandler creates a new HTTP handler for the ExecutorService. It follows the same pattern as other services in the codebase, supporting both HTTP/1.1 and HTTP/2 without TLS using h2c.
Parameters: - executor: The execution implementation to serve - opts: Optional server options for configuring the service
Returns: - http.Handler: The configured HTTP handler
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a gRPC client that implements the execution.Executor interface. It communicates with a remote execution service via gRPC using Connect-RPC.
func NewClient ¶
func NewClient(url string, opts ...connect.ClientOption) *Client
NewClient creates a new gRPC execution client.
Parameters: - url: The URL of the gRPC server (e.g., "http://localhost:50051") - opts: Optional Connect client options for configuring the connection
Returns: - *Client: The initialized gRPC client
func (*Client) ExecuteTxs ¶
func (c *Client) ExecuteTxs(ctx context.Context, txs [][]byte, blockHeight uint64, timestamp time.Time, prevStateRoot []byte) (updatedStateRoot []byte, err error)
ExecuteTxs processes transactions to produce a new block state.
This method sends transactions to the execution service for processing and returns the updated state root after execution. The execution service ensures deterministic execution and validates the state transition.
func (*Client) FilterTxs ¶
func (c *Client) FilterTxs(ctx context.Context, txs [][]byte, maxBytes, maxGas uint64, hasForceIncludedTransaction bool) ([]execution.FilterStatus, error)
FilterTxs validates force-included transactions and applies gas and size filtering.
This method sends transactions to the remote execution service for validation. Returns a slice of FilterStatus for each transaction.
func (*Client) GetExecutionInfo ¶
GetExecutionInfo returns current execution layer parameters.
This method retrieves execution parameters such as the block gas limit from the remote execution service.
func (*Client) GetTxs ¶
GetTxs fetches available transactions from the execution layer's mempool.
This method retrieves transactions that are ready to be included in a block. The execution service may perform validation and filtering before returning transactions.
func (*Client) InitChain ¶
func (c *Client) InitChain(ctx context.Context, genesisTime time.Time, initialHeight uint64, chainID string) (stateRoot []byte, err error)
InitChain initializes a new blockchain instance with genesis parameters.
This method sends an InitChain request to the remote execution service and returns the initial state root.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a gRPC server that wraps an execution.Executor implementation. It handles the conversion between gRPC types and internal types.
func NewServer ¶
NewServer creates a new gRPC server that wraps the given executor.
Parameters: - executor: The underlying execution implementation to wrap
Returns: - *Server: The initialized gRPC server
func (*Server) ExecuteTxs ¶
func (s *Server) ExecuteTxs( ctx context.Context, req *connect.Request[pb.ExecuteTxsRequest], ) (*connect.Response[pb.ExecuteTxsResponse], error)
ExecuteTxs handles the ExecuteTxs RPC request.
It processes transactions to produce a new block state by delegating to the underlying executor implementation.
func (*Server) FilterTxs ¶
func (s *Server) FilterTxs( ctx context.Context, req *connect.Request[pb.FilterTxsRequest], ) (*connect.Response[pb.FilterTxsResponse], error)
FilterTxs handles the FilterTxs RPC request.
It validates force-included transactions and applies gas and size filtering. Returns a slice of FilterStatus for each transaction.
func (*Server) GetExecutionInfo ¶
func (s *Server) GetExecutionInfo( ctx context.Context, req *connect.Request[pb.GetExecutionInfoRequest], ) (*connect.Response[pb.GetExecutionInfoResponse], error)
GetExecutionInfo handles the GetExecutionInfo RPC request.
It returns current execution layer parameters such as the block gas limit.
func (*Server) GetTxs ¶
func (s *Server) GetTxs( ctx context.Context, req *connect.Request[pb.GetTxsRequest], ) (*connect.Response[pb.GetTxsResponse], error)
GetTxs handles the GetTxs RPC request.
It fetches available transactions from the execution layer's mempool.
func (*Server) InitChain ¶
func (s *Server) InitChain( ctx context.Context, req *connect.Request[pb.InitChainRequest], ) (*connect.Response[pb.InitChainResponse], error)
InitChain handles the InitChain RPC request.
It initializes the blockchain with the given genesis parameters by delegating to the underlying executor implementation.