Skip to content

Commit

Permalink
fix proto format
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Dec 4, 2023
1 parent 4d62bb6 commit 44430c3
Show file tree
Hide file tree
Showing 10 changed files with 549 additions and 849 deletions.
17 changes: 9 additions & 8 deletions e2e/tests/virtualgroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"bytes"
"context"
"fmt"
sptypes "github.com/bnb-chain/greenfield/x/sp/types"
"math"
"reflect"
"strconv"
"testing"
"time"

sptypes "github.com/bnb-chain/greenfield/x/sp/types"

sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx"
Expand Down Expand Up @@ -752,7 +753,7 @@ func (s *VirtualGroupTestSuite) TestSPExit() {
s.SendTxBlock(spy.OperatorKey, msgCompleteSwapIn)

// 13. query the swapInInfo should be not found onChain.
swapInInfo, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
_, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
GlobalVirtualGroupFamilyId: familyID,
})
s.Require().Error(err)
Expand Down Expand Up @@ -794,7 +795,7 @@ func (s *VirtualGroupTestSuite) TestSPExit() {
s.SendTxBlock(spy.OperatorKey, msgCancelSwapIn)

// 18 query the swapInInfo not found
swapInInfo, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
_, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
GlobalVirtualGroupId: gvgID2,
})
s.Require().Error(err)
Expand Down Expand Up @@ -971,9 +972,9 @@ func (s *VirtualGroupTestSuite) TestSPExit_SwapInfo_Expired() {
msgReserveSwapIn = virtualgroupmoduletypes.NewMsgReserveSwapIn(spz.OperatorKey.GetAddr(), spx.Info.Id, familyID, 0)
s.SendTxBlockWithExpectErrorString(msgReserveSwapIn, spz.OperatorKey, "already exist SP")

// 7 waits for 5 seconds, the swapIno is expired
// 7 waits for 6 seconds, the swapIno is expired
time.Sleep(6 * time.Second)
swapInInfo, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
_, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
GlobalVirtualGroupFamilyId: familyID,
})
s.Require().Error(err)
Expand Down Expand Up @@ -1081,7 +1082,7 @@ func (s *VirtualGroupTestSuite) TestSPForceExit() {
s.Require().Equal(swapInInfo.SwapInInfo.TargetSpId, spx.Info.Id)

// object not found
swapInInfo, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
_, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
GlobalVirtualGroupId: gvgID,
})
s.Require().Error(err)
Expand All @@ -1090,7 +1091,7 @@ func (s *VirtualGroupTestSuite) TestSPForceExit() {
msgDiscontinueObject := &storagetypes.MsgDiscontinueObject{
Operator: spy.GcKey.GetAddr().String(),
BucketName: bucketName,
ObjectIds: []sdk.Uint{objectResp.ObjectInfo.Id},
ObjectIds: []sdkmath.Uint{objectResp.ObjectInfo.Id},
}
s.SendTxBlock(spy.GcKey, msgDiscontinueObject)
time.Sleep(5 * time.Second)
Expand All @@ -1104,7 +1105,7 @@ func (s *VirtualGroupTestSuite) TestSPForceExit() {
s.SendTxBlock(spy.OperatorKey, msgCompleteSwapIn)

// 9. query the swapInInfo should be not found
swapInInfo, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
_, err = s.Client.SwapInInfo(context.Background(), &virtualgroupmoduletypes.QuerySwapInInfoRequest{
GlobalVirtualGroupFamilyId: familyID,
})
s.Require().Error(err)
Expand Down
2 changes: 1 addition & 1 deletion proto/greenfield/virtualgroup/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,4 @@ message EventCancelSwapIn {
message EventStorageProviderForceExit {
// The id of the storage provider who wants to exit
uint32 storage_provider_id = 1;
}
}
2 changes: 1 addition & 1 deletion proto/greenfield/virtualgroup/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ message Params {
uint64 swap_in_validity_period = 6;
// sp_concurrent_exit_num defines the number of sp allowed for exit concurrently.
uint32 sp_concurrent_exit_num = 7;
}
}
8 changes: 4 additions & 4 deletions proto/greenfield/virtualgroup/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ message AvailableGlobalVirtualGroupFamiliesResponse {
}

message QuerySwapInInfoRequest {
uint32 global_virtual_group_family_id = 1;
uint32 global_virtual_group_id = 2;
uint32 global_virtual_group_family_id = 1;
uint32 global_virtual_group_id = 2;
}

message QuerySwapInInfoResponse {
SwapInInfo swap_in_info = 1;
}
SwapInInfo swap_in_info = 1;
}
3 changes: 2 additions & 1 deletion proto/greenfield/virtualgroup/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ message MsgCancelSwapIn {
}

message MsgCancelSwapInResponse {}

// this line is used by starport scaffolding # proto/tx/message
message MsgStorageProviderForceExit {
option (cosmos.msg.v1.signer) = "authority";
Expand All @@ -255,4 +256,4 @@ message MsgStorageProviderForceExit {
string storage_provider = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

message MsgStorageProviderForceExitResponse {}
message MsgStorageProviderForceExitResponse {}
Loading

0 comments on commit 44430c3

Please sign in to comment.