diff --git a/CHANGELOG.md b/CHANGELOG.md index fc6aac72..ba2452af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # droplet changelog +## v2.10.0 + +## v2.10.0-rc6 + +* chore: update venus to v1.14.0-rc6 +* fix: Paid retrieval failed [[#484](https://github.com/ipfs-force-community/droplet/pull/484)] + + +## v2.10.0-rc5 + +* chore: update venus to v1.14.0-rc4 + +## v2.10.0-rc4 + +* fix: set deal id when import deal from boost [[#480](https://github.com/ipfs-force-community/droplet/pull/480)] +* feat: import deal data by uuid [[#471](https://github.com/ipfs-force-community/droplet/pull/471)] + +## v2.10.0-rc3 + +* fix: use the received deal uuid [[#473](https://github.com/ipfs-force-community/droplet/pull/473)] +* fix: clean blockstore after retrieval completed [[#478](https://github.com/ipfs-force-community/droplet/pull/478)] + ## v2.10.0-rc2 * feat/use deal bound from policy directly [[#467](https://github.com/ipfs-force-community/droplet/pull/467)] diff --git a/go.mod b/go.mod index 2e1a9613..abd80492 100644 --- a/go.mod +++ b/go.mod @@ -25,12 +25,12 @@ require ( github.com/filecoin-project/go-fil-markets v1.28.4-0.20230816163331-bd08f1651b1d github.com/filecoin-project/go-jsonrpc v0.1.8 github.com/filecoin-project/go-padreader v0.0.1 - github.com/filecoin-project/go-state-types v0.12.5 + github.com/filecoin-project/go-state-types v0.12.8 github.com/filecoin-project/go-statemachine v1.0.3 github.com/filecoin-project/go-statestore v0.2.0 github.com/filecoin-project/specs-actors/v2 v2.3.6 github.com/filecoin-project/specs-actors/v7 v7.0.1 - github.com/filecoin-project/venus v1.14.0-rc3.0.20231019071557-12e011e709ac + github.com/filecoin-project/venus v1.14.0 github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.8.0 @@ -38,9 +38,9 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef github.com/ipfs-force-community/metrics v1.0.1-0.20231011024528-8c881d456601 - github.com/ipfs-force-community/sophon-auth v1.14.0-rc1 - github.com/ipfs-force-community/sophon-gateway v1.14.0-rc1 - github.com/ipfs-force-community/sophon-messager v1.14.0-rc1 + github.com/ipfs-force-community/sophon-auth v1.14.0 + github.com/ipfs-force-community/sophon-gateway v1.14.0 + github.com/ipfs-force-community/sophon-messager v1.14.0 github.com/ipfs-force-community/venus-common-utils v0.0.0-20220217030526-e5e4c6bc14f7 github.com/ipfs/boxo v0.10.1 github.com/ipfs/go-blockservice v0.5.0 @@ -92,6 +92,7 @@ require ( ) require ( + github.com/hashicorp/golang-lru/arc/v2 v2.0.7 // indirect go.opentelemetry.io/otel/bridge/opencensus v0.39.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.14.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect @@ -177,7 +178,7 @@ require ( github.com/hannahhoward/cbor-gen-for v0.0.0-20230214144701-5d17c9d5243c // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.2 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/huin/goupnp v1.1.0 // indirect github.com/influxdata/influxdb-client-go/v2 v2.2.2 // indirect @@ -319,5 +320,5 @@ replace ( github.com/filecoin-project/dagstore => github.com/ipfs-force-community/dagstore v0.4.4-0.20230628060530-4b25fff4d833 github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi github.com/filecoin-project/go-fil-markets => github.com/ipfs-force-community/go-fil-markets v1.2.6-0.20230822060005-aee2cbae5b01 - github.com/filecoin-project/go-jsonrpc => github.com/ipfs-force-community/go-jsonrpc v0.1.8 + github.com/filecoin-project/go-jsonrpc => github.com/ipfs-force-community/go-jsonrpc v0.1.9 ) diff --git a/go.sum b/go.sum index a5eb2ec4..df1ae5fb 100644 --- a/go.sum +++ b/go.sum @@ -352,8 +352,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.11.2-0.20230712101859-8f37624fa540/go.mod h1:SyNPwTsU7I22gL2r0OAPcImvLoTVfgRwdK/Y5rR1zz8= -github.com/filecoin-project/go-state-types v0.12.5 h1:VQ2N2T3JeUDdIHEo/xhjnT7Q218Wl0UYIyglqT7Z9Ck= -github.com/filecoin-project/go-state-types v0.12.5/go.mod h1:iJTqGdWDvzXhuVf64Lw0hzt4TIoitMo0VgHdxdjNDZI= +github.com/filecoin-project/go-state-types v0.12.8 h1:W/UObdAsv+LbB9EfyLg92DSYoatzUWmlfV8FGyh30VA= +github.com/filecoin-project/go-state-types v0.12.8/go.mod h1:gR2NV0CSGSQwopxF+3In9nDh1sqvoYukLcs5vK0AHCA= github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v1.0.3 h1:N07o6alys+V1tNoSTi4WuuoeNC4erS/6jE74+NsgQuk= github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54= @@ -379,8 +379,8 @@ github.com/filecoin-project/specs-actors/v7 v7.0.1 h1:w72xCxijK7xs1qzmJiw+WYJaVt github.com/filecoin-project/specs-actors/v7 v7.0.1/go.mod h1:tPLEYXoXhcpyLh69Ccq91SOuLXsPWjHiY27CzawjUEk= github.com/filecoin-project/specs-actors/v8 v8.0.1 h1:4u0tIRJeT5G7F05lwLRIsDnsrN+bJ5Ixj6h49Q7uE2Y= github.com/filecoin-project/specs-storage v0.4.1 h1:yvLEaLZj8f+uByhNC4mFOtCUyL2wQku+NGBp6hjTe9M= -github.com/filecoin-project/venus v1.14.0-rc3.0.20231019071557-12e011e709ac h1:WfkaY28lHUlu/NiQdd2f6fZ9xnVD86clvGMENysDc9M= -github.com/filecoin-project/venus v1.14.0-rc3.0.20231019071557-12e011e709ac/go.mod h1:zw20NIwK28DR4lywXNV5jtJsUEhV6haniEMQpJDfqNU= +github.com/filecoin-project/venus v1.14.0 h1:h2m5D+cpXJ618PmqbWeLcZmSLOaLx2bRBKRzAB+Fqyo= +github.com/filecoin-project/venus v1.14.0/go.mod h1:8dsvkGM89g+3tDduyWDEFxp8Fzc0cOAief2Riv6Q1ZY= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= @@ -670,8 +670,10 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.2 h1:Dwmkdr5Nc/oBiXgJS3CDHNhJtIHkuZ3DZF5twqnfBdU= -github.com/hashicorp/golang-lru/v2 v2.0.2/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hashicorp/golang-lru/arc/v2 v2.0.7 h1:QxkVTxwColcduO+LP7eJO56r2hFiG8zEbfAAzRv52KQ= +github.com/hashicorp/golang-lru/arc/v2 v2.0.7/go.mod h1:Pe7gBlGdc8clY5LJ0LpJXMt5AmgmWNH1g+oFFVUHOEc= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= @@ -699,16 +701,16 @@ github.com/ipfs-force-community/dagstore v0.4.4-0.20230628060530-4b25fff4d833 h1 github.com/ipfs-force-community/dagstore v0.4.4-0.20230628060530-4b25fff4d833/go.mod h1:YKn4qXih+/2xQWpfJsaKGOi4POw5vH5grDmfPCCnx8g= github.com/ipfs-force-community/go-fil-markets v1.2.6-0.20230822060005-aee2cbae5b01 h1:sD9/GoGBui1j5fpKepe1v4P5NsjurqbM8WQlk4LNZeI= github.com/ipfs-force-community/go-fil-markets v1.2.6-0.20230822060005-aee2cbae5b01/go.mod h1:eryxo/oVgIxaR5g5CNr9PlvZOi+u/bak0IsPL/PT1hk= -github.com/ipfs-force-community/go-jsonrpc v0.1.8 h1:w7CWlLveL+aXD3gLg8Z7I1RcktCiMY0sp8dgJG37uWE= -github.com/ipfs-force-community/go-jsonrpc v0.1.8/go.mod h1:jBSvPTl8V1N7gSTuCR4bis8wnQnIjHbRPpROol6iQKM= +github.com/ipfs-force-community/go-jsonrpc v0.1.9 h1:5QavBltfvV6fz/+EbYsCkVxJ1MSJncZm6YuPs1SLdZU= +github.com/ipfs-force-community/go-jsonrpc v0.1.9/go.mod h1:jBSvPTl8V1N7gSTuCR4bis8wnQnIjHbRPpROol6iQKM= github.com/ipfs-force-community/metrics v1.0.1-0.20231011024528-8c881d456601 h1:zxKQ30KAD6KfvSFAx9tuqQXLDsEHyF+eVaUBXXYC2bU= github.com/ipfs-force-community/metrics v1.0.1-0.20231011024528-8c881d456601/go.mod h1:wM6EmkEcnJgWOFcVytgvK0u15awEmt8He0f2kAdsFDA= -github.com/ipfs-force-community/sophon-auth v1.14.0-rc1 h1:r+TSz2r6H7K0ZtsiyS4Hmmf1bM62e5vQiHA8SYPIBz4= -github.com/ipfs-force-community/sophon-auth v1.14.0-rc1/go.mod h1:d6J6u3zyIwcEajRho5BhVBcoIChEf0K76wP4yJEfEhc= -github.com/ipfs-force-community/sophon-gateway v1.14.0-rc1 h1:PXsKzeQQgeFhdhkRdD7s884b/VAIRZzIef35ABJ/fY0= -github.com/ipfs-force-community/sophon-gateway v1.14.0-rc1/go.mod h1:IoxmDkC9NG3+HGWizh48fP1cxvbN7fU9dIvRTxupk4Q= -github.com/ipfs-force-community/sophon-messager v1.14.0-rc1 h1:IkCsbJunxLRE0klOuFK0Be4+T0UqtG4qx1ZnETP+yEM= -github.com/ipfs-force-community/sophon-messager v1.14.0-rc1/go.mod h1:RtNzCvqbIt3et1g/OErE0ijraAJReCc7Ingz779hrcI= +github.com/ipfs-force-community/sophon-auth v1.14.0 h1:ctBJ6UHkcytEzfVPgiiHo0cW4FGQrE7r1H3Um0FcHbo= +github.com/ipfs-force-community/sophon-auth v1.14.0/go.mod h1:d6J6u3zyIwcEajRho5BhVBcoIChEf0K76wP4yJEfEhc= +github.com/ipfs-force-community/sophon-gateway v1.14.0 h1:nl4RnYiwVwviYbi0qhdisUHqHaOdoux1BbT6ps/F1iY= +github.com/ipfs-force-community/sophon-gateway v1.14.0/go.mod h1:CspoELDrDr2UvEdOibcp0JGQgcx6XKst+1I6ma0TsD8= +github.com/ipfs-force-community/sophon-messager v1.14.0 h1:5g1S67y+3aF/b973gI4KC3Ja/QNcX6h9BPR4ZWu+l84= +github.com/ipfs-force-community/sophon-messager v1.14.0/go.mod h1:u20VTUE0MJU3H5qfCHg9rkuJUtiy4L4Y9yqd3QtT8c0= github.com/ipfs-force-community/venus-common-utils v0.0.0-20220217030526-e5e4c6bc14f7 h1:v/1/INcqm3kHLauWQYB63MwWJRWGz+3WEuUPp0jzIl8= github.com/ipfs-force-community/venus-common-utils v0.0.0-20220217030526-e5e4c6bc14f7/go.mod h1:sSTUXgIu95tPHvgcYhdLuELmgPJWCP/pNMFtsrVtOyA= github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= diff --git a/piecestorage/s3_test.go b/piecestorage/s3_test.go index c9d51ee5..ec2315c3 100644 --- a/piecestorage/s3_test.go +++ b/piecestorage/s3_test.go @@ -130,12 +130,12 @@ func testS3PieceStorage(t *testing.T, s3Cfg *config.S3PieceStorage) { } func randomString(n int) string { - rand.Seed(time.Now().UnixNano()) + r := rand.New(rand.NewSource(time.Now().UnixNano())) letter := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") b := make([]rune, n) for i := range b { - b[i] = letter[rand.Intn(len(letter))] + b[i] = letter[r.Intn(len(letter))] } return string(b) } diff --git a/retrievalprovider/datatransfer_handler.go b/retrievalprovider/datatransfer_handler.go index 5eb25df1..f4b5909c 100644 --- a/retrievalprovider/datatransfer_handler.go +++ b/retrievalprovider/datatransfer_handler.go @@ -21,6 +21,7 @@ type IDatatransferHandler interface { HandleCancelForDeal(context.Context, rm.ProviderDealIdentifier) error HandleErrorForDeal(context.Context, rm.ProviderDealIdentifier, error) error + TryHandleCompleted(context.Context, rm.ProviderDealIdentifier) error } var _ IDatatransferHandler = (*DataTransferHandler)(nil) @@ -42,6 +43,17 @@ func (d *DataTransferHandler) HandleCompleteFor(ctx context.Context, identifier return d.retrievalDealHandler.CleanupDeal(ctx, deal) } +func (d *DataTransferHandler) TryHandleCompleted(ctx context.Context, identifier rm.ProviderDealIdentifier) error { + deal, err := d.retrievalDealStore.GetDeal(ctx, identifier.Receiver, identifier.DealID) + if err != nil { + return err + } + if deal.Status == rm.DealStatusFinalizing { + return d.retrievalDealHandler.CleanupDeal(ctx, deal) + } + return nil +} + func (d *DataTransferHandler) HandleAcceptFor(ctx context.Context, identifier rm.ProviderDealIdentifier, channelId datatransfer.ChannelID) error { deal, err := d.retrievalDealStore.GetDeal(ctx, identifier.Receiver, identifier.DealID) if err != nil { diff --git a/retrievalprovider/httpretrieval/server.go b/retrievalprovider/httpretrieval/server.go index 3349f54d..a0f7abc7 100644 --- a/retrievalprovider/httpretrieval/server.go +++ b/retrievalprovider/httpretrieval/server.go @@ -50,8 +50,9 @@ func (s *Server) RetrievalByPieceCID(w http.ResponseWriter, r *http.Request) { _, err = s.listDealsByPiece(ctx, pieceCIDStr) if err != nil { log.Warn(err) - badResponse(w, http.StatusNotFound, err) - return + // todo: reject deal? + // badResponse(w, http.StatusNotFound, err) + // return } store, err := s.pieceMgr.FindStorageForRead(ctx, pieceCIDStr) diff --git a/retrievalprovider/provider_datatransfer_sub.go b/retrievalprovider/provider_datatransfer_sub.go index 664cce06..a33cd623 100644 --- a/retrievalprovider/provider_datatransfer_sub.go +++ b/retrievalprovider/provider_datatransfer_sub.go @@ -89,9 +89,10 @@ func ProviderDataTransferSubscriber(deals IDatatransferHandler) datatransfer.Sub log.Errorf("processing dt event: %s", err) } case datatransfer.NewVoucherResult: + // todo: 为了解决检索完成后订单状态还是 `DealStatusFinalizing`,在 `go-fil-markets` 中是没有处理这个状态 mlog = mlog.With("channelStatus", channelState.Status()) if channelState.Status() == datatransfer.Finalizing { - err := deals.HandleCompleteFor(ctx, identify) + err := deals.TryHandleCompleted(ctx, identify) if err != nil { log.Errorf("processing dt event: %s", err) } diff --git a/version/version.go b/version/version.go index 58153df5..4c02e582 100644 --- a/version/version.go +++ b/version/version.go @@ -3,7 +3,7 @@ package version var ( CurrentCommit string - Version = "v2.10.0-rc2" + Version = "v2.10.0" ) func UserVersion() string {