Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync develop to master #1383

Merged
merged 4 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions base/gfspapp/task_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gfspapp

import (
coretask "github.com/bnb-chain/greenfield-storage-provider/core/task"
"github.com/bnb-chain/greenfield-storage-provider/util"
)

const (
Expand Down Expand Up @@ -103,32 +104,32 @@ func (g *GfSpBaseApp) TaskTimeout(task coretask.Task, size uint64) int64 {
case coretask.TypeTaskReplicatePieceApproval:
return NotUseTimeout
case coretask.TypeTaskUpload:
timeout := int64(size) / (g.uploadSpeed + 1) / (MinSpeed)
if timeout < MinUploadTime {
timeout := size / uint64(g.uploadSpeed+1) / (MinSpeed)
if timeout < uint64(MinUploadTime) {
return MinUploadTime
}
if timeout > MaxUploadTime {
if timeout > uint64(MaxUploadTime) {
return MaxUploadTime
}
return timeout
return util.Uint64ToInt64(timeout)
case coretask.TypeTaskReplicatePiece:
timeout := int64(size) / (g.replicateSpeed + 1) / (MinSpeed)
if timeout < MinReplicateTime {
timeout := size / (uint64(g.replicateSpeed) + 1) / (MinSpeed)
if timeout < uint64(MinReplicateTime) {
return MinReplicateTime
}
if timeout > MaxReplicateTime {
if timeout > uint64(MaxReplicateTime) {
return MaxReplicateTime
}
return timeout
return util.Uint64ToInt64(timeout)
case coretask.TypeTaskReceivePiece:
timeout := int64(size) / (g.replicateSpeed + 1) / (MinSpeed)
if timeout < MinReceiveTime {
timeout := size / (uint64(g.replicateSpeed) + 1) / (MinSpeed)
if timeout < uint64(MinReceiveTime) {
return MinReceiveTime
}
if timeout > MaxReceiveTime {
if timeout > uint64(MaxReceiveTime) {
return MaxReceiveTime
}
return timeout
return util.Uint64ToInt64(timeout)
case coretask.TypeTaskSealObject:
if g.sealObjectTimeout < MinSealObjectTime {
return MinSealObjectTime
Expand All @@ -138,23 +139,23 @@ func (g *GfSpBaseApp) TaskTimeout(task coretask.Task, size uint64) int64 {
}
return g.sealObjectTimeout
case coretask.TypeTaskDownloadObject:
timeout := int64(size) / (g.downloadSpeed + 1) / (MinSpeed)
if timeout < MinDownloadTime {
timeout := size / (uint64(g.downloadSpeed) + 1) / (MinSpeed)
if timeout < uint64(MinDownloadTime) {
return MinDownloadTime
}
if timeout > MaxDownloadTime {
if timeout > uint64(MaxDownloadTime) {
return MaxDownloadTime
}
return timeout
return util.Uint64ToInt64(timeout)
case coretask.TypeTaskChallengePiece:
timeout := int64(size) / (g.downloadSpeed + 1) / (MinSpeed)
if timeout < MinDownloadTime {
timeout := size / (uint64(g.downloadSpeed) + 1) / (MinSpeed)
if timeout < uint64(MinDownloadTime) {
return MinDownloadTime
}
if timeout > MaxDownloadTime {
if timeout > uint64(MaxDownloadTime) {
return MaxDownloadTime
}
return timeout
return util.Uint64ToInt64(timeout)
case coretask.TypeTaskGCObject:
if g.gcObjectTimeout < MinGCObjectTime {
return MinGCObjectTime
Expand All @@ -180,14 +181,14 @@ func (g *GfSpBaseApp) TaskTimeout(task coretask.Task, size uint64) int64 {
}
return g.gcMetaTimeout
case coretask.TypeTaskRecoverPiece:
timeout := int64(size)/(g.replicateSpeed+1)/(MinSpeed) + 1
if timeout < MinRecoveryTime {
timeout := size/(uint64(g.replicateSpeed)+1)/(MinSpeed) + 1
if timeout < uint64(MinRecoveryTime) {
return MinRecoveryTime
}
if timeout > MaxRecoveryTime {
if timeout > uint64(MaxRecoveryTime) {
return MaxRecoveryTime
}
return timeout
return util.Uint64ToInt64(timeout)
case coretask.TypeTaskMigrateGVG:
if g.migrateGVGTimeout < MinMigrateGVGTime {
return MinMigrateGVGTime
Expand Down
6 changes: 3 additions & 3 deletions base/gfspclient/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ func (s *GfSpClient) ListDeletedObjectsByBlockNumberRange(ctx context.Context, s
}
defer conn.Close()
req := &types.GfSpListDeletedObjectsByBlockNumberRangeRequest{
StartBlockNumber: int64(startBlockNumber),
EndBlockNumber: int64(endBlockNumber),
StartBlockNumber: startBlockNumber,
EndBlockNumber: endBlockNumber,
IncludePrivate: includePrivate,
}
resp, err := types.NewGfSpMetadataServiceClient(conn).GfSpListDeletedObjectsByBlockNumberRange(ctx, req)
if err != nil {
log.CtxErrorw(ctx, "failed to list deleted objects by block number range", "error", err)
return nil, uint64(0), ErrRPCUnknownWithDetail("failed to list deleted objects by block number range, error: ", err)
}
return resp.GetObjects(), uint64(resp.GetEndBlockNumber()), nil
return resp.GetObjects(), resp.GetEndBlockNumber(), nil
}

func (s *GfSpClient) GetUserBuckets(ctx context.Context, account string, includeRemoved bool, opts ...grpc.DialOption) ([]*types.VGFInfoBucket, error) {
Expand Down
2 changes: 1 addition & 1 deletion base/gfsppieceop/piece_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (p *GfSpPieceOp) ParseECPieceKeyIdx(ecPieceKey string) (uint32, int32, erro
if err != nil {
return 0, 0, err
}
redundancyIndex, err := strconv.ParseUint(keyParts[2][len(redundancyPrefix):], 10, 32)
redundancyIndex, err := strconv.ParseInt(keyParts[2][len(redundancyPrefix):], 10, 32)
if err != nil {
return 0, 0, err
}
Expand Down
66 changes: 34 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ require (
github.com/bnb-chain/greenfield v1.6.0
github.com/bnb-chain/greenfield-common/go v0.0.0-20240228080631-2683b0ee669a
github.com/bytedance/gopkg v0.0.0-20221122125632-68358b8ecec6
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft v0.38.0
github.com/consensys/gnark-crypto v0.7.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.47.3
github.com/cosmos/cosmos-sdk v0.47.10
github.com/cosmos/gogoproto v1.4.10
github.com/ethereum/go-ethereum v1.10.26
github.com/felixge/fgprof v0.9.3
Expand All @@ -33,25 +33,27 @@ require (
github.com/multiformats/go-multiaddr v0.9.0
github.com/pelletier/go-toml/v2 v2.0.8
github.com/pkg/sftp v1.13.5
github.com/prometheus/client_golang v1.15.0
github.com/prometheus/client_golang v1.17.0
github.com/shopspring/decimal v1.3.1
github.com/spaolacci/murmur3 v1.1.0
github.com/stretchr/testify v1.8.4
github.com/ulule/limiter/v3 v3.11.1
github.com/urfave/cli/v2 v2.25.0
github.com/urfave/cli/v2 v2.25.7
github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8
go.opentelemetry.io/otel/trace v1.11.0
go.opentelemetry.io/otel/trace v1.21.0
go.uber.org/mock v0.2.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.17.0
golang.org/x/crypto v0.19.0
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
golang.org/x/time v0.3.0
google.golang.org/grpc v1.58.3
google.golang.org/grpc v1.59.0
gorm.io/driver/mysql v1.4.7
gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11
)

require github.com/jackc/puddle/v2 v2.2.1 // indirect

require (
cosmossdk.io/api v0.4.0 // indirect
cosmossdk.io/core v0.6.1 // indirect
Expand All @@ -68,7 +70,7 @@ require (
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/btcsuite/btcd v0.23.4 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
Expand Down Expand Up @@ -100,10 +102,10 @@ require (
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/ferranbt/fastssz v0.0.0-20210905181407-59cf6761a7d5 // indirect
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
github.com/flynn/noise v1.0.0 // indirect
Expand All @@ -123,16 +125,16 @@ require (
github.com/gogo/googleapis v1.4.1 // indirect
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/glog v1.1.2 // 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/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0
github.com/graph-gophers/graphql-go v1.3.0 // indirect
Expand Down Expand Up @@ -160,15 +162,15 @@ require (
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.3.0 // indirect
github.com/jackc/pgx/v5 v5.5.4 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.16.4 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/klauspost/reedsolomon v1.11.8 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
Expand Down Expand Up @@ -223,9 +225,9 @@ require (
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/tsdb v0.10.0 // indirect
github.com/prysmaticlabs/eth2-types v0.0.0-20210303084904-c9735a06829d // indirect
github.com/prysmaticlabs/prysm v0.0.0-20220124113610-e26cde5e091b
Expand Down Expand Up @@ -268,23 +270,23 @@ require (
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.opentelemetry.io/otel v1.11.0 // indirect
go.etcd.io/bbolt v1.3.9 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/dig v1.16.1 // indirect
go.uber.org/fx v1.19.2 // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand All @@ -301,7 +303,7 @@ replace (
cosmossdk.io/api => github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20231206043955-0855e0965bc8
cosmossdk.io/math => github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20231206043955-0855e0965bc8
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.23.0
github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.2.0
github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.0-20240402065323-40677309d454
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 v1.6.0
Expand Down
Loading
Loading