From c66e594046a52d6f5dcd8e7645d264645e895299 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Fri, 27 Nov 2020 15:37:22 +0100 Subject: [PATCH 1/4] fix: cancel transfer cancels storage deal --- cli/client.go | 9 ++++++++- cmd/lotus-storage-miner/market.go | 10 +++++++++- go.mod | 2 +- go.sum | 5 +++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/cli/client.go b/cli/client.go index 20a7231da63..43059f152e9 100644 --- a/cli/client.go +++ b/cli/client.go @@ -1825,6 +1825,11 @@ var clientCancelTransfer = &cli.Command{ Usage: "specify only transfers where peer is/is not initiator", Value: true, }, + &cli.DurationFlag{ + Name: "cancel-timeout", + Usage: "time to wait for cancel to be sent to storage provider", + Value: 5 * time.Second, + }, }, Action: func(cctx *cli.Context) error { if !cctx.Args().Present() { @@ -1868,7 +1873,9 @@ var clientCancelTransfer = &cli.Command{ } } - return api.ClientCancelDataTransfer(ctx, transferID, other, initiator) + timeoutCtx, cancel := context.WithTimeout(ctx, cctx.Duration("cancel-timeout")) + defer cancel() + return api.ClientCancelDataTransfer(timeoutCtx, transferID, other, initiator) }, } diff --git a/cmd/lotus-storage-miner/market.go b/cmd/lotus-storage-miner/market.go index be4a529e982..15a3c8b649d 100644 --- a/cmd/lotus-storage-miner/market.go +++ b/cmd/lotus-storage-miner/market.go @@ -2,6 +2,7 @@ package main import ( "bufio" + "context" "errors" "fmt" "io" @@ -650,6 +651,11 @@ var marketCancelTransfer = &cli.Command{ Usage: "specify only transfers where peer is/is not initiator", Value: false, }, + &cli.DurationFlag{ + Name: "cancel-timeout", + Usage: "time to wait for cancel to be sent to client", + Value: 5 * time.Second, + }, }, Action: func(cctx *cli.Context) error { if !cctx.Args().Present() { @@ -693,7 +699,9 @@ var marketCancelTransfer = &cli.Command{ } } - return nodeApi.MarketCancelDataTransfer(ctx, transferID, other, initiator) + timeoutCtx, cancel := context.WithTimeout(ctx, cctx.Duration("cancel-timeout")) + defer cancel() + return nodeApi.MarketCancelDataTransfer(timeoutCtx, transferID, other, initiator) }, } diff --git a/go.mod b/go.mod index 33b5de51627..dc5678bd1dc 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 github.com/filecoin-project/go-data-transfer v1.2.0 github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a - github.com/filecoin-project/go-fil-markets v1.0.7 + github.com/filecoin-project/go-fil-markets v1.0.8-0.20201127142850-25afe9e33804 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 736d3b3781f..38b7c12b76c 100644 --- a/go.sum +++ b/go.sum @@ -253,6 +253,7 @@ github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMX github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ= github.com/filecoin-project/go-data-transfer v1.0.1 h1:5sYKDbstyDsdJpVP4UGUW6+BgCNfgnH8hQgf0E3ZAno= github.com/filecoin-project/go-data-transfer v1.0.1/go.mod h1:UxvfUAY9v3ub0a21BSK9u3pB2aq30Y0KMsG+w9/ysyo= +github.com/filecoin-project/go-data-transfer v1.1.1-0.20201127133903-9944ad93a52a/go.mod h1:ZAH51JZFR8NZC4FPiDPG+swjgui0q6zTMJbztc6pHhY= github.com/filecoin-project/go-data-transfer v1.2.0 h1:LM+K+J+y9t8e3gYskJHWDlyHJsF6aaxoHOP+HIiVE1U= github.com/filecoin-project/go-data-transfer v1.2.0/go.mod h1:ZAH51JZFR8NZC4FPiDPG+swjgui0q6zTMJbztc6pHhY= github.com/filecoin-project/go-ds-versioning v0.1.0 h1:y/X6UksYTsK8TLCI7rttCKEvl8btmWxyFMEeeWGUxIQ= @@ -262,8 +263,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.0.7 h1:t6zfm2wvL5jVCewy4RLINaembmHuxqC3dZCSqq9dtH8= -github.com/filecoin-project/go-fil-markets v1.0.7/go.mod h1:iVYc+VrHIP15F5COkHNM6ndTwKSJ7qPrHSKCfFUnve4= +github.com/filecoin-project/go-fil-markets v1.0.8-0.20201127142850-25afe9e33804 h1:nr3jCJ+vFTf6nmWx2Vs1PZYGeiUj3GY+z25sPwU7pRk= +github.com/filecoin-project/go-fil-markets v1.0.8-0.20201127142850-25afe9e33804/go.mod h1:BU1ugMGWQsTIKvvR/KiodZAim6hoHZhXP193rNRgCAM= 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= From 7bab281449604c8a01cc8da7c25dcd2cab7c49f6 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Tue, 1 Dec 2020 11:12:41 +0100 Subject: [PATCH 2/4] feat: go-data-transfer v1.2.2 / go-fil-markets v1.0.8 --- go.mod | 4 ++-- go.sum | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index dc5678bd1dc..0a307a7dabd 100644 --- a/go.mod +++ b/go.mod @@ -30,9 +30,9 @@ require ( github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2 github.com/filecoin-project/go-commp-utils v0.0.0-20201119054358-b88f7a96a434 github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 - github.com/filecoin-project/go-data-transfer v1.2.0 + github.com/filecoin-project/go-data-transfer v1.2.2 github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a - github.com/filecoin-project/go-fil-markets v1.0.8-0.20201127142850-25afe9e33804 + github.com/filecoin-project/go-fil-markets v1.0.8 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 38b7c12b76c..4c4763bf39f 100644 --- a/go.sum +++ b/go.sum @@ -253,9 +253,8 @@ github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMX github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ= github.com/filecoin-project/go-data-transfer v1.0.1 h1:5sYKDbstyDsdJpVP4UGUW6+BgCNfgnH8hQgf0E3ZAno= github.com/filecoin-project/go-data-transfer v1.0.1/go.mod h1:UxvfUAY9v3ub0a21BSK9u3pB2aq30Y0KMsG+w9/ysyo= -github.com/filecoin-project/go-data-transfer v1.1.1-0.20201127133903-9944ad93a52a/go.mod h1:ZAH51JZFR8NZC4FPiDPG+swjgui0q6zTMJbztc6pHhY= -github.com/filecoin-project/go-data-transfer v1.2.0 h1:LM+K+J+y9t8e3gYskJHWDlyHJsF6aaxoHOP+HIiVE1U= -github.com/filecoin-project/go-data-transfer v1.2.0/go.mod h1:ZAH51JZFR8NZC4FPiDPG+swjgui0q6zTMJbztc6pHhY= +github.com/filecoin-project/go-data-transfer v1.2.2 h1:zBeUNqSXgYbHqyl3mnwQU5GdOM1h0ecbqc6yvqmHsCQ= +github.com/filecoin-project/go-data-transfer v1.2.2/go.mod h1:ZAH51JZFR8NZC4FPiDPG+swjgui0q6zTMJbztc6pHhY= github.com/filecoin-project/go-ds-versioning v0.1.0 h1:y/X6UksYTsK8TLCI7rttCKEvl8btmWxyFMEeeWGUxIQ= github.com/filecoin-project/go-ds-versioning v0.1.0/go.mod h1:mp16rb4i2QPmxBnmanUx8i/XANp+PFCCJWiAb+VW4/s= github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f h1:GxJzR3oRIMTPtpZ0b7QF8FKPK6/iPAc7trhlL5k/g+s= @@ -263,8 +262,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.0.8-0.20201127142850-25afe9e33804 h1:nr3jCJ+vFTf6nmWx2Vs1PZYGeiUj3GY+z25sPwU7pRk= -github.com/filecoin-project/go-fil-markets v1.0.8-0.20201127142850-25afe9e33804/go.mod h1:BU1ugMGWQsTIKvvR/KiodZAim6hoHZhXP193rNRgCAM= +github.com/filecoin-project/go-fil-markets v1.0.8 h1:x56t3cnAlQWXIxhzu4R4DOF5Hde1L6a0JxVtPBQOR1k= +github.com/filecoin-project/go-fil-markets v1.0.8/go.mod h1:uOikzYK7aNbSWMczCp6Ru257ML4PplLRBfDk/NAOgaY= 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= From ceea03cd406cdfccf4db60e68fc9986967d9e0c6 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Tue, 1 Dec 2020 11:48:14 +0100 Subject: [PATCH 3/4] fix: client test list-deals parsing --- cli/test/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/test/client.go b/cli/test/client.go index 3a2827a6592..b75e1302556 100644 --- a/cli/test/client.go +++ b/cli/test/client.go @@ -82,7 +82,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNode) fmt.Println("list-deals:\n", out) lines := strings.Split(out, "\n") - require.Len(t, lines, 2) + require.GreaterOrEqual(t, len(lines), 2) re := regexp.MustCompile(`\s+`) parts := re.Split(lines[1], -1) if len(parts) < 4 { From c5a8b7076c375fcda3a596ced7148e290b28f4db Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Tue, 1 Dec 2020 11:58:28 +0100 Subject: [PATCH 4/4] feat: go-fil-markets v1.0.9 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0a307a7dabd..6b62ec67d88 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 github.com/filecoin-project/go-data-transfer v1.2.2 github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a - github.com/filecoin-project/go-fil-markets v1.0.8 + github.com/filecoin-project/go-fil-markets v1.0.9 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 4c4763bf39f..0b86f739ce2 100644 --- a/go.sum +++ b/go.sum @@ -262,8 +262,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.0.8 h1:x56t3cnAlQWXIxhzu4R4DOF5Hde1L6a0JxVtPBQOR1k= -github.com/filecoin-project/go-fil-markets v1.0.8/go.mod h1:uOikzYK7aNbSWMczCp6Ru257ML4PplLRBfDk/NAOgaY= +github.com/filecoin-project/go-fil-markets v1.0.9 h1:bGWo6xoXV9zMPYgbplQDtUREogDuKPiSY1CYwxV5cOY= +github.com/filecoin-project/go-fil-markets v1.0.9/go.mod h1:uOikzYK7aNbSWMczCp6Ru257ML4PplLRBfDk/NAOgaY= 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=