diff --git a/sdk/config/constants.go b/sdk/config/constants.go deleted file mode 100644 index 385522ea..00000000 --- a/sdk/config/constants.go +++ /dev/null @@ -1,4 +0,0 @@ -package config - -// DefaultSupernodePort is the default port used for supernode gRPC connections -const DefaultSupernodePort = "4444" \ No newline at end of file diff --git a/sdk/net/impl.go b/sdk/net/impl.go index 07bda471..ab0f7b28 100644 --- a/sdk/net/impl.go +++ b/sdk/net/impl.go @@ -10,7 +10,6 @@ import ( "github.com/LumeraProtocol/supernode/v2/pkg/net/grpc/client" "github.com/LumeraProtocol/supernode/v2/sdk/adapters/lumera" "github.com/LumeraProtocol/supernode/v2/sdk/adapters/supernodeservice" - "github.com/LumeraProtocol/supernode/v2/sdk/config" "github.com/LumeraProtocol/supernode/v2/sdk/log" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -65,16 +64,13 @@ func NewSupernodeClient(ctx context.Context, logger log.Logger, keyring keyring. return nil, fmt.Errorf("failed to create credentials: %w", err) } - // Append default port to the IP address from blockchain - endpointWithPort := fmt.Sprintf("%s:%s", targetSupernode.GrpcEndpoint, config.DefaultSupernodePort) - // Format connection address with identity for secure connection targetAddress := ltc.FormatAddressWithIdentity( targetSupernode.CosmosAddress, - endpointWithPort, + targetSupernode.GrpcEndpoint, ) - logger.Info(ctx, "Connecting to supernode securely", "endpoint", endpointWithPort, "target_id", targetSupernode.CosmosAddress, "local_id", factoryConfig.LocalCosmosAddress, "peer_type", factoryConfig.PeerType) + logger.Info(ctx, "Connecting to supernode securely", "endpoint", targetSupernode.GrpcEndpoint, "target_id", targetSupernode.CosmosAddress, "local_id", factoryConfig.LocalCosmosAddress, "peer_type", factoryConfig.PeerType) // Use provided client options or defaults options := clientOptions @@ -91,7 +87,7 @@ func NewSupernodeClient(ctx context.Context, logger log.Logger, keyring keyring. targetSupernode.CosmosAddress, err) } - logger.Info(ctx, "Connected to supernode securely", "address", targetSupernode.CosmosAddress, "endpoint", endpointWithPort) + logger.Info(ctx, "Connected to supernode securely", "address", targetSupernode.CosmosAddress, "endpoint", targetSupernode.GrpcEndpoint) // Create service clients cascadeClient := supernodeservice.NewCascadeAdapter( diff --git a/tests/system/config.test-1.yml b/tests/system/config.test-1.yml index 74fc85a2..eb214cd4 100644 --- a/tests/system/config.test-1.yml +++ b/tests/system/config.test-1.yml @@ -2,7 +2,7 @@ supernode: key_name: "testkey1" identity: "lumera1em87kgrvgttrkvuamtetyaagjrhnu3vjy44at4" - host: "127.0.0.1" + host: "0.0.0.0" port: 4444 gateway_port: 8002 diff --git a/tests/system/config.test-2.yml b/tests/system/config.test-2.yml index d9cb5d2b..1b044a89 100644 --- a/tests/system/config.test-2.yml +++ b/tests/system/config.test-2.yml @@ -3,9 +3,9 @@ supernode: key_name: "testkey2" identity: "lumera1cf0ms9ttgdvz6zwlqfty4tjcawhuaq69p40w0c" - host: "127.0.0.2" - port: 4444 - gateway_port: 8002 + host: "0.0.0.0" + port: 4446 + gateway_port: 8003 # Keyring Configuration keyring: @@ -15,7 +15,7 @@ keyring: # P2P Network Configuration p2p: - port: 4445 + port: 4447 data_dir: "data/p2p" # Lumera Chain Configuration diff --git a/tests/system/config.test-3.yml b/tests/system/config.test-3.yml index e3003693..2a259066 100644 --- a/tests/system/config.test-3.yml +++ b/tests/system/config.test-3.yml @@ -3,9 +3,9 @@ supernode: key_name: "testkey3" identity: "lumera1cjyc4ruq739e2lakuhargejjkr0q5vg6x3d7kp" - host: "127.0.0.3" - port: 4444 - gateway_port: 8002 + host: "0.0.0.0" + port: 4448 + gateway_port: 8004 # Keyring Configuration keyring: @@ -15,7 +15,7 @@ keyring: # P2P Network Configuration p2p: - port: 4445 + port: 4449 data_dir: "data/p2p" # Lumera Chain Configuration diff --git a/tests/system/e2e_cascade_test.go b/tests/system/e2e_cascade_test.go index bfabacbd..851ef28e 100644 --- a/tests/system/e2e_cascade_test.go +++ b/tests/system/e2e_cascade_test.go @@ -87,7 +87,7 @@ func TestCascadeE2E(t *testing.T) { t.Log("Registering multiple supernodes to process requests") // Helper function to register a supernode - registerSupernode := func(nodeKey string, ipAddr string, addr string, p2pPort string) { + registerSupernode := func(nodeKey string, port string, addr string, p2pPort string) { // Get account and validator addresses for registration accountAddr := cli.GetKeyAddr(nodeKey) valAddrOutput := cli.Keys("keys", "show", nodeKey, "--bech", "val", "-a") @@ -99,7 +99,7 @@ func TestCascadeE2E(t *testing.T) { registerCmd := []string{ "tx", "supernode", "register-supernode", valAddr, - ipAddr, + "localhost:" + port, addr, "--p2p-port", p2pPort, "--from", nodeKey, @@ -112,10 +112,10 @@ func TestCascadeE2E(t *testing.T) { sut.AwaitNextBlock(t) } - // Register three supernodes with different IP addresses - registerSupernode("node0", "127.0.0.1", "lumera1em87kgrvgttrkvuamtetyaagjrhnu3vjy44at4", "4445") - registerSupernode("node1", "127.0.0.2", "lumera1cf0ms9ttgdvz6zwlqfty4tjcawhuaq69p40w0c", "4447") - registerSupernode("node2", "127.0.0.3", "lumera1cjyc4ruq739e2lakuhargejjkr0q5vg6x3d7kp", "4449") + // Register three supernodes with different ports + registerSupernode("node0", "4444", "lumera1em87kgrvgttrkvuamtetyaagjrhnu3vjy44at4", "4445") + registerSupernode("node1", "4446", "lumera1cf0ms9ttgdvz6zwlqfty4tjcawhuaq69p40w0c", "4447") + registerSupernode("node2", "4448", "lumera1cjyc4ruq739e2lakuhargejjkr0q5vg6x3d7kp", "4449") t.Log("Successfully registered three supernodes") // Fund Lume