Skip to content

Commit

Permalink
fix: remove tags field when creating object/group/bucket (#1284)
Browse files Browse the repository at this point in the history
* fix: remove tags field when creating object/group/bucket
  • Loading branch information
ruojunm authored Dec 21, 2023
1 parent 30598f7 commit 4d65d6d
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 37 deletions.
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/aliyun/credentials-go v1.3.0
github.com/avast/retry-go/v4 v4.3.1
github.com/aws/aws-sdk-go v1.44.159
github.com/bnb-chain/greenfield v1.1.2-0.20231206061231-2c244cebf664
github.com/bnb-chain/greenfield v1.2.1-0.20231221015040-11071a6ee95b
github.com/bnb-chain/greenfield-common/go v0.0.0-20230906132736-eb2f0efea228
github.com/bytedance/gopkg v0.0.0-20221122125632-68358b8ecec6
github.com/cometbft/cometbft v0.37.2
Expand Down Expand Up @@ -52,8 +52,6 @@ require (
gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11
)

require gorm.io/datatypes v1.2.0

require (
cosmossdk.io/api v0.4.0 // indirect
cosmossdk.io/core v0.6.1 // indirect
Expand Down Expand Up @@ -126,7 +124,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.3.0 // indirect
github.com/golang/glog v1.1.0 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
Expand Down Expand Up @@ -189,7 +187,7 @@ require (
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/dns v1.1.53 // indirect
Expand Down Expand Up @@ -279,7 +277,7 @@ require (
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.10.0 // indirect
Expand All @@ -291,6 +289,7 @@ require (
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/datatypes v1.2.0
gorm.io/driver/postgres v1.5.0 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
nhooyr.io/websocket v1.8.7 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsy
github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/bnb-chain/greenfield v1.1.2-0.20231206061231-2c244cebf664 h1:CIj9s2kfDz23WEqLrKHvHJohP8k7jWwXoj2cCy4+6yQ=
github.com/bnb-chain/greenfield v1.1.2-0.20231206061231-2c244cebf664/go.mod h1:uIyouzA9GY2RaJDkW6jzyUsvwzlDsXB1PiulNcZM4a8=
github.com/bnb-chain/greenfield v1.2.1-0.20231221015040-11071a6ee95b h1:UBgGcMo5Sf+sCMqkB2zu0sfuuMGBQ+5Ib1QIJ0sLXes=
github.com/bnb-chain/greenfield v1.2.1-0.20231221015040-11071a6ee95b/go.mod h1:p8M80v/a6mRm+ZPbW8Hfjc1npWktO6BDtebr9/8ETRs=
github.com/bnb-chain/greenfield-cometbft v0.0.0-20231030090949-99ef7dbd1e62 h1:pakuREXV/XfWNwgsTXUQwYirem12Tt+2LGGHIar0z8o=
github.com/bnb-chain/greenfield-cometbft v0.0.0-20231030090949-99ef7dbd1e62/go.mod h1:43yICrTxu90VjEUpQN23bsqi9mua5m5sFQq/ekHwN9s=
github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU=
Expand Down Expand Up @@ -1091,8 +1091,8 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
Expand Down Expand Up @@ -2002,8 +2002,8 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
2 changes: 0 additions & 2 deletions modular/blocksyncer/modules/bucket/bucket_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/forbole/juno/v4/log"
"github.com/forbole/juno/v4/models"

"github.com/bnb-chain/greenfield-storage-provider/modular/blocksyncer/util"
storagetypes "github.com/bnb-chain/greenfield/x/storage/types"
)

Expand Down Expand Up @@ -108,7 +107,6 @@ func (m *Module) handleCreateBucket(ctx context.Context, block *tmctypes.ResultB
UpdateAt: block.Block.Height,
UpdateTxHash: txHash,
UpdateTime: block.Block.Time.UTC().Unix(),
Tags: util.GetTagJson(createBucket.Tags),
}
k, v := m.db.SaveBucketToSQL(ctx, bucket)
return map[string][]interface{}{
Expand Down
2 changes: 0 additions & 2 deletions modular/blocksyncer/modules/group/group_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/forbole/juno/v4/log"
"github.com/forbole/juno/v4/models"

"github.com/bnb-chain/greenfield-storage-provider/modular/blocksyncer/util"
storagetypes "github.com/bnb-chain/greenfield/x/storage/types"
)

Expand Down Expand Up @@ -107,7 +106,6 @@ func (m *Module) handleCreateGroup(ctx context.Context, block *tmctypes.ResultBl
UpdateAt: block.Block.Height,
UpdateTime: block.Block.Time.UTC().Unix(),
Removed: false,
Tags: util.GetTagJson(createGroup.Tags),
}
membersToAddList = append(membersToAddList, groupItem)

Expand Down
3 changes: 0 additions & 3 deletions modular/blocksyncer/modules/object/object_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/forbole/juno/v4/log"
"github.com/forbole/juno/v4/models"

"github.com/bnb-chain/greenfield-storage-provider/modular/blocksyncer/util"
storagetypes "github.com/bnb-chain/greenfield/x/storage/types"
)

Expand Down Expand Up @@ -139,8 +138,6 @@ func (m *Module) handleCreateObject(ctx context.Context, block *tmctypes.ResultB
UpdateTxHash: txHash,
UpdateTime: createObject.CreateAt,
Removed: false,

Tags: util.GetTagJson(createObject.Tags),
}

res := make(map[string][]interface{})
Expand Down
14 changes: 11 additions & 3 deletions modular/blocksyncer/test/bs_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"
MYSQL_USER="root"
MYSQL_PASSWORD="root"
MYSQL_ADDRESS="127.0.0.1:3306"
TESTCOVERAGE_THRESHOLD=59

TESTCOVERAGE_THRESHOLD=60
# GITHUB_WORKSPACE=. # for local testing
workspace=${GITHUB_WORKSPACE}

function make_config() {
Expand Down Expand Up @@ -46,7 +46,15 @@ function reset_db() {

function test_bs() {
cd ${workspace}/modular/blocksyncer/ || exit 1
go test -v -coverprofile=coverage.txt -covermode=atomic
go test -v -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/bnb-chain/greenfield-storage-provider/modular/blocksyncer/...

exit_status_command=$?
if [ $exit_status_command -eq 0 ]; then
echo "bs_e2e_test runs successful."
else
exit $exit_status_command
fi

go tool cover -func coverage.txt

echo "Quality Gate: checking test coverage is above threshold ..."
Expand Down
Loading

0 comments on commit 4d65d6d

Please sign in to comment.