From fb3ae22c0e7f161b32df973b8960bb8d7fd180f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Tue, 5 Nov 2024 22:00:52 +0100 Subject: [PATCH 1/5] style: fix imports ordering --- proxy/grpc/client.go | 4 ++-- test/suite.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/grpc/client.go b/proxy/grpc/client.go index dbc6eaa..cf519f0 100644 --- a/proxy/grpc/client.go +++ b/proxy/grpc/client.go @@ -4,9 +4,9 @@ import ( "context" "time" - "github.com/rollkit/go-execution/types" "google.golang.org/grpc" + "github.com/rollkit/go-execution/types" pb "github.com/rollkit/go-execution/types/pb/execution" ) @@ -30,7 +30,7 @@ func (c *Client) SetConfig(config *Config) { func (c *Client) Start(target string, opts ...grpc.DialOption) error { var err error - c.conn, err = grpc.Dial(target, opts...) // Changed from grpc.NewClient to grpc.Dial + c.conn, err = grpc.NewClient(target, opts...) if err != nil { return err } diff --git a/test/suite.go b/test/suite.go index 90419f0..f72b504 100644 --- a/test/suite.go +++ b/test/suite.go @@ -4,10 +4,10 @@ import ( "testing" "time" - "github.com/rollkit/go-execution/types" "github.com/stretchr/testify/suite" "github.com/rollkit/go-execution" + "github.com/rollkit/go-execution/types" ) type ExecuteSuite struct { From 937465de83d48e4677625a31bd91d31f8605122f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Tue, 5 Nov 2024 22:01:19 +0100 Subject: [PATCH 2/5] style: comment out unused errors --- proxy/grpc/errors.go | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/proxy/grpc/errors.go b/proxy/grpc/errors.go index 03cc9b8..e67d0e2 100644 --- a/proxy/grpc/errors.go +++ b/proxy/grpc/errors.go @@ -1,15 +1,11 @@ package grpc -import ( - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -var ( - ErrUnknownPayload = status.Error(codes.NotFound, "payload does not exist") - ErrInvalidForkchoice = status.Error(codes.InvalidArgument, "invalid forkchoice state") - ErrInvalidPayloadAttrs = status.Error(codes.InvalidArgument, "invalid payload attributes") - ErrTooLargeRequest = status.Error(codes.ResourceExhausted, "request too large") - ErrUnsupportedFork = status.Error(codes.Unimplemented, "unsupported fork") - ErrInvalidJWT = status.Error(codes.Unauthenticated, "invalid JWT token") -) +// TODO(tzdybal): do we need this? +//var ( +// ErrUnknownPayload = status.Error(codes.NotFound, "payload does not exist") +// ErrInvalidForkchoice = status.Error(codes.InvalidArgument, "invalid forkchoice state") +// ErrInvalidPayloadAttrs = status.Error(codes.InvalidArgument, "invalid payload attributes") +// ErrTooLargeRequest = status.Error(codes.ResourceExhausted, "request too large") +// ErrUnsupportedFork = status.Error(codes.Unimplemented, "unsupported fork") +// ErrInvalidJWT = status.Error(codes.Unauthenticated, "invalid JWT token") +//) From 4fb7d2a053a0b9760341ebfb63715c454055b6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Tue, 5 Nov 2024 22:10:23 +0100 Subject: [PATCH 3/5] test: add "passtrough://" to bufnet in tests --- proxy/grpc/client_server_test.go | 2 +- proxy/grpc/proxy_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/grpc/client_server_test.go b/proxy/grpc/client_server_test.go index c887818..1355892 100644 --- a/proxy/grpc/client_server_test.go +++ b/proxy/grpc/client_server_test.go @@ -38,7 +38,7 @@ func TestClientServer(t *testing.T) { client := grpcproxy.NewClient() client.SetConfig(config) - err := client.Start("bufnet", + err := client.Start("passthrough://bufnet", grpc.WithContextDialer(dialer(listener)), grpc.WithTransportCredentials(insecure.NewCredentials()), ) diff --git a/proxy/grpc/proxy_test.go b/proxy/grpc/proxy_test.go index db5ee75..0c9c42b 100644 --- a/proxy/grpc/proxy_test.go +++ b/proxy/grpc/proxy_test.go @@ -61,7 +61,7 @@ func (s *ProxyTestSuite) SetupTest() { grpc.WithTransportCredentials(insecure.NewCredentials()), } - err := client.Start("bufnet", opts...) + err := client.Start("passthrough://bufnet", opts...) require.NoError(s.T(), err) for i := 0; i < 10; i++ { From 37ba65e544dc4757bb87ea6d3aac8b308bba9e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Tue, 5 Nov 2024 22:11:03 +0100 Subject: [PATCH 4/5] test: move TestDummySuite to _test.go file --- test/dummy_test.go | 11 +++++++++++ test/suite.go | 5 ----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 test/dummy_test.go diff --git a/test/dummy_test.go b/test/dummy_test.go new file mode 100644 index 0000000..c98648c --- /dev/null +++ b/test/dummy_test.go @@ -0,0 +1,11 @@ +package test + +import ( + "testing" + + "github.com/stretchr/testify/suite" +) + +func TestDummySuite(t *testing.T) { + suite.Run(t, new(DummyTestSuite)) +} diff --git a/test/suite.go b/test/suite.go index f72b504..f72d7bd 100644 --- a/test/suite.go +++ b/test/suite.go @@ -1,7 +1,6 @@ package test import ( - "testing" "time" "github.com/stretchr/testify/suite" @@ -58,7 +57,3 @@ type DummyTestSuite struct { func (s *DummyTestSuite) SetupTest() { s.Exec = NewExecute() } - -func TestDummySuite(t *testing.T) { - suite.Run(t, new(DummyTestSuite)) -} From 93ea689875889b008c0d9f8c8dac402bd26375c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Tue, 5 Nov 2024 22:48:17 +0100 Subject: [PATCH 5/5] chore: fix linter errors --- .golangci.yml | 3 --- proxy/grpc/client.go | 9 +++++++++ proxy/grpc/client_server_test.go | 2 +- proxy/grpc/config.go | 2 ++ proxy/grpc/proxy_test.go | 2 +- proxy/grpc/server.go | 6 ++++++ proxy/jsonrpc/client.go | 11 ++++++++++- proxy/jsonrpc/client_server_test.go | 2 +- proxy/jsonrpc/config.go | 2 ++ proxy/jsonrpc/errors.go | 27 +++++++++++++++++++++------ proxy/jsonrpc/proxy_test.go | 2 +- proxy/jsonrpc/server.go | 4 +++- test/dummy.go | 5 +++++ test/dummy_test.go | 8 ++++++++ test/suite.go | 15 +++++---------- types/types.go | 3 +++ 16 files changed, 78 insertions(+), 25 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 690483b..ecbd405 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,7 +4,6 @@ run: linters: enable: - - deadcode - errcheck - gofmt - goimports @@ -15,10 +14,8 @@ linters: - misspell - revive - staticcheck - - structcheck - typecheck - unused - - varcheck issues: exclude-use-default: false diff --git a/proxy/grpc/client.go b/proxy/grpc/client.go index cf519f0..3d1e1d3 100644 --- a/proxy/grpc/client.go +++ b/proxy/grpc/client.go @@ -10,24 +10,28 @@ import ( pb "github.com/rollkit/go-execution/types/pb/execution" ) +// Client defines gRPC proxy client type Client struct { conn *grpc.ClientConn client pb.ExecutionServiceClient config *Config } +// NewClient creates a new instance of Client with default configuration. func NewClient() *Client { return &Client{ config: DefaultConfig(), } } +// SetConfig sets the configuration for the Client instance. func (c *Client) SetConfig(config *Config) { if config != nil { c.config = config } } +// Start initializes the Client by creating a new gRPC connection and storing the ExecutionServiceClient instance. func (c *Client) Start(target string, opts ...grpc.DialOption) error { var err error c.conn, err = grpc.NewClient(target, opts...) @@ -38,6 +42,7 @@ func (c *Client) Start(target string, opts ...grpc.DialOption) error { return nil } +// Stop stops the client by closing the underlying gRPC connection if it exists. func (c *Client) Stop() error { if c.conn != nil { return c.conn.Close() @@ -45,6 +50,7 @@ func (c *Client) Stop() error { return nil } +// InitChain initializes the blockchain with genesis information. func (c *Client) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (types.Hash, uint64, error) { ctx, cancel := context.WithTimeout(context.Background(), c.config.DefaultTimeout) defer cancel() @@ -64,6 +70,7 @@ func (c *Client) InitChain(genesisTime time.Time, initialHeight uint64, chainID return stateRoot, resp.MaxBytes, nil } +// GetTxs retrieves all available transactions from the execution client's mempool. func (c *Client) GetTxs() ([]types.Tx, error) { ctx, cancel := context.WithTimeout(context.Background(), c.config.DefaultTimeout) defer cancel() @@ -81,6 +88,7 @@ func (c *Client) GetTxs() ([]types.Tx, error) { return txs, nil } +// ExecuteTxs executes a set of transactions to produce a new block header. func (c *Client) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.Time, prevStateRoot types.Hash) (types.Hash, uint64, error) { ctx, cancel := context.WithTimeout(context.Background(), c.config.DefaultTimeout) defer cancel() @@ -106,6 +114,7 @@ func (c *Client) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.T return updatedStateRoot, resp.MaxBytes, nil } +// SetFinal marks a block at the given height as final. func (c *Client) SetFinal(blockHeight uint64) error { ctx, cancel := context.WithTimeout(context.Background(), c.config.DefaultTimeout) defer cancel() diff --git a/proxy/grpc/client_server_test.go b/proxy/grpc/client_server_test.go index 1355892..0c4e86e 100644 --- a/proxy/grpc/client_server_test.go +++ b/proxy/grpc/client_server_test.go @@ -43,7 +43,7 @@ func TestClientServer(t *testing.T) { grpc.WithTransportCredentials(insecure.NewCredentials()), ) require.NoError(t, err) - defer client.Stop() + defer func() { _ = client.Stop() }() mockExec.On("GetTxs").Return([]types.Tx{}, nil).Maybe() diff --git a/proxy/grpc/config.go b/proxy/grpc/config.go index 0c6a9a1..6962226 100644 --- a/proxy/grpc/config.go +++ b/proxy/grpc/config.go @@ -2,12 +2,14 @@ package grpc import "time" +// Config holds configuration settings for the gRPC proxy. type Config struct { JWTSecret []byte DefaultTimeout time.Duration MaxRequestSize int } +// DefaultConfig returns a Config instance populated with default settings. func DefaultConfig() *Config { return &Config{ DefaultTimeout: time.Second, diff --git a/proxy/grpc/proxy_test.go b/proxy/grpc/proxy_test.go index 0c9c42b..c74fda1 100644 --- a/proxy/grpc/proxy_test.go +++ b/proxy/grpc/proxy_test.go @@ -74,7 +74,7 @@ func (s *ProxyTestSuite) SetupTest() { s.client = client s.Exec = client s.cleanup = func() { - client.Stop() + _ = client.Stop() s.server.Stop() } } diff --git a/proxy/grpc/server.go b/proxy/grpc/server.go index d36add2..9c5fa42 100644 --- a/proxy/grpc/server.go +++ b/proxy/grpc/server.go @@ -9,12 +9,14 @@ import ( pb "github.com/rollkit/go-execution/types/pb/execution" ) +// Server defines a gRPC proxy server type Server struct { pb.UnimplementedExecutionServiceServer exec execution.Execute config *Config } +// NewServer creates a new ExecutionService gRPC server with the given execution client and configuration. func NewServer(exec execution.Execute, config *Config) pb.ExecutionServiceServer { if config == nil { config = DefaultConfig() @@ -37,6 +39,7 @@ func (s *Server) validateJWT(_ context.Context) error { return nil } +// InitChain handles InitChain method call from execution API. func (s *Server) InitChain(ctx context.Context, req *pb.InitChainRequest) (*pb.InitChainResponse, error) { if err := s.validateAuth(ctx); err != nil { return nil, err @@ -60,6 +63,7 @@ func (s *Server) InitChain(ctx context.Context, req *pb.InitChainRequest) (*pb.I }, nil } +// GetTxs handles GetTxs method call from execution API. func (s *Server) GetTxs(ctx context.Context, req *pb.GetTxsRequest) (*pb.GetTxsResponse, error) { txs, err := s.exec.GetTxs() if err != nil { @@ -76,6 +80,7 @@ func (s *Server) GetTxs(ctx context.Context, req *pb.GetTxsRequest) (*pb.GetTxsR }, nil } +// ExecuteTxs handles ExecuteTxs method call from execution API. func (s *Server) ExecuteTxs(ctx context.Context, req *pb.ExecuteTxsRequest) (*pb.ExecuteTxsResponse, error) { txs := make([]types.Tx, len(req.Txs)) for i, tx := range req.Txs { @@ -101,6 +106,7 @@ func (s *Server) ExecuteTxs(ctx context.Context, req *pb.ExecuteTxsRequest) (*pb }, nil } +// SetFinal handles SetFinal method call from execution API. func (s *Server) SetFinal(ctx context.Context, req *pb.SetFinalRequest) (*pb.SetFinalResponse, error) { err := s.exec.SetFinal(req.BlockHeight) if err != nil { diff --git a/proxy/jsonrpc/client.go b/proxy/jsonrpc/client.go index cd64664..cdebf9f 100644 --- a/proxy/jsonrpc/client.go +++ b/proxy/jsonrpc/client.go @@ -12,12 +12,14 @@ import ( "github.com/rollkit/go-execution/types" ) +// Client defines JSON-RPC proxy client of execution API. type Client struct { endpoint string client *http.Client config *Config } +// NewClient creates new proxy client with default config. func NewClient() *Client { return &Client{ config: DefaultConfig(), @@ -25,6 +27,7 @@ func NewClient() *Client { } } +// SetConfig updates the client's configuration with the provided config. func (c *Client) SetConfig(config *Config) { if config != nil { c.config = config @@ -32,15 +35,18 @@ func (c *Client) SetConfig(config *Config) { } } +// Start is used to start the client. func (c *Client) Start(endpoint string) error { c.endpoint = endpoint return nil } +// Stop method is used to stop the client. func (c *Client) Stop() error { return nil } +// InitChain initializes the blockchain with genesis information. func (c *Client) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (types.Hash, uint64, error) { params := map[string]interface{}{ "genesis_time": genesisTime.Unix(), @@ -68,6 +74,7 @@ func (c *Client) InitChain(genesisTime time.Time, initialHeight uint64, chainID return stateRoot, result.MaxBytes, nil } +// GetTxs retrieves all available transactions from the execution client's mempool. func (c *Client) GetTxs() ([]types.Tx, error) { var result struct { Txs []string `json:"txs"` @@ -89,6 +96,7 @@ func (c *Client) GetTxs() ([]types.Tx, error) { return txs, nil } +// ExecuteTxs executes a set of transactions to produce a new block header. func (c *Client) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.Time, prevStateRoot types.Hash) (types.Hash, uint64, error) { // Encode txs to base64 encodedTxs := make([]string, len(txs)) @@ -123,6 +131,7 @@ func (c *Client) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.T return updatedStateRoot, result.MaxBytes, nil } +// SetFinal marks a block at the given height as final. func (c *Client) SetFinal(blockHeight uint64) error { params := map[string]interface{}{ "block_height": blockHeight, @@ -160,7 +169,7 @@ func (c *Client) call(method string, params interface{}, result interface{}) err if err != nil { return fmt.Errorf("failed to send request: %w", err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { return fmt.Errorf("unexpected status code: %d", resp.StatusCode) diff --git a/proxy/jsonrpc/client_server_test.go b/proxy/jsonrpc/client_server_test.go index 373d59d..02b82b7 100644 --- a/proxy/jsonrpc/client_server_test.go +++ b/proxy/jsonrpc/client_server_test.go @@ -29,7 +29,7 @@ func TestClientServer(t *testing.T) { err := client.Start(testServer.URL) require.NoError(t, err) - defer client.Stop() + defer func() { _ = client.Stop() }() t.Run("InitChain", func(t *testing.T) { genesisTime := time.Now().UTC().Truncate(time.Second) diff --git a/proxy/jsonrpc/config.go b/proxy/jsonrpc/config.go index bfe2b7a..409f64d 100644 --- a/proxy/jsonrpc/config.go +++ b/proxy/jsonrpc/config.go @@ -2,11 +2,13 @@ package jsonrpc import "time" +// Config represents configuration settings for server/client. type Config struct { DefaultTimeout time.Duration MaxRequestSize int64 } +// DefaultConfig returns Config struct initialized with default settings. func DefaultConfig() *Config { return &Config{ DefaultTimeout: time.Second, diff --git a/proxy/jsonrpc/errors.go b/proxy/jsonrpc/errors.go index e5ac4c8..91cc299 100644 --- a/proxy/jsonrpc/errors.go +++ b/proxy/jsonrpc/errors.go @@ -6,17 +6,32 @@ type jsonRPCError struct { } const ( - ErrCodeParse = -32700 + // ErrCodeParse is a reserved JSON-RPC error code + ErrCodeParse = -32700 + // ErrCodeInvalidRequest is a reserved JSON-RPC error code ErrCodeInvalidRequest = -32600 + // ErrCodeMethodNotFound is a reserved JSON-RPC error code ErrCodeMethodNotFound = -32601 - ErrCodeInvalidParams = -32602 - ErrCodeInternal = -32603 + // ErrCodeInvalidParams is a reserved JSON-RPC error code + ErrCodeInvalidParams = -32602 + // ErrCodeInternal is a reserved JSON-RPC error code + ErrCodeInternal = -32603 ) var ( - ErrParse = &jsonRPCError{Code: ErrCodeParse, Message: "Parse error"} + + // ErrParse represents a JSON-RPC error indicating a problem with parsing the JSON request payload. + ErrParse = &jsonRPCError{Code: ErrCodeParse, Message: "Parse error"} + + // ErrInvalidRequest represents a JSON-RPC error indicating an invalid JSON request payload. ErrInvalidRequest = &jsonRPCError{Code: ErrCodeInvalidRequest, Message: "Invalid request"} + + // ErrMethodNotFound represents a JSON-RPC error indicating that the requested method could not be found. ErrMethodNotFound = &jsonRPCError{Code: ErrCodeMethodNotFound, Message: "Method not found"} - ErrInvalidParams = &jsonRPCError{Code: ErrCodeInvalidParams, Message: "Invalid params"} - ErrInternal = &jsonRPCError{Code: ErrCodeInternal, Message: "Internal error"} + + // ErrInvalidParams represents a JSON-RPC error indicating invalid parameters in the request. + ErrInvalidParams = &jsonRPCError{Code: ErrCodeInvalidParams, Message: "Invalid params"} + + // ErrInternal represents a JSON-RPC error indicating an unspecified internal error within the server. + ErrInternal = &jsonRPCError{Code: ErrCodeInternal, Message: "Internal error"} ) diff --git a/proxy/jsonrpc/proxy_test.go b/proxy/jsonrpc/proxy_test.go index e7c8201..7bed78f 100644 --- a/proxy/jsonrpc/proxy_test.go +++ b/proxy/jsonrpc/proxy_test.go @@ -38,7 +38,7 @@ func (s *ProxyTestSuite) SetupTest() { s.client = client s.Exec = client s.cleanup = func() { - client.Stop() + _ = client.Stop() s.server.Close() } } diff --git a/proxy/jsonrpc/server.go b/proxy/jsonrpc/server.go index e89853d..a7e44aa 100644 --- a/proxy/jsonrpc/server.go +++ b/proxy/jsonrpc/server.go @@ -10,11 +10,13 @@ import ( "github.com/rollkit/go-execution/types" ) +// Server defines JSON-RPC proxy server for execution API. type Server struct { exec execution.Execute config *Config } +// NewServer initializes and returns a new Server instance with the given execution interface and configuration. func NewServer(exec execution.Execute, config *Config) *Server { if config == nil { config = DefaultConfig() @@ -200,5 +202,5 @@ func writeResponse(w http.ResponseWriter, id interface{}, result interface{}, er } w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(response) + _ = json.NewEncoder(w).Encode(response) // TODO(tzdybal): add proper error handling } diff --git a/test/dummy.go b/test/dummy.go index 7129ab0..cf8fc8d 100644 --- a/test/dummy.go +++ b/test/dummy.go @@ -22,19 +22,24 @@ func NewExecute() *Execute { } } +// InitChain initializes the chain state with the given genesis time, initial height, and chain ID. +// It returns the state root hash, the maximum byte size, and an error if the initialization fails. func (e *Execute) InitChain(genesisTime time.Time, initialHeight uint64, chainID string) (types.Hash, uint64, error) { return e.stateRoot, e.maxBytes, nil } +// GetTxs returns the list of transactions (types.Tx) within the Execute instance and an error if any. func (e *Execute) GetTxs() ([]types.Tx, error) { return e.txs, nil } +// ExecuteTxs simulate execution of transactions. func (e *Execute) ExecuteTxs(txs []types.Tx, blockHeight uint64, timestamp time.Time, prevStateRoot types.Hash) (types.Hash, uint64, error) { e.txs = append(e.txs, txs...) return e.stateRoot, e.maxBytes, nil } +// SetFinal marks block at given height as finalized. Currently not implemented. func (e *Execute) SetFinal(blockHeight uint64) error { return nil } diff --git a/test/dummy_test.go b/test/dummy_test.go index c98648c..40670ec 100644 --- a/test/dummy_test.go +++ b/test/dummy_test.go @@ -6,6 +6,14 @@ import ( "github.com/stretchr/testify/suite" ) +type DummyTestSuite struct { + ExecuteSuite +} + +func (s *DummyTestSuite) SetupTest() { + s.Exec = NewExecute() +} + func TestDummySuite(t *testing.T) { suite.Run(t, new(DummyTestSuite)) } diff --git a/test/suite.go b/test/suite.go index f72d7bd..ddcf192 100644 --- a/test/suite.go +++ b/test/suite.go @@ -9,13 +9,13 @@ import ( "github.com/rollkit/go-execution/types" ) +// ExecuteSuite is a reusable test suite for Execution API implementations. type ExecuteSuite struct { suite.Suite Exec execution.Execute } -func (s *ExecuteSuite) SetupTest() {} - +// TestInitChain tests InitChain method. func (s *ExecuteSuite) TestInitChain() { genesisTime := time.Now().UTC() initialHeight := uint64(1) @@ -27,12 +27,14 @@ func (s *ExecuteSuite) TestInitChain() { s.Greater(maxBytes, uint64(0)) } +// TestGetTxs tests GetTxs method. func (s *ExecuteSuite) TestGetTxs() { txs, err := s.Exec.GetTxs() s.Require().NoError(err) s.NotNil(txs) } +// TestExecuteTxs tests ExecuteTxs method. func (s *ExecuteSuite) TestExecuteTxs() { txs := []types.Tx{[]byte("tx1"), []byte("tx2")} blockHeight := uint64(1) @@ -45,15 +47,8 @@ func (s *ExecuteSuite) TestExecuteTxs() { s.Greater(maxBytes, uint64(0)) } +// TestSetFinal tests SetFinal method. func (s *ExecuteSuite) TestSetFinal() { err := s.Exec.SetFinal(1) s.Require().NoError(err) } - -type DummyTestSuite struct { - ExecuteSuite -} - -func (s *DummyTestSuite) SetupTest() { - s.Exec = NewExecute() -} diff --git a/types/types.go b/types/types.go index 1742f9b..976721f 100644 --- a/types/types.go +++ b/types/types.go @@ -4,5 +4,8 @@ import ( "github.com/celestiaorg/go-header" ) +// Tx represents a transaction in the form of a byte slice. type Tx []byte + +// Hash is a type alias for header.Hash type Hash = header.Hash