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
13 changes: 7 additions & 6 deletions devnet/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ module gen
go 1.25.5

replace (
github.com/LumeraProtocol/lumera => ..
github.com/LumeraProtocol/sdk-go => ../../sdk-go
github.com/LumeraProtocol/supernode/v2 => ../../supernode
// Local development - uncomment these for local testing
// Comment lines with github.com/LumeraProtocol/ before releasing
// github.com/LumeraProtocol/lumera => ..
//github.com/LumeraProtocol/sdk-go => ../../sdk-go
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.50.14
github.com/envoyproxy/protoc-gen-validate => github.com/bufbuild/protoc-gen-validate v1.3.0
github.com/lyft/protoc-gen-validate => github.com/envoyproxy/protoc-gen-validate v1.3.0
Expand All @@ -16,8 +17,8 @@ replace (
require (
cosmossdk.io/api v0.9.2
cosmossdk.io/math v1.5.3
github.com/LumeraProtocol/lumera v1.9.0
github.com/LumeraProtocol/sdk-go v1.0.3
github.com/LumeraProtocol/lumera v1.9.1
github.com/LumeraProtocol/sdk-go v1.0.5
github.com/cosmos/cosmos-sdk v0.53.0
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-go/v10 v10.3.0
Expand All @@ -41,7 +42,7 @@ require (
github.com/DataDog/datadog-go v4.8.3+incompatible // indirect
github.com/DataDog/zstd v1.5.7 // indirect
github.com/LumeraProtocol/rq-go v0.2.1 // indirect
github.com/LumeraProtocol/supernode/v2 v2.4.10 // indirect
github.com/LumeraProtocol/supernode/v2 v2.4.19 // indirect
github.com/Masterminds/semver/v3 v3.3.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down
6 changes: 6 additions & 0 deletions devnet/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,14 @@ 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.9.1 h1:4hI0sHHrZOiKP+S3GpLNHYeQTatXBftmcUE3ZDA91mU=
github.com/LumeraProtocol/lumera v1.9.1/go.mod h1:38BX04sncJe191asQ4rU/EeYyVflybkU0VN4LDvLKps=
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/LumeraProtocol/sdk-go v1.0.5 h1:KXeJyZNkobkwouoiAzRo3qSpv4aAnqtfaejogumun6w=
github.com/LumeraProtocol/sdk-go v1.0.5/go.mod h1:Y2RhYJxjE3zv2wB0pJZZ4TE9cclrv7ZTrMCaj6+G9T8=
github.com/LumeraProtocol/supernode/v2 v2.4.19 h1:7m+QKSb9QFtrF3ZRoHeuoRYZ9SWPiLOiWMe+BfwoEy8=
github.com/LumeraProtocol/supernode/v2 v2.4.19/go.mod h1:2juzppFSk/vP0kRsROIRxqc4WHBfm3dq9twD6KndWrA=
github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4=
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
Expand Down
118 changes: 118 additions & 0 deletions devnet/tests/hermes/ibc_ica_app_pubkey_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package hermes

import (
"context"
"fmt"
stdlog "log"
"os"
"strings"
"time"

actiontypes "github.com/LumeraProtocol/lumera/x/action/v1/types"
"github.com/LumeraProtocol/sdk-go/cascade"
sdkcrypto "github.com/LumeraProtocol/sdk-go/pkg/crypto"
"github.com/LumeraProtocol/sdk-go/types"
)

type supernodeInfoLogger struct {
logger *stdlog.Logger
}

func newSupernodeInfoLogger() *supernodeInfoLogger {
return &supernodeInfoLogger{logger: stdlog.New(os.Stdout, "", stdlog.LstdFlags)}
}

func (l *supernodeInfoLogger) Printf(format string, v ...interface{}) {
l.logf(format, v...)
}

func (l *supernodeInfoLogger) Infof(format string, v ...interface{}) {
l.logf(format, v...)
}

func (l *supernodeInfoLogger) Warnf(format string, v ...interface{}) {
l.logf(format, v...)
}

func (l *supernodeInfoLogger) logf(format string, v ...interface{}) {
msg := fmt.Sprintf(format, v...)
if strings.Contains(msg, "[supernode] DEBUG") {
return
}
l.logger.Printf("%s", msg)
}

func (s *ibcSimdSuite) TestICARequestActionAppPubkeyRequired() {
ctx, cancel := context.WithTimeout(context.Background(), icaTestTimeout)
defer cancel()

s.T().Log("ica: resolve simd owner address")
ownerAddr, err := s.resolveSimdOwnerAddress(ctx)
s.Require().NoError(err, "resolve simd owner address")

s.T().Log("ica: ensure ICA address")
icaAddr, err := s.ensureICAAddress(ctx, ownerAddr)
s.Require().NoError(err, "ensure ICA address")
s.Require().NotEmpty(icaAddr, "ICA address is empty")

s.T().Log("ica: load lumera keyring")
kr, _, lumeraAddr, err := sdkcrypto.LoadKeyringFromMnemonic(s.lumera.KeyName, s.lumera.MnemonicFile)
s.Require().NoError(err, "load lumera keyring")
s.Require().NotEmpty(lumeraAddr, "lumera address is empty")

s.T().Log("ica: load simd key for app pubkey")
simdPubkey, simdAddr, err := sdkcrypto.ImportKeyFromMnemonic(kr, s.simd.KeyName, s.simd.MnemonicFile, "cosmos")
s.Require().NoError(err, "load simd key")
if ownerAddr != "" {
s.Require().Equal(ownerAddr, simdAddr, "simd owner address mismatch")
}

s.T().Log("ica: create lumera blockchain client")
lumeraClient, err := newLumeraBlockchainClient(ctx, s.lumera.ChainID, s.lumera.GRPC, kr, s.lumera.KeyName)
s.Require().NoError(err, "create lumera client")
defer lumeraClient.Close()
actionClient := lumeraClient.Action

s.T().Log("ica: ensure ICA account funded")
err = s.ensureICAFunded(ctx, lumeraClient, lumeraAddr, icaAddr)
s.Require().NoError(err, "fund ICA account")

s.T().Log("ica: create cascade client")
cascadeClient, err := cascade.New(ctx, cascade.Config{
ChainID: s.lumera.ChainID,
GRPCAddr: s.lumera.GRPC,
Address: lumeraAddr,
KeyName: s.lumera.KeyName,
ICAOwnerKeyName: s.simd.KeyName,
ICAOwnerHRP: "cosmos",
Timeout: 30 * time.Second,
}, kr)
s.Require().NoError(err, "create cascade client")
cascadeClient.SetLogger(newSupernodeInfoLogger())
defer cascadeClient.Close()

files, err := createICATestFiles(s.T().TempDir())
s.Require().NoError(err, "create test files")
s.Require().NotEmpty(files, "no test files created")

options := &cascade.UploadOptions{ICACreatorAddress: icaAddr}
msg, _, err := cascadeClient.CreateRequestActionMessage(ctx, icaAddr, files[0].path, options)
s.Require().NoError(err, "build request action without app_pubkey")

_, err = s.sendICARequestTx(ctx, []*actiontypes.MsgRequestAction{msg})
s.Require().Error(err, "expected app_pubkey requirement failure")
if err != nil {
s.Contains(err.Error(), "app_pubkey")
}

options.AppPubkey = simdPubkey
msg, _, err = cascadeClient.CreateRequestActionMessage(ctx, icaAddr, files[0].path, options)
s.Require().NoError(err, "build request action with app_pubkey")

actionIDs, err := s.sendICARequestTx(ctx, []*actiontypes.MsgRequestAction{msg})
s.Require().NoError(err, "send request with app_pubkey")
s.Require().NotEmpty(actionIDs, "no action ids returned")
s.Require().NotEmpty(actionIDs[0], "empty action id response")
_, err = actionClient.WaitForState(ctx, actionIDs[0], types.ActionStatePending, actionPollDelay)
s.Require().NoError(err)
}
Loading