Skip to content

Conversation

@akobrin1
Copy link
Contributor

No description provided.

@akobrin1 akobrin1 requested a review from Copilot May 22, 2025 19:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the SecureKeyX validator into the codebase, integrating it with secure key exchange operations across server and client components. Key changes include:

  • Injection of a lumeraClient dependency and validator within server credential creation and related tests.
  • Updates to factory and client creation functions to accept and pass along the lumeraClient.
  • Addition of a new SecureKeyExchangeValidator implementation in the lumera package.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/integration/securegrpc/secure_connection_test.go Updated integration tests to initialize and use mocked validator objects
supernode/node/supernode/server/server_test.go Updated tests to include lumeraClient mocks and validator parameters
supernode/node/supernode/server/server.go Injected lumeraClient and applied a secure validator in server creds
supernode/cmd/start.go Passed the lumeraClient during server initialization
sdk/task/cascade.go Updated client factory calls with the new lumeraClient parameter
sdk/net/impl.go Adjusted NewSupernodeClient to accept lumeraClient; currently passes nil validator
sdk/net/factory.go Modified NewClientFactory to require and pass the lumeraClient
pkg/lumera/validator.go Added new SecureKeyExchangeValidator implementation
pkg/testutil/* Updated test utilities to account for validator support
go.mod Updated the lumera dependency version

@akobrin1 akobrin1 requested review from a-ok123 and Copilot May 23, 2025 17:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a SecureKeyX validator to centralize Lumera client checks during secure key exchanges and integrates it throughout client creation, credential setup, and DHT initialization.

  • Introduces SecureKeyExchangeValidator wrapping a lumera.Client to expose AccountInfoByAddress and GetSupernodeBySupernodeAddress.
  • Refactors ClientFactory, NewSupernodeClient, and DHT setup to accept and use the new validator.
  • Updates tests, mocks, and CI workflows to support validator injection and dynamic Go version/checkout improvements.

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
supernode/cmd/start.go Passes lumeraClient into server.New for validator support
sdk/task/cascade.go Updates NewClientFactory calls to include the Lumera client
sdk/net/impl.go Wires lumeraClient as Validator in NewSupernodeClient
sdk/net/factory.go Extends ClientFactory with lumeraClient field and ctor change
sdk/adapters/lumera/adapter.go Adds new adapter methods to call Lumera queries
pkg/testutil/lumera.go Enhances mock modules to return meaningful account/supernode data
pkg/testutil/accounts.go Updates SetupTestKeyExchange signature to accept a validator
pkg/net/credentials/lumeratc.go Adds Validator to CommonOptions for transport credentials
pkg/net/credentials/alts/handshake/handshake_test.go Mocks and injects key exchanger validator into handshake tests
pkg/lumera/validator.go Defines SecureKeyExchangeValidator wrapping lumera.Client
pkg/lumera/modules/supernode/supernode_mock.go Adds mock stubs for GetParams
pkg/lumera/modules/node/node_mock.go Removes obsolete Verify stubs from node mock
pkg/lumera/modules/action_msg/action_msg_mock.go Adds generated mock for action_msg module
pkg/lumera/modules/action/action_mock.go Adds mock stubs for GetParams in action module
pkg/lumera/lumera_mock.go Adds ActionMsg mock methods to Lumera client mock
p2p/kademlia/dht.go Injects SecureKeyExchangeValidator into DHT secure credentials
go.mod Bumps github.com/LumeraProtocol/lumera to v1.1.0
.github/workflows/tests.yml Upgrades actions/checkout to v4
.github/workflows/build&release.yml Consolidates setup to setup-env composite action
.github/actions/setup-env/action.yml Adds dynamic Go version parsing and GOPRIVATE setting
Comments suppressed due to low confidence (2)

sdk/net/factory.go:29

  • [nitpick] The parameter and struct field named lumeraClient actually held a validator. Consider renaming to validator or keyExchangerValidator for clarity.
func NewClientFactory(ctx context.Context, logger log.Logger, keyring keyring.Keyring, lumeraClient lumera.Client, config FactoryConfig) *ClientFactory {

pkg/lumera/validator.go:21

  • [nitpick] There are no unit tests covering SecureKeyExchangeValidator. Adding tests for both AccountInfoByAddress and GetSupernodeBySupernodeAddress would verify error paths and nil‐response handling.
func (v *SecureKeyExchangeValidator) AccountInfoByAddress(ctx context.Context, addr string) (*authtypes.QueryAccountInfoResponse, error) {

Keyring: keyring,
LocalIdentity: localCosmosAddress,
PeerType: securekeyx.Supernode,
Validator: lumeraClient,
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing the raw lumera.Client to CommonOptions.Validator may not satisfy the KeyExchangerValidator interface. You should wrap lumeraClient with lumera.NewSecureKeyExchangeValidator(lumeraClient) to provide the expected methods.

Suggested change
Validator: lumeraClient,
Validator: lumera.NewSecureKeyExchangeValidator(lumeraClient),

Copilot uses AI. Check for mistakes.
@akobrin1 akobrin1 merged commit 84d7885 into master May 23, 2025
7 checks passed
@akobrin1 akobrin1 deleted the SecureKeyX_Account_Check branch May 23, 2025 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants