diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e49369b0..a201bd38 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -12,8 +12,8 @@ on: - develop env: - GreenfieldTag: v0.2.3-alpha.6 - GreenfieldStorageProviderTag: v0.2.3-alpha.8 + GreenfieldTag: v0.2.3 + GreenfieldStorageProviderTag: v0.2.3-alpha.18 GOPRIVATE: github.com/bnb-chain GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }} MYSQL_USER: root @@ -26,7 +26,7 @@ jobs: end-to-end-test: strategy: matrix: - go-version: [1.19.x] + go-version: [1.20.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index 0a68ea5a..8b82c0b6 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -14,7 +14,7 @@ jobs: name: gosec strategy: matrix: - go-version: [1.19.x] + go-version: [1.20.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} env: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 481ee5b6..a4a78fc1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: name: golangci-lint strategy: matrix: - go-version: [ 1.19.x ] + go-version: [1.20.x] os: [ ubuntu-20.04 ] runs-on: ${{ matrix.os }} env: diff --git a/README.md b/README.md index e11fbbbe..860d4199 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,11 @@ replace dependencies ```go.mod cosmossdk.io/api => github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230425074444-eb5869b05fe9 cosmossdk.io/math => github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230425074444-eb5869b05fe9 -github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.1 -github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 -github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v0.2.1 +github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.2 +github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 +github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v0.2.3 +github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1 +github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ``` ### Initialize Client diff --git a/client/api_bucket.go b/client/api_bucket.go index c3b9842c..c13232a0 100644 --- a/client/api_bucket.go +++ b/client/api_bucket.go @@ -57,7 +57,7 @@ type Bucket interface { // userAddr indicates the HEX-encoded string of the user address IsBucketPermissionAllowed(ctx context.Context, userAddr string, bucketName string, action permTypes.ActionType) (permTypes.Effect, error) - ListBuckets(ctx context.Context, opts types.EndPointOptions) (types.ListBucketsResult, error) + ListBuckets(ctx context.Context, opts types.ListBucketsOptions) (types.ListBucketsResult, error) ListBucketReadRecord(ctx context.Context, bucketName string, opts types.ListReadRecordOptions) (types.QuotaRecordInfo, error) BuyQuotaForBucket(ctx context.Context, bucketName string, targetQuota uint64, opt types.BuyQuotaOption) (string, error) @@ -371,8 +371,11 @@ func (c *client) GetBucketPolicy(ctx context.Context, bucketName string, princip } // ListBuckets list buckets for the owner -func (c *client) ListBuckets(ctx context.Context, opts types.EndPointOptions) (types.ListBucketsResult, error) { +func (c *client) ListBuckets(ctx context.Context, opts types.ListBucketsOptions) (types.ListBucketsResult, error) { + params := url.Values{} + params.Set("include-removed", strconv.FormatBool(opts.ShowRemovedBucket)) reqMeta := requestMeta{ + urlValues: params, contentSHA256: types.EmptyStringSHA256, userAddress: c.MustGetDefaultAccount().GetAddress().String(), } @@ -382,7 +385,7 @@ func (c *client) ListBuckets(ctx context.Context, opts types.EndPointOptions) (t disableCloseBody: true, } - endpoint, err := c.getEndpointByOpt(&opts) + endpoint, err := c.getEndpointByOpt(opts.EndPointOptions) if err != nil { log.Error().Msg(fmt.Sprintf("get endpoint by option failed %s", err.Error())) return types.ListBucketsResult{}, err diff --git a/client/api_object.go b/client/api_object.go index 8e229698..0610077b 100644 --- a/client/api_object.go +++ b/client/api_object.go @@ -897,6 +897,7 @@ func (c *client) ListObjects(ctx context.Context, bucketName string, opts types. params.Set("continuation-token", opts.ContinuationToken) params.Set("delimiter", opts.Delimiter) params.Set("prefix", opts.Prefix) + params.Set("include-removed", strconv.FormatBool(opts.ShowRemovedObject)) reqMeta := requestMeta{ urlValues: params, bucketName: bucketName, diff --git a/e2e/e2e_migrate_bucket_test.go b/e2e/e2e_migrate_bucket_test.go index af459c0b..4ff442fc 100644 --- a/e2e/e2e_migrate_bucket_test.go +++ b/e2e/e2e_migrate_bucket_test.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io" - "testing" "time" "github.com/bnb-chain/greenfield-go-sdk/e2e/basesuite" @@ -12,7 +11,6 @@ import ( storageTestUtil "github.com/bnb-chain/greenfield/testutil/storage" spTypes "github.com/bnb-chain/greenfield/x/sp/types" storageTypes "github.com/bnb-chain/greenfield/x/storage/types" - "github.com/stretchr/testify/suite" ) type BucketMigrateTestSuite struct { @@ -20,22 +18,22 @@ type BucketMigrateTestSuite struct { PrimarySP spTypes.StorageProvider } -func (s *BucketMigrateTestSuite) SetupSuite() { - s.BaseSuite.SetupSuite() - - spList, err := s.Client.ListStorageProviders(s.ClientContext, false) - s.Require().NoError(err) - for _, sp := range spList { - if sp.Endpoint != "https://sp0.greenfield.io" { - s.PrimarySP = sp - break - } - } -} - -func TestBucketMigrateTestSuiteTestSuite(t *testing.T) { - suite.Run(t, new(BucketMigrateTestSuite)) -} +//func (s *BucketMigrateTestSuite) SetupSuite() { +// s.BaseSuite.SetupSuite() +// +// spList, err := s.Client.ListStorageProviders(s.ClientContext, false) +// s.Require().NoError(err) +// for _, sp := range spList { +// if sp.Endpoint != "https://sp0.greenfield.io" { +// s.PrimarySP = sp +// break +// } +// } +//} + +//func TestBucketMigrateTestSuiteTestSuite(t *testing.T) { +// suite.Run(t, new(BucketMigrateTestSuite)) +//} func (s *BucketMigrateTestSuite) CreateObjects(bucketName string, count int) ([]*types.ObjectDetail, []bytes.Buffer, error) { var ( diff --git a/e2e/e2e_storage_test.go b/e2e/e2e_storage_test.go index c22ee4b1..077f4675 100644 --- a/e2e/e2e_storage_test.go +++ b/e2e/e2e_storage_test.go @@ -4,10 +4,12 @@ import ( "bytes" "fmt" "io" + "os" "testing" "time" "cosmossdk.io/math" + "github.com/bnb-chain/greenfield-go-sdk/client" "github.com/bnb-chain/greenfield-go-sdk/e2e/basesuite" "github.com/bnb-chain/greenfield-go-sdk/pkg/utils" "github.com/bnb-chain/greenfield-go-sdk/types" @@ -169,12 +171,7 @@ func (s *StorageTestSuite) Test_Object() { bytes.NewReader(buffer.Bytes()), types.PutObjectOptions{}) s.Require().NoError(err) - time.Sleep(50 * time.Second) - objectDetail, err = s.Client.HeadObject(s.ClientContext, bucketName, objectName) - s.Require().NoError(err) - if err == nil { - s.Require().Equal("OBJECT_STATUS_SEALED", objectDetail.ObjectInfo.GetObjectStatus().String()) - } + s.waitSealObject(bucketName, objectName) ior, info, err := s.Client.GetObject(s.ClientContext, bucketName, objectName, types.GetObjectOptions{}) s.Require().NoError(err) @@ -316,137 +313,156 @@ func (s *StorageTestSuite) Test_Group() { } } -//// UploadErrorHooker is a UploadPart hook---it will fail the 2nd segment's upload. -//func UploadErrorHooker(id int) error { -// if id == 2 { -// time.Sleep(time.Second) -// return fmt.Errorf("UploadErrorHooker") -// } -// return nil -//} -// -//// DownloadErrorHooker requests hook by downloadSegment -//func DownloadErrorHooker(segment int64) error { -// if segment == 1 { -// time.Sleep(time.Second) -// return fmt.Errorf("DownloadErrorHooker") -// } -// return nil -//} -// -//func (s *StorageTestSuite) createBigObjectWithoutPutObject() (bucket string, object string, objectbody bytes.Buffer) { -// bucketName := storageTestUtil.GenRandomBucketName() -// objectName := storageTestUtil.GenRandomObjectName() -// -// bucketTx, err := s.Client.CreateBucket(s.ClientContext, bucketName, s.PrimarySP.OperatorAddress, types.CreateBucketOptions{}) -// s.Require().NoError(err) -// -// _, err = s.Client.WaitForTx(s.ClientContext, bucketTx) -// s.Require().NoError(err) -// -// bucketInfo, err := s.Client.HeadBucket(s.ClientContext, bucketName) -// s.Require().NoError(err) -// if err == nil { -// s.Require().Equal(bucketInfo.Visibility, storageTypes.VISIBILITY_TYPE_PRIVATE) -// } -// -// var buffer bytes.Buffer -// // Create 20MiB content. -// for i := 0; i < 1024*3000; i++ { -// line := types.RandStr(20) -// buffer.WriteString(fmt.Sprintf("[%05d] %s\n", i, line)) -// } -// -// s.T().Log("---> CreateObject <---") -// objectTx, err := s.Client.CreateObject(s.ClientContext, bucketName, objectName, bytes.NewReader(buffer.Bytes()), types.CreateObjectOptions{}) -// s.Require().NoError(err) -// _, err = s.Client.WaitForTx(s.ClientContext, objectTx) -// s.Require().NoError(err) -// -// time.Sleep(5 * time.Second) -// objectDetail, err := s.Client.HeadObject(s.ClientContext, bucketName, objectName) -// s.Require().NoError(err) -// s.Require().Equal(objectDetail.ObjectInfo.ObjectName, objectName) -// s.Require().Equal(objectDetail.ObjectInfo.GetObjectStatus().String(), "OBJECT_STATUS_CREATED") -// -// s.T().Logf("---> Create Bucket:%s, Object:%s <---", bucketName, objectName) -// -// return bucketName, objectName, buffer -//} -// -//func (s *StorageTestSuite) Test_Resumable_Upload_And_Download() { -// // 1) create big object without putobject -// bucketName, objectName, buffer := s.createBigObjectWithoutPutObject() -// -// s.T().Log("---> Resumable PutObject <---") -// partSize := uint64(1024 * 1024 * 32) -// // 2) put an object(20M), the secondary segment will error, then resumable upload -// client.UploadSegmentHooker = UploadErrorHooker -// err := s.Client.PutObject(s.ClientContext, bucketName, objectName, int64(buffer.Len()), -// bytes.NewReader(buffer.Bytes()), types.PutObjectOptions{PartSize: partSize}) -// s.Require().ErrorContains(err, "UploadErrorHooker") -// client.UploadSegmentHooker = client.DefaultUploadSegment -// offset, err := s.Client.GetObjectResumableUploadOffset(s.ClientContext, bucketName, objectName) -// s.Require().NoError(err) -// s.Require().Equal(offset, partSize) -// -// err = s.Client.PutObject(s.ClientContext, bucketName, objectName, int64(buffer.Len()), -// bytes.NewReader(buffer.Bytes()), types.PutObjectOptions{PartSize: partSize}) -// s.Require().NoError(err) -// -// time.Sleep(50 * time.Second) -// objectDetail, err := s.Client.HeadObject(s.ClientContext, bucketName, objectName) -// s.Require().NoError(err) -// if err == nil { -// s.Require().Equal(objectDetail.ObjectInfo.GetObjectStatus().String(), "OBJECT_STATUS_SEALED") -// } -// -// // 3) FGetObjectResumable compare with FGetObject -// fileName := "test-file-" + storageTestUtil.GenRandomObjectName() -// err = s.Client.FGetObjectResumable(s.ClientContext, bucketName, objectName, fileName, types.GetObjectOptions{PartSize: 32 * 1024 * 1024}) -// s.T().Logf("---> object file :%s <---", fileName) -// s.Require().NoError(err) -// -// fGetObjectFileName := "test-file-" + storageTestUtil.GenRandomObjectName() -// defer os.Remove(fGetObjectFileName) -// s.T().Logf("---> object file :%s <---", fGetObjectFileName) -// err = s.Client.FGetObject(s.ClientContext, bucketName, objectName, fGetObjectFileName, types.GetObjectOptions{}) -// s.Require().NoError(err) -// -// isSame, err := types.CompareFiles(fileName, fGetObjectFileName) -// s.Require().True(isSame) -// s.Require().NoError(err) -// -// // 4) Resumabledownload, download a file with default checkpoint -// client.DownloadSegmentHooker = DownloadErrorHooker -// resumableDownloadFile := storageTestUtil.GenRandomObjectName() -// defer os.Remove(resumableDownloadFile) -// s.T().Logf("---> Resumable download Create newfile:%s, <---", resumableDownloadFile) -// -// err = s.Client.FGetObjectResumable(s.ClientContext, bucketName, objectName, resumableDownloadFile, types.GetObjectOptions{}) -// s.Require().ErrorContains(err, "DownloadErrorHooker") -// client.DownloadSegmentHooker = client.DefaultDownloadSegmentHook -// -// err = s.Client.FGetObjectResumable(s.ClientContext, bucketName, objectName, resumableDownloadFile, types.GetObjectOptions{}) -// s.Require().NoError(err) -// //download success, checkpoint file has been deleted -// -// isSame, err = types.CompareFiles(resumableDownloadFile, fGetObjectFileName) -// s.Require().True(isSame) -// s.Require().NoError(err) -// -// // 5) Resumabledownload, download a file with range -// resumableDownloadWithRangeFile := "test-file-" + storageTestUtil.GenRandomObjectName() -// err = s.Client.FGetObjectResumable(s.ClientContext, bucketName, objectName, resumableDownloadWithRangeFile, types.GetObjectOptions{Range: "bytes=1000-21400000"}) -// s.T().Logf("---> object file :%s <---", resumableDownloadWithRangeFile) -// s.Require().NoError(err) -// -// fGetObjectWithRangeFile := "test-file-" + storageTestUtil.GenRandomObjectName() -// s.T().Logf("---> object file :%s <---", fGetObjectWithRangeFile) -// err = s.Client.FGetObject(s.ClientContext, bucketName, objectName, fGetObjectWithRangeFile, types.GetObjectOptions{Range: "bytes=1000-21400000"}) -// s.Require().NoError(err) -// -// isSame, err = types.CompareFiles(resumableDownloadWithRangeFile, fGetObjectWithRangeFile) -// s.Require().True(isSame) -// s.Require().NoError(err) -//} +// UploadErrorHooker is a UploadPart hook---it will fail the 2nd segment's upload. +func UploadErrorHooker(id int) error { + if id == 2 { + time.Sleep(time.Second) + return fmt.Errorf("UploadErrorHooker") + } + return nil +} + +// DownloadErrorHooker requests hook by downloadSegment +func DownloadErrorHooker(segment int64) error { + if segment == 1 { + time.Sleep(time.Second) + return fmt.Errorf("DownloadErrorHooker") + } + return nil +} + +func (s *StorageTestSuite) waitSealObject(bucketName string, objectName string) { + startCheckTime := time.Now() + var ( + objectDetail *types.ObjectDetail + err error + ) + + // wait 300s + for i := 0; i < 100; i++ { + objectDetail, err = s.Client.HeadObject(s.ClientContext, bucketName, objectName) + s.Require().NoError(err) + if objectDetail.ObjectInfo.GetObjectStatus() == storageTypes.OBJECT_STATUS_SEALED { + break + } + time.Sleep(3 * time.Second) + } + + s.Require().Equal(objectDetail.ObjectInfo.GetObjectStatus().String(), "OBJECT_STATUS_SEALED") + s.T().Logf("---> Wait Seal Object cost %d ms, <---", time.Since(startCheckTime).Milliseconds()) +} + +func (s *StorageTestSuite) createBigObjectWithoutPutObject() (bucket string, object string, objectbody bytes.Buffer) { + bucketName := storageTestUtil.GenRandomBucketName() + objectName := storageTestUtil.GenRandomObjectName() + + bucketTx, err := s.Client.CreateBucket(s.ClientContext, bucketName, s.PrimarySP.OperatorAddress, types.CreateBucketOptions{}) + s.Require().NoError(err) + + _, err = s.Client.WaitForTx(s.ClientContext, bucketTx) + s.Require().NoError(err) + + bucketInfo, err := s.Client.HeadBucket(s.ClientContext, bucketName) + s.Require().NoError(err) + if err == nil { + s.Require().Equal(bucketInfo.Visibility, storageTypes.VISIBILITY_TYPE_PRIVATE) + } + + var buffer bytes.Buffer + // Create 29 MiB content. + for i := 0; i < 1024*1000; i++ { + line := types.RandStr(20) + buffer.WriteString(fmt.Sprintf("[%05d] %s\n", i, line)) + } + + s.T().Log("---> CreateObject <---") + objectTx, err := s.Client.CreateObject(s.ClientContext, bucketName, objectName, bytes.NewReader(buffer.Bytes()), types.CreateObjectOptions{}) + s.Require().NoError(err) + _, err = s.Client.WaitForTx(s.ClientContext, objectTx) + s.Require().NoError(err) + + time.Sleep(5 * time.Second) + objectDetail, err := s.Client.HeadObject(s.ClientContext, bucketName, objectName) + s.Require().NoError(err) + s.Require().Equal(objectDetail.ObjectInfo.ObjectName, objectName) + s.Require().Equal(objectDetail.ObjectInfo.GetObjectStatus().String(), "OBJECT_STATUS_CREATED") + + s.T().Logf("---> Create Bucket:%s, Object:%s <---", bucketName, objectName) + + return bucketName, objectName, buffer +} + +func (s *StorageTestSuite) Test_Resumable_Upload_And_Download() { + // 1) create big object without putobject + bucketName, objectName, buffer := s.createBigObjectWithoutPutObject() + + s.T().Log("---> Resumable PutObject <---") + partSize := uint64(1024 * 1024 * 16) + // 2) put an object(29MB), the secondary segment will error, then resumable upload + client.UploadSegmentHooker = UploadErrorHooker + err := s.Client.PutObject(s.ClientContext, bucketName, objectName, int64(buffer.Len()), + bytes.NewReader(buffer.Bytes()), types.PutObjectOptions{PartSize: partSize}) + s.Require().ErrorContains(err, "UploadErrorHooker") + client.UploadSegmentHooker = client.DefaultUploadSegment + offset, err := s.Client.GetObjectResumableUploadOffset(s.ClientContext, bucketName, objectName) + s.Require().NoError(err) + s.Require().Equal(offset, partSize) + + err = s.Client.PutObject(s.ClientContext, bucketName, objectName, int64(buffer.Len()), + bytes.NewReader(buffer.Bytes()), types.PutObjectOptions{PartSize: partSize}) + s.Require().NoError(err) + + s.waitSealObject(bucketName, objectName) + + // 3) FGetObjectResumable compare with FGetObject + fileName := "test-file-" + storageTestUtil.GenRandomObjectName() + defer os.Remove(fileName) + err = s.Client.FGetObjectResumable(s.ClientContext, bucketName, objectName, fileName, types.GetObjectOptions{PartSize: 32 * 1024 * 1024}) + s.T().Logf("---> object file :%s <---", fileName) + s.Require().NoError(err) + + fGetObjectFileName := "test-file-" + storageTestUtil.GenRandomObjectName() + defer os.Remove(fGetObjectFileName) + s.T().Logf("---> object file :%s <---", fGetObjectFileName) + err = s.Client.FGetObject(s.ClientContext, bucketName, objectName, fGetObjectFileName, types.GetObjectOptions{}) + s.Require().NoError(err) + + isSame, err := types.CompareFiles(fileName, fGetObjectFileName) + s.Require().True(isSame) + s.Require().NoError(err) + + // 4) Resumabledownload, download a file with default checkpoint + client.DownloadSegmentHooker = DownloadErrorHooker + resumableDownloadFile := storageTestUtil.GenRandomObjectName() + defer os.Remove(resumableDownloadFile) + s.T().Logf("---> Resumable download Create newfile:%s, <---", resumableDownloadFile) + + err = s.Client.FGetObjectResumable(s.ClientContext, bucketName, objectName, resumableDownloadFile, types.GetObjectOptions{PartSize: 16 * 1024 * 1024}) + s.Require().ErrorContains(err, "DownloadErrorHooker") + client.DownloadSegmentHooker = client.DefaultDownloadSegmentHook + + err = s.Client.FGetObjectResumable(s.ClientContext, bucketName, objectName, resumableDownloadFile, types.GetObjectOptions{PartSize: 16 * 1024 * 1024}) + s.Require().NoError(err) + //download success, checkpoint file has been deleted + + isSame, err = types.CompareFiles(resumableDownloadFile, fGetObjectFileName) + s.Require().True(isSame) + s.Require().NoError(err) + + // 5) Resumabledownload, download a file with range + resumableDownloadWithRangeFile := "test-file-" + storageTestUtil.GenRandomObjectName() + defer os.Remove(resumableDownloadWithRangeFile) + err = s.Client.FGetObjectResumable(s.ClientContext, bucketName, objectName, resumableDownloadWithRangeFile, types.GetObjectOptions{Range: "bytes=1000-94131999"}) + s.T().Logf("---> object file :%s <---", resumableDownloadWithRangeFile) + s.Require().NoError(err) + + fGetObjectWithRangeFile := "test-file-" + storageTestUtil.GenRandomObjectName() + defer os.Remove(fGetObjectWithRangeFile) + s.T().Logf("---> object file :%s <---", fGetObjectWithRangeFile) + err = s.Client.FGetObject(s.ClientContext, bucketName, objectName, fGetObjectWithRangeFile, types.GetObjectOptions{Range: "bytes=1000-94131999"}) + s.Require().NoError(err) + + isSame, err = types.CompareFiles(resumableDownloadWithRangeFile, fGetObjectWithRangeFile) + s.Require().True(isSame) + s.Require().NoError(err) +} diff --git a/examples/storage.go b/examples/storage.go index 87db1cb1..408c5698 100644 --- a/examples/storage.go +++ b/examples/storage.go @@ -72,9 +72,9 @@ func main() { handleErr(errors.New("download content not same"), "GetObject") } - // list object + // list objects objects, err := cli.ListObjects(ctx, bucketName, types.ListObjectsOptions{ - true, "", "", "/", "", 10, &types.EndPointOptions{ + ShowRemovedObject: false, Delimiter: "", MaxKeys: 100, EndPointOptions: &types.EndPointOptions{ Endpoint: httpsAddr, SPAddress: "", }}) @@ -84,6 +84,18 @@ func main() { log.Printf("object: %s, status: %s\n", i.ObjectName, i.ObjectStatus) } + // list buckets + bucketsList, err := cli.ListBuckets(ctx, types.ListBucketsOptions{ + ShowRemovedBucket: false, EndPointOptions: &types.EndPointOptions{ + Endpoint: httpsAddr, + SPAddress: "", + }}) + log.Println("list buckets result:") + for _, bucket := range bucketsList.Buckets { + i := bucket.BucketInfo + log.Printf("bucket: %s, status: %s\n", i.BucketName, i.BucketStatus) + } + // list object by object ids ids := []uint64{1, 2, 333} objects2, err := cli.ListObjectsByObjectID(ctx, ids, types.EndPointOptions{ diff --git a/go.mod b/go.mod index 2ed6ea03..5a30a49c 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.1 - github.com/bnb-chain/greenfield v0.2.3-alpha.6 + github.com/bnb-chain/greenfield v0.2.3 github.com/bnb-chain/greenfield-common/go v0.0.0-20230720022901-7e7158fd397d github.com/cometbft/cometbft v0.37.1 github.com/consensys/gnark-crypto v0.7.0 @@ -144,10 +144,10 @@ replace ( cosmossdk.io/api => github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230425074444-eb5869b05fe9 cosmossdk.io/math => github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230425074444-eb5869b05fe9 github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.23.0 - github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.2 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.2 github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 - github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v0.2.3-alpha.4 + github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v0.2.3 github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ) diff --git a/go.sum b/go.sum index 08028c84..371a2907 100644 --- a/go.sum +++ b/go.sum @@ -152,16 +152,16 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/bnb-chain/greenfield v0.2.3-alpha.6 h1:kC3L1aKZdG0dFzQf/1+l+uuTGzHUi3ybwLzSqZbzJ28= -github.com/bnb-chain/greenfield v0.2.3-alpha.6/go.mod h1:2sjyOH3z8zH0VaSlu5propRLYt8PvT2Ta01F6sP3Tas= -github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.2 h1:ys9kmgtRx04wcCextE6CrVmbL1bJDklWr+hWgm1y2k4= -github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.2/go.mod h1:EBmwmUdaNbGPyGjf1cMuoN3pAeM2tQu7Lfg95813EAw= +github.com/bnb-chain/greenfield v0.2.3 h1:s5KbeTuBiN+VL9i+BJtSFU+UNw6zk45Py9Ee1LY6liU= +github.com/bnb-chain/greenfield v0.2.3/go.mod h1:LnDIEY7G57bs6tjKbJbwpy09zNceNgAsabYMa6t1Nd0= +github.com/bnb-chain/greenfield-cometbft v0.0.2 h1:bRamS8Lq1lA3ttRLZBha22uiNG5tqN+diD3hapdUCYI= +github.com/bnb-chain/greenfield-cometbft v0.0.2/go.mod h1:EBmwmUdaNbGPyGjf1cMuoN3pAeM2tQu7Lfg95813EAw= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1/go.mod h1:ey1CiK4bYo1RBNJLRiVbYr5CMdSxci9S/AZRINLtppI= github.com/bnb-chain/greenfield-common/go v0.0.0-20230720022901-7e7158fd397d h1:G14aW9eW+l7ou10kRPlBiXOZqG+qPk3YYjEXgJid6jk= github.com/bnb-chain/greenfield-common/go v0.0.0-20230720022901-7e7158fd397d/go.mod h1:GEjCahULmz99qx5k8WGWa7cTXIUjoNMNW+J92I+kTWg= -github.com/bnb-chain/greenfield-cosmos-sdk v0.2.3-alpha.4 h1:Q5EzT1r3jKv0BZgVJkYFVvqn+7Ghj6RU7mUM0VkUZ4U= -github.com/bnb-chain/greenfield-cosmos-sdk v0.2.3-alpha.4/go.mod h1:EghjYxFg4NRNMfTJ6g9rVhjImhXQm+tuboknHqeGmJA= +github.com/bnb-chain/greenfield-cosmos-sdk v0.2.3 h1:bpro+qS2jjSi7vQN781gtxebuYNDrLewAye+iGB299c= +github.com/bnb-chain/greenfield-cosmos-sdk v0.2.3/go.mod h1:hpvg93+VGXHAcv/pVVdp24Ik/9miw4uRh8+tD0DDYas= github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230425074444-eb5869b05fe9 h1:6fLpmmI0EZvDTfPvI0zy5dBaaTUboHnEkoC5/p/w8TQ= github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230425074444-eb5869b05fe9/go.mod h1:rbc4o84RSEvhf09o2+4Qiazsv0snRJLiEZdk17HeIDw= github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230425074444-eb5869b05fe9 h1:1ZdK+iR1Up02bOa2YTZCml7PBpP//kcdamOcK6aWO/s= diff --git a/types/option.go b/types/option.go index 4cd6845c..00e0a13d 100644 --- a/types/option.go +++ b/types/option.go @@ -243,3 +243,11 @@ type EndPointOptions struct { Endpoint string // indicates the endpoint of sp SPAddress string // indicates the HEX-encoded string of the sp address to be challenged } + +type ListBucketsOptions struct { + // ShowRemovedObject determines whether to include buckets that have been marked as removed in the list. + // If set to false, these buckets will be skipped. + ShowRemovedBucket bool + + EndPointOptions *EndPointOptions +}