From b9e514cf37717604fa29d9d8499667fd13c039c6 Mon Sep 17 00:00:00 2001 From: dirkmc Date: Thu, 15 Jul 2021 11:36:12 +0200 Subject: [PATCH 1/3] fix: circleci docs-gen task (#574) --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8684c3f37..fd17e6eed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: go: gotest/tools@0.0.9 codecov: codecov/codecov@1.0.2 - node: circleci/node@3.0.0 + node: circleci/node@4.5.1 executors: golang: From 9ef0c55d5e5335f7d3528cd2ae9c4bc6a248ef31 Mon Sep 17 00:00:00 2001 From: Whyrusleeping Date: Fri, 23 Jul 2021 11:02:11 -0700 Subject: [PATCH 2/3] remove wrong peer check in push deal validation (#585) * remove wrong peer check in push deal validation * kill the pull side of peer id checking as well * fixup comments --- .../impl/requestvalidation/common.go | 8 ----- .../request_validation_test.go | 30 ------------------- 2 files changed, 38 deletions(-) diff --git a/storagemarket/impl/requestvalidation/common.go b/storagemarket/impl/requestvalidation/common.go index 41a41aa5d..cc5f010ce 100644 --- a/storagemarket/impl/requestvalidation/common.go +++ b/storagemarket/impl/requestvalidation/common.go @@ -15,7 +15,6 @@ import ( // Will succeed only if: // - voucher has correct type // - voucher references an active deal -// - referenced deal matches the client // - referenced deal matches the given base CID // - referenced deal is in an acceptable state func ValidatePush( @@ -34,9 +33,6 @@ func ValidatePush( if err != nil { return xerrors.Errorf("Proposal CID %s: %w", dealVoucher.Proposal.String(), ErrNoDeal) } - if deal.Client != sender { - return xerrors.Errorf("Deal Peer %s, Data Transfer Peer %s: %w", deal.Client.String(), sender.String(), ErrWrongPeer) - } if !deal.Ref.Root.Equals(baseCid) { return xerrors.Errorf("Deal Payload CID %s, Data Transfer CID %s: %w", deal.Proposal.PieceCID.String(), baseCid.String(), ErrWrongPiece) @@ -53,7 +49,6 @@ func ValidatePush( // Will succeed only if: // - voucher has correct type // - voucher references an active deal -// - referenced deal matches the receiver (miner) // - referenced deal matches the given base CID // - referenced deal is in an acceptable state func ValidatePull( @@ -71,9 +66,6 @@ func ValidatePull( return xerrors.Errorf("Proposal CID %s: %w", dealVoucher.Proposal.String(), ErrNoDeal) } - if deal.Miner != receiver { - return xerrors.Errorf("Deal Peer %s, Data Transfer Peer %s: %w", deal.Miner.String(), receiver.String(), ErrWrongPeer) - } if !deal.DataRef.Root.Equals(baseCid) { return xerrors.Errorf("Deal Payload CID %s, Data Transfer CID %s: %w", deal.Proposal.PieceCID.String(), baseCid.String(), ErrWrongPiece) } diff --git a/storagemarket/impl/requestvalidation/request_validation_test.go b/storagemarket/impl/requestvalidation/request_validation_test.go index 85428f891..3de917208 100644 --- a/storagemarket/impl/requestvalidation/request_validation_test.go +++ b/storagemarket/impl/requestvalidation/request_validation_test.go @@ -176,21 +176,6 @@ func AssertPushValidator(t *testing.T, validator datatransfer.RequestValidator, t.Fatal("Push should fail if there is no deal stored") } }) - t.Run("ValidatePush fails wrong miner", func(t *testing.T) { - otherClient := peer.ID("otherclient") - minerDeal, err := newMinerDeal(otherClient, storagemarket.StorageDealProposalAccepted) - if err != nil { - t.Fatal("error creating client deal") - } - if err := state.Begin(minerDeal.ProposalCid, &minerDeal); err != nil { - t.Fatal("deal tracking failed") - } - ref := minerDeal.Ref - _, err = validator.ValidatePush(false, datatransfer.ChannelID{}, sender, &rv.StorageDataTransferVoucher{minerDeal.ProposalCid}, ref.Root, nil) - if !xerrors.Is(err, rv.ErrWrongPeer) { - t.Fatal("Push should fail if miner address is incorrect") - } - }) t.Run("ValidatePush fails wrong piece ref", func(t *testing.T) { minerDeal, err := newMinerDeal(sender, storagemarket.StorageDealProposalAccepted) if err != nil { @@ -249,21 +234,6 @@ func AssertValidatesPulls(t *testing.T, validator datatransfer.RequestValidator, t.Fatal("Pull should fail if there is no deal stored") } }) - t.Run("ValidatePull fails wrong client", func(t *testing.T) { - otherMiner := peer.ID("otherminer") - clientDeal, err := newClientDeal(otherMiner, storagemarket.StorageDealProposalAccepted) - if err != nil { - t.Fatal("error creating client deal") - } - if err := state.Begin(clientDeal.ProposalCid, &clientDeal); err != nil { - t.Fatal("deal tracking failed") - } - payloadCid := clientDeal.DataRef.Root - _, err = validator.ValidatePull(false, datatransfer.ChannelID{}, receiver, &rv.StorageDataTransferVoucher{clientDeal.ProposalCid}, payloadCid, nil) - if !xerrors.Is(err, rv.ErrWrongPeer) { - t.Fatal("Pull should fail if miner address is incorrect") - } - }) t.Run("ValidatePull fails wrong piece ref", func(t *testing.T) { clientDeal, err := newClientDeal(receiver, storagemarket.StorageDealProposalAccepted) if err != nil { From f15eef93560efe4d09b6c1c5ae1b81c605535459 Mon Sep 17 00:00:00 2001 From: Peter Rabbitson Date: Fri, 23 Jul 2021 21:33:17 +0200 Subject: [PATCH 3/3] Do not hex-encode CIDs in logs (#561) --- storagemarket/impl/provider.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storagemarket/impl/provider.go b/storagemarket/impl/provider.go index bb8835d80..36e07707d 100644 --- a/storagemarket/impl/provider.go +++ b/storagemarket/impl/provider.go @@ -331,7 +331,7 @@ func (p *Provider) ImportDataForDeal(ctx context.Context, propCid cid.Cid, data // Verify CommP matches if !pieceCid.Equals(d.Proposal.PieceCID) { cleanup() - return xerrors.Errorf("given data does not match expected commP (got: %x, expected %x)", pieceCid, d.Proposal.PieceCID) + return xerrors.Errorf("given data does not match expected commP (got: %s, expected %s)", pieceCid, d.Proposal.PieceCID) } return p.deals.Send(propCid, storagemarket.ProviderEventVerifiedData, tempfi.Path(), filestore.Path(""))