From 854b3c5bd696382573295693365d63f630672833 Mon Sep 17 00:00:00 2001 From: tanlang Date: Wed, 18 Oct 2023 15:00:26 +0800 Subject: [PATCH] feat/use deal bound from policy directly --- go.mod | 4 ++-- go.sum | 8 ++++---- storageprovider/deal_handler.go | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 17bb0bf8..317b5d4e 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.4 + github.com/filecoin-project/go-state-types v0.12.5 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-rc2 + github.com/filecoin-project/venus v1.14.0-rc3 github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.8.0 diff --git a/go.sum b/go.sum index db6cc14b..6eaca072 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.4 h1:F1yQRCgFGvg+UmBGWxskHcvNswjh061Ok/kOk0OWhQY= -github.com/filecoin-project/go-state-types v0.12.4/go.mod h1:iJTqGdWDvzXhuVf64Lw0hzt4TIoitMo0VgHdxdjNDZI= +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-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-rc2 h1:+kb1L2OB/ZmpkyxhpdiwNxTkKnsdYhgyk2VVgNz2oI0= -github.com/filecoin-project/venus v1.14.0-rc2/go.mod h1:vw+aZ7Qk31GlFI8Y6unvdtzwG8QklDVOiyY3y47b3+g= +github.com/filecoin-project/venus v1.14.0-rc3 h1:1Q825vaN+1ge8oUlZybwlBI+wZqtIF+lAinNAtMjVqM= +github.com/filecoin-project/venus v1.14.0-rc3/go.mod h1:bLEVCNZ6W3KIzM+If8fUveFHlz7LJcdPVsSHT1MJkMc= 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= diff --git a/storageprovider/deal_handler.go b/storageprovider/deal_handler.go index 2bbc9617..46be6abb 100644 --- a/storageprovider/deal_handler.go +++ b/storageprovider/deal_handler.go @@ -42,6 +42,8 @@ import ( vTypes "github.com/filecoin-project/venus/venus-shared/types" types "github.com/filecoin-project/venus/venus-shared/types/market" + + "github.com/filecoin-project/venus/venus-shared/actors/policy" ) // TODO: These are copied from spec-actors master, use spec-actors exports when we update @@ -204,7 +206,7 @@ func (storageDealPorcess *StorageDealProcessImpl) acceptDeal(ctx context.Context // Check that the delta between the start and end epochs (the deal // duration) is within acceptable bounds - minDuration, maxDuration := vTypes.DealDurationBounds(proposal.PieceSize) + minDuration, maxDuration := policy.DealDurationBounds(proposal.PieceSize) if proposal.Duration() < minDuration || proposal.Duration() > maxDuration { return fmt.Errorf("deal duration out of bounds (min, max, provided): %d, %d, %d", minDuration, maxDuration, proposal.Duration()) }