From a19d6ce8a36d2c03fb587cc693ede0eca51a7ae0 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Mon, 1 Feb 2021 14:53:45 +0100 Subject: [PATCH] fix: zero price-per-byte retrieval --- api/test/deals.go | 15 +++++++++++++++ go.mod | 2 +- go.sum | 4 ++-- node/node_test.go | 3 +++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/api/test/deals.go b/api/test/deals.go index 3fa6f2d4b7e..f81be139ac3 100644 --- a/api/test/deals.go +++ b/api/test/deals.go @@ -159,6 +159,21 @@ func TestSecondDealRetrieval(t *testing.T, b APIBuilder, blocktime time.Duration } } +func TestZeroPricePerByteRetrievalDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration, startEpoch abi.ChainEpoch) { + s := setupOneClientOneMiner(t, b, blocktime) + defer s.blockMiner.Stop() + + // Set price-per-byte to zero + ask, err := s.miner.MarketGetRetrievalAsk(s.ctx) + require.NoError(t, err) + + ask.PricePerByte = abi.NewTokenAmount(0) + err = s.miner.MarketSetRetrievalAsk(s.ctx, ask) + require.NoError(t, err) + + MakeDeal(t, s.ctx, 6, s.client, s.miner, false, false, startEpoch) +} + func startDeal(t *testing.T, ctx context.Context, miner TestStorageNode, client api.FullNode, fcid cid.Cid, fastRet bool, startEpoch abi.ChainEpoch) *cid.Cid { maddr, err := miner.ActorAddress(ctx) if err != nil { diff --git a/go.mod b/go.mod index 25519291656..f9e84394816 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 github.com/filecoin-project/go-data-transfer v1.2.7 github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a - github.com/filecoin-project/go-fil-markets v1.1.2 + github.com/filecoin-project/go-fil-markets v1.1.5 github.com/filecoin-project/go-jsonrpc v0.1.2 github.com/filecoin-project/go-multistore v0.0.3 github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20 diff --git a/go.sum b/go.sum index 43d98b93d2e..fd407a6e285 100644 --- a/go.sum +++ b/go.sum @@ -269,8 +269,8 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a h1:hyJ+pUm/4U4RdEZBlg6k8Ma4rDiuvqyGpoICXAxwsTg= github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c= -github.com/filecoin-project/go-fil-markets v1.1.2 h1:5FVdDmF9GvW6Xllql9OGiJXEZjh/tu590BXSQH2W/vU= -github.com/filecoin-project/go-fil-markets v1.1.2/go.mod h1:6oTRaAsHnCqhi3mpZqdvnWIzH6QzHQc4dbhJrI9/BfQ= +github.com/filecoin-project/go-fil-markets v1.1.5 h1:S5LIyy7VruG+zFMfsuDiJKvEqF+NpTPRMvN9GqJko3w= +github.com/filecoin-project/go-fil-markets v1.1.5/go.mod h1:6oTRaAsHnCqhi3mpZqdvnWIzH6QzHQc4dbhJrI9/BfQ= github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM= github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24= github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM= diff --git a/node/node_test.go b/node/node_test.go index 142e8875a9b..e8afd8789b0 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -57,6 +57,9 @@ func TestAPIDealFlow(t *testing.T) { t.Run("TestFastRetrievalDealFlow", func(t *testing.T) { test.TestFastRetrievalDealFlow(t, builder.MockSbBuilder, blockTime, dealStartEpoch) }) + t.Run("TestZeroPricePerByteRetrievalDealFlow", func(t *testing.T) { + test.TestZeroPricePerByteRetrievalDealFlow(t, builder.MockSbBuilder, blockTime, dealStartEpoch) + }) } func TestAPIDealFlowReal(t *testing.T) {