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
26 changes: 22 additions & 4 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
name: Setup Environment
description: Sets up Go and installs system dependencies
description: Sets up Go (dynamically from go.mod) and installs system dependencies

inputs: {}
outputs:
go-version:
description: "Go version parsed from go.mod"
value: ${{ steps.get-go-version.outputs.version }}
runs:
using: "composite"
steps:
- name: Set up Go
- name: Get Go version from go.mod
id: get-go-version
shell: bash
run: |
GO_VERSION=$(grep -E '^go [0-9]+\.[0-9]+(\.[0-9]+)?$' go.mod | cut -d ' ' -f 2)
echo "Found Go version: $GO_VERSION"
echo "version=$GO_VERSION" >> $GITHUB_OUTPUT

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.24'
go-version: ${{ steps.get-go-version.outputs.version }}
cache: true

- name: Install libwebp-dev
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libwebp-dev

- name: Set Go Private Modules
shell: bash

run: |
go env -w GOPRIVATE=github.com/LumeraProtocol/lumera
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,8 @@ jobs:
- name: Configure Git Safe Directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE

- name: Get Go version from go.mod
id: go-version
run: |
GO_VERSION=$(grep -E '^go [0-9]+\.[0-9]+(\.[0-9]+)?$' go.mod | cut -d ' ' -f 2)
echo "Found go directive version: $GO_VERSION"
echo "version=$GO_VERSION" >> $GITHUB_OUTPUT

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ steps.go-version.outputs.version }}
cache: true
- name: Setup Go and dependencies
uses: ./.github/actions/setup-env

- name: Prepare Build Variables
id: vars
Expand All @@ -58,13 +48,6 @@ jobs:
echo "- build_id: $build_id"
echo "- binary_name: supernode-linux-amd64"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebp-dev
# Fix for Lumera module checksum issue
go env -w GOPRIVATE=github.com/LumeraProtocol/lumera

- name: Build binary
run: |
mkdir -p release
Expand Down Expand Up @@ -128,32 +111,15 @@ jobs:
- name: Configure Git Safe Directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE

- name: Get Go version from go.mod
id: go-version
run: |
GO_VERSION=$(grep -E '^go [0-9]+\.[0-9]+(\.[0-9]+)?$' go.mod | cut -d ' ' -f 2)
echo "Found go directive version: $GO_VERSION"
echo "version=$GO_VERSION" >> $GITHUB_OUTPUT

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ steps.go-version.outputs.version }}
cache: true
- name: Setup Go and dependencies
uses: ./.github/actions/setup-env

- name: Prepare Release Variables
id: vars
run: |
repo_name=${GITHUB_REPOSITORY##*/}
echo "binary_name=supernode-linux-amd64" >> $GITHUB_OUTPUT

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebp-dev
# Fix for Lumera module checksum issue
go env -w GOPRIVATE=github.com/LumeraProtocol/lumera

- name: Build Release Version
run: |
mkdir -p release
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3

uses: actions/checkout@v4
- name: Setup Go and system deps
uses: ./.github/actions/setup-env

Expand All @@ -33,7 +32,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Go and system deps
uses: ./.github/actions/setup-env
Expand All @@ -52,7 +51,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Go and system deps
uses: ./.github/actions/setup-env
Expand All @@ -67,7 +66,7 @@ jobs:
run: |
cd tests/scripts
chmod +x ./install-lumera.sh
sudo ./install-lumera.sh
sudo ./install-lumera.sh latest-tag

- name: Setup Supernode environments
run: |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/LumeraProtocol/supernode/supernode => ./supernode

require (
cosmossdk.io/math v1.5.3
github.com/LumeraProtocol/lumera v1.0.1
github.com/LumeraProtocol/lumera v1.1.0
github.com/LumeraProtocol/rq-go v0.2.1
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/cenkalti/backoff/v4 v4.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3
github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ=
github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/LumeraProtocol/lumera v1.0.1 h1:gnSbyQfVeYS2pCvR2AxrD8UWR++IEVYz4ywk3GiI25k=
github.com/LumeraProtocol/lumera v1.0.1/go.mod h1:c1M+sjewuCvxw+pznwlspUzenDJI8Y+suKB3RFKS2Wo=
github.com/LumeraProtocol/lumera v1.1.0 h1:pxosS4m9W/nWIjvCHU2itX2SvG7Q05K2/EdJ666yqyY=
github.com/LumeraProtocol/lumera v1.1.0/go.mod h1:c1M+sjewuCvxw+pznwlspUzenDJI8Y+suKB3RFKS2Wo=
github.com/LumeraProtocol/rq-go v0.2.1 h1:8B3UzRChLsGMmvZ+UVbJsJj6JZzL9P9iYxbdUwGsQI4=
github.com/LumeraProtocol/rq-go v0.2.1/go.mod h1:APnKCZRh1Es2Vtrd2w4kCLgAyaL5Bqrkz/BURoRJ+O8=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
Expand Down
1 change: 1 addition & 0 deletions p2p/kademlia/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func NewDHT(ctx context.Context, store Store, metaStore MetaStore, options *Opti
Keyring: options.Keyring,
LocalIdentity: string(options.ID),
PeerType: securekeyx.Supernode,
Validator: lumera.NewSecureKeyExchangeValidator(options.LumeraClient),
},
})
if err != nil {
Expand Down
15 changes: 15 additions & 0 deletions pkg/lumera/lumera_mock.go

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

15 changes: 15 additions & 0 deletions pkg/lumera/modules/action/action_mock.go

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

50 changes: 50 additions & 0 deletions pkg/lumera/modules/action_msg/action_msg_mock.go

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

14 changes: 0 additions & 14 deletions pkg/lumera/modules/node/node_mock.go

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

15 changes: 15 additions & 0 deletions pkg/lumera/modules/supernode/supernode_mock.go

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

38 changes: 38 additions & 0 deletions pkg/lumera/validator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package lumera

import (
"context"
"fmt"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
sntypes "github.com/LumeraProtocol/lumera/x/supernode/v1/types"
)

type SecureKeyExchangeValidator struct {
lumeraClient Client
}

func NewSecureKeyExchangeValidator(lumeraClient Client) *SecureKeyExchangeValidator {
return &SecureKeyExchangeValidator{
lumeraClient: lumeraClient,
}
}

func (v *SecureKeyExchangeValidator) AccountInfoByAddress(ctx context.Context, addr string) (*authtypes.QueryAccountInfoResponse, error) {
accountInfo, err := v.lumeraClient.Auth().AccountInfoByAddress(ctx, addr)
if err != nil {
return nil, fmt.Errorf("failed to get account info: %w", err)
}
return accountInfo, nil
}

func (v *SecureKeyExchangeValidator) GetSupernodeBySupernodeAddress(ctx context.Context, address string) (*sntypes.SuperNode, error) {
supernodeInfo, err := v.lumeraClient.SuperNode().GetSupernodeBySupernodeAddress(ctx, address)
if err != nil {
return nil, fmt.Errorf("failed to get supernode info: %w", err)
}
if supernodeInfo == nil {
return nil, fmt.Errorf("supernode info is nil")
}
return supernodeInfo, nil
}
Loading