Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ go.work.sum
.env
/data
/tests/system/data
tests/system/supernode-data1
tests/system/supernode-data2
tests/system/supernode-data3
tests/system/**/supernode-data*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ system-test-setup: install-lumera setup-supernodes
@if [ -f claims.csv ]; then cp claims.csv ~/; echo "Copied claims.csv to home directory."; fi

# Run system tests with complete setup
test-system-full:
test-e2e:
@echo "Running system tests..."
@cd tests/system && go test -tags=system_test -v .

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ require (
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
github.com/x-cray/logrus-prefixed-formatter v0.5.2
go.uber.org/mock v0.5.2
go.uber.org/ratelimit v0.3.1
golang.org/x/crypto v0.36.0
golang.org/x/sync v0.12.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,8 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko=
go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
Expand Down
56 changes: 56 additions & 0 deletions pkg/codec/codec_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions pkg/dd/dd_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 12 additions & 21 deletions pkg/lumera/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/LumeraProtocol/supernode/pkg/lumera/modules/tx"
)

// lumeraClient implements the Client interface
type lumeraClient struct {
cfg *Config
authMod auth.Module
Expand All @@ -23,34 +22,26 @@ type lumeraClient struct {
conn Connection
}

// newClient creates a new Lumera client with provided options
func newClient(ctx context.Context, cfg *Config) (Client, error) {

// Create a single gRPC connection to be shared by all modules
conn, err := newGRPCConnection(ctx, cfg.GRPCAddr)
if err != nil {
return nil, err
}

// Initialize all module clients with the shared connection
authModule, err := auth.NewModule(conn.GetConn())
txModule, err := tx.NewModule(conn.GetConn())
if err != nil {
conn.Close()
return nil, err
}

actionModule, err := action.NewModule(conn.GetConn())
authModule, err := auth.NewModule(conn.GetConn())
if err != nil {
conn.Close()
return nil, err
}

actionMsgModule, err := action_msg.NewModule(
conn.GetConn(),
cfg.keyring,
cfg.KeyName,
cfg.ChainID,
)
actionModule, err := action.NewModule(conn.GetConn())
if err != nil {
conn.Close()
return nil, err
Expand All @@ -62,13 +53,20 @@ func newClient(ctx context.Context, cfg *Config) (Client, error) {
return nil, err
}

txModule, err := tx.NewModule(conn.GetConn())
nodeModule, err := node.NewModule(conn.GetConn(), cfg.keyring)
if err != nil {
conn.Close()
return nil, err
}

nodeModule, err := node.NewModule(conn.GetConn(), cfg.keyring)
actionMsgModule, err := action_msg.NewModule(
conn.GetConn(),
authModule, // For account info
txModule, // For transaction operations
cfg.keyring, // For signing
cfg.KeyName, // Key to use
cfg.ChainID, // Chain configuration
)
if err != nil {
conn.Close()
return nil, err
Expand All @@ -86,37 +84,30 @@ func newClient(ctx context.Context, cfg *Config) (Client, error) {
}, nil
}

// Auth returns the Auth module client
func (c *lumeraClient) Auth() auth.Module {
return c.authMod
}

// Action returns the Action module client
func (c *lumeraClient) Action() action.Module {
return c.actionMod
}

// ActionMsg returns the ActionMsg module client
func (c *lumeraClient) ActionMsg() action_msg.Module {
return c.actionMsgMod
}

// SuperNode returns the SuperNode module client
func (c *lumeraClient) SuperNode() supernode.Module {
return c.supernodeMod
}

// Tx returns the Transaction module client
func (c *lumeraClient) Tx() tx.Module {
return c.txMod
}

// Node returns the Node module client
func (c *lumeraClient) Node() node.Module {
return c.nodeMod
}

// Close closes all connections
func (c *lumeraClient) Close() error {
if c.conn != nil {
return c.conn.Close()
Expand Down
Loading