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

inputs: {}
inputs:
bust_lumera_retag:
description: "One-time: remove lumera v1.8.0 sums after retag"
required: false
default: 'false'
outputs:
go-version:
description: "Go version parsed from go.mod"
Expand Down Expand Up @@ -29,6 +33,18 @@ runs:
sudo apt-get update
sudo apt-get install -y libwebp-dev make

- name: One-time reset retagged lumera checksums
if: ${{ inputs.bust_lumera_retag == 'true' }}
shell: bash
run: |
echo "Busting go.sum entries for github.com/LumeraProtocol/lumera v1.8.0 (one-time)"
# Remove stale checksums in all local modules
find . -name 'go.sum' -maxdepth 3 -print0 | xargs -0 -I{} sed -i \
'/github.com\/LumeraProtocol\/lumera v1.8.0/d' {}
# Clear module/build caches to avoid cached zips
go clean -modcache || true
rm -rf "$(go env GOCACHE)" || true

- name: Set Go Private Modules
shell: bash
run: |
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build&release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:

- name: Setup Go and dependencies
uses: ./.github/actions/setup-env
with:
bust_lumera_retag: 'true'

- name: Build binaries
run: |
Expand Down Expand Up @@ -72,6 +74,8 @@ jobs:

- name: Setup Go and dependencies
uses: ./.github/actions/setup-env
with:
bust_lumera_retag: 'true'

- name: Prepare Release Variables
id: vars
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go and system deps
uses: ./.github/actions/setup-env
uses: ./.github/actions/setup-env
with:
bust_lumera_retag: 'true'
- name: Go mod tidy
run: go mod tidy

Expand All @@ -32,7 +34,12 @@ jobs:
uses: actions/checkout@v4

- name: Setup Go and system deps
uses: ./.github/actions/setup-env
uses: ./.github/actions/setup-env
with:
bust_lumera_retag: 'true'

- name: Go mod tidy
run: go mod tidy

- name: Run integration tests
run: go test -v ./tests/integration/...
Expand All @@ -46,7 +53,12 @@ jobs:
uses: actions/checkout@v4

- name: Setup Go and system deps
uses: ./.github/actions/setup-env
uses: ./.github/actions/setup-env
with:
bust_lumera_retag: 'true'

- name: Go mod tidy
run: go mod tidy


- name: Install Lumera
Expand Down
2 changes: 1 addition & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.50
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0 h1:ig/FpDD2JofP/NExKQUbn7uOSZzJAQqogfqluZK4ed4=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0/go.mod h1:otE2jQekW/PqXk1Awf5lmfokJx4uwuqcj1ab5SpGeW0=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/LumeraProtocol/lumera v1.8.0 h1:0t5/6qOSs9wKti7utPAWo9Jq8wk2X+L/eEaH8flk/Hc=
github.com/LumeraProtocol/lumera v1.8.0 h1:uE7mrK2/F6naY6Y09+D1DP9n1/EVkE3IS8w0dzCMESY=
github.com/LumeraProtocol/lumera v1.8.0/go.mod h1:38uAZxxleZyXaWKbqOQKwjw7CSX92lTxdF+B7c4SRPw=
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=
Expand Down
2 changes: 1 addition & 1 deletion pkg/lumera/modules/action_msg/helpers.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package action_msg

import (
"encoding/json"
"fmt"
"strconv"
"time"
"encoding/json"

actiontypes "github.com/LumeraProtocol/lumera/x/action/v1/types"
"github.com/LumeraProtocol/supernode/v2/pkg/lumera/util"
Expand Down
14 changes: 6 additions & 8 deletions pkg/lumera/modules/supernode/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ func newModule(conn *grpc.ClientConn) (Module, error) {
}, nil
}

// GetTopSuperNodesForBlock gets the top supernodes for a specific block height
func (m *module) GetTopSuperNodesForBlock(ctx context.Context, blockHeight uint64) (*types.QueryGetTopSuperNodesForBlockResponse, error) {
resp, err := m.client.GetTopSuperNodesForBlock(ctx, &types.QueryGetTopSuperNodesForBlockRequest{
BlockHeight: int32(blockHeight),
// Commeting the req params is intentional, it matches chain behaviour, at the moment in top 10 verification.
// State: types.SuperNodeStateActive.String(),
// Limit: 10,
})
// GetTopSuperNodesForBlock gets the top supernodes for a specific request
func (m *module) GetTopSuperNodesForBlock(ctx context.Context, req *types.QueryGetTopSuperNodesForBlockRequest) (*types.QueryGetTopSuperNodesForBlockResponse, error) {
if req == nil {
return nil, fmt.Errorf("request cannot be nil")
}
resp, err := m.client.GetTopSuperNodesForBlock(ctx, req)
if err != nil {
return nil, fmt.Errorf("failed to get top supernodes: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/lumera/modules/supernode/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type SuperNodeInfo struct {

// Module defines the interface for interacting with the supernode module
type Module interface {
GetTopSuperNodesForBlock(ctx context.Context, blockHeight uint64) (*types.QueryGetTopSuperNodesForBlockResponse, error)
GetTopSuperNodesForBlock(ctx context.Context, req *types.QueryGetTopSuperNodesForBlockRequest) (*types.QueryGetTopSuperNodesForBlockResponse, error)
GetSuperNode(ctx context.Context, address string) (*types.QueryGetSuperNodeResponse, error)
GetSupernodeBySupernodeAddress(ctx context.Context, address string) (*types.SuperNode, error)
GetSupernodeWithLatestAddress(ctx context.Context, address string) (*SuperNodeInfo, error)
Expand Down
8 changes: 4 additions & 4 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.

2 changes: 1 addition & 1 deletion pkg/testutil/lumera.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ type MockSupernodeModule struct {
addresses []string
}

func (m *MockSupernodeModule) GetTopSuperNodesForBlock(ctx context.Context, blockHeight uint64) (*supernodeTypes.QueryGetTopSuperNodesForBlockResponse, error) {
func (m *MockSupernodeModule) GetTopSuperNodesForBlock(ctx context.Context, req *supernodeTypes.QueryGetTopSuperNodesForBlockRequest) (*supernodeTypes.QueryGetTopSuperNodesForBlockResponse, error) {
return &supernodeTypes.QueryGetTopSuperNodesForBlockResponse{}, nil
}

Expand Down
1 change: 0 additions & 1 deletion pkg/utils/hasher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,3 @@ func TestHashReaderBLAKE3ReadError(t *testing.T) {
t.Fatalf("expected read error to propagate, got %v", err)
}
}

5 changes: 4 additions & 1 deletion sdk/adapters/lumera/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,10 @@ func (a *Adapter) GetSupernodes(ctx context.Context, height int64) ([]Supernode,
}
blockHeight = uint64(height)

resp, err := a.client.SuperNode().GetTopSuperNodesForBlock(ctx, blockHeight)
resp, err := a.client.SuperNode().GetTopSuperNodesForBlock(ctx, &sntypes.QueryGetTopSuperNodesForBlockRequest{
BlockHeight: int32(blockHeight),
//TODO : Update after hotfix on chain
})
if err != nil {
a.logger.Error(ctx, "Failed to get supernodes", "height", height, "error", err)
return nil, fmt.Errorf("failed to get supernodes: %w", err)
Expand Down
4 changes: 3 additions & 1 deletion supernode/adaptors/lumera.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ func (l *lumeraImpl) GetAction(ctx context.Context, actionID string) (*actiontyp
}

func (l *lumeraImpl) GetTopSupernodes(ctx context.Context, blockHeight uint64) (*sntypes.QueryGetTopSuperNodesForBlockResponse, error) {
return l.c.SuperNode().GetTopSuperNodesForBlock(ctx, blockHeight)
return l.c.SuperNode().GetTopSuperNodesForBlock(ctx, &sntypes.QueryGetTopSuperNodesForBlockRequest{
BlockHeight: int32(blockHeight),
})
}

func (l *lumeraImpl) Verify(ctx context.Context, address string, msg []byte, sig []byte) error {
Expand Down