Skip to content

Commit

Permalink
fix duplicate gvgs in test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Dec 18, 2023
1 parent df63086 commit 1c66afe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions e2e/core/basesuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"sync"
"time"

"golang.org/x/exp/slices"

sdkmath "cosmossdk.io/math"
"github.com/cometbft/cometbft/crypto/tmhash"
tmlog "github.com/cometbft/cometbft/libs/log"
Expand Down Expand Up @@ -682,6 +684,17 @@ func (s *BaseSuite) CreateObject(user keys.KeyManager, primarySP *StorageProvide
}

func (s *BaseSuite) CreateGlobalVirtualGroup(sp *StorageProvider, familyID uint32, secondarySPIDs []uint32, depositAmount int64) (uint32, uint32) {

// check if the GVG already exits
if familyID != 0 {
resp, _ := s.Client.GlobalVirtualGroupByFamilyID(context.Background(), &virtualgroupmoduletypes.QueryGlobalVirtualGroupByFamilyIDRequest{GlobalVirtualGroupFamilyId: familyID})
for _, gvg := range resp.GlobalVirtualGroups {
if slices.Equal(secondarySPIDs, gvg.SecondarySpIds) {
return gvg.Id, familyID
}
}
}

// Create a GVG for each sp by default
deposit := sdk.Coin{
Denom: s.Config.Denom,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98
google.golang.org/grpc v1.58.3
google.golang.org/protobuf v1.31.0
Expand Down Expand Up @@ -159,7 +160,6 @@ require (
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
Expand Down

0 comments on commit 1c66afe

Please sign in to comment.