diff --git a/e2e/core/basesuite.go b/e2e/core/basesuite.go index 0ba911dfb..989b443ab 100644 --- a/e2e/core/basesuite.go +++ b/e2e/core/basesuite.go @@ -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" @@ -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, diff --git a/go.mod b/go.mod index 134c77b15..bed9cbb5b 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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