diff --git a/e2e/tests/permission_test.go b/e2e/tests/permission_test.go index 699d4f1b8..bf998799e 100644 --- a/e2e/tests/permission_test.go +++ b/e2e/tests/permission_test.go @@ -1925,7 +1925,7 @@ func (s *StorageTestSuite) TestExpiredAccountPolicyGCAndRePut() { Actions: []types.ActionType{types.ACTION_DELETE_BUCKET}, Effect: types.EFFECT_ALLOW, } - expirationTime := time.Now().Add(5 * time.Second) + expirationTime := time.Now().Add(3 * time.Second) msgPutBucketPolicy := storagetypes.NewMsgPutPolicy(owner.GetAddr(), types2.NewBucketGRN(bucketName).String(), principal, []*types.Statement{bucketStatement}, &expirationTime) @@ -1990,7 +1990,7 @@ func (s *StorageTestSuite) TestExpiredGroupPolicyGCAndRePut() { principal := types.NewPrincipalWithGroupId(headGroupResponse.GroupInfo.Id) // Put bucket policy for group - expirationTime := time.Now().Add(5 * time.Second) + expirationTime := time.Now().Add(3 * time.Second) bucketStatement := &types.Statement{ Actions: []types.ActionType{types.ACTION_DELETE_BUCKET}, diff --git a/x/virtualgroup/keeper/msg_server.go b/x/virtualgroup/keeper/msg_server.go index cf8faa7c5..94726bd8a 100644 --- a/x/virtualgroup/keeper/msg_server.go +++ b/x/virtualgroup/keeper/msg_server.go @@ -58,7 +58,7 @@ func (k msgServer) CreateGlobalVirtualGroup(goCtx context.Context, req *types.Ms if len(req.GetSecondarySpIds()) != expectSecondarySPNum { return nil, types.ErrInvalidSecondarySPCount.Wrapf("the number of secondary sp in the Global virtual group should be %d", expectSecondarySPNum) } - spIdSet := make(map[uint32]struct{}) + spIdSet := make(map[uint32]struct{}, len(req.GetSecondarySpIds())) for _, spId := range req.GetSecondarySpIds() { if _, ok := spIdSet[spId]; ok { return nil, types.ErrDuplicateSecondarySP.Wrapf("the SP(id=%d) is duplicate in the Global virtual group.", spId)