From a81a9277fc6c147ad1c0c137d1718fc9542c7194 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Fri, 23 Jul 2021 10:27:08 -0700 Subject: [PATCH 1/3] remove wrong peer check in push deal validation --- storagemarket/impl/requestvalidation/common.go | 3 --- .../requestvalidation/request_validation_test.go | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/storagemarket/impl/requestvalidation/common.go b/storagemarket/impl/requestvalidation/common.go index 41a41aa5..a22962af 100644 --- a/storagemarket/impl/requestvalidation/common.go +++ b/storagemarket/impl/requestvalidation/common.go @@ -34,9 +34,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) diff --git a/storagemarket/impl/requestvalidation/request_validation_test.go b/storagemarket/impl/requestvalidation/request_validation_test.go index 85428f89..a8e7902a 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 { From 11d1f2901eacf75bcba2104327f2fe38948d5af3 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Fri, 23 Jul 2021 10:49:40 -0700 Subject: [PATCH 2/3] kill the pull side of peer id checking as well --- storagemarket/impl/requestvalidation/common.go | 3 --- .../requestvalidation/request_validation_test.go | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/storagemarket/impl/requestvalidation/common.go b/storagemarket/impl/requestvalidation/common.go index a22962af..a35a231a 100644 --- a/storagemarket/impl/requestvalidation/common.go +++ b/storagemarket/impl/requestvalidation/common.go @@ -68,9 +68,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 a8e7902a..3de91720 100644 --- a/storagemarket/impl/requestvalidation/request_validation_test.go +++ b/storagemarket/impl/requestvalidation/request_validation_test.go @@ -234,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 1380c95f60f2864d8b223dd8a37771808fdd9db1 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Fri, 23 Jul 2021 10:50:07 -0700 Subject: [PATCH 3/3] fixup comments --- storagemarket/impl/requestvalidation/common.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/storagemarket/impl/requestvalidation/common.go b/storagemarket/impl/requestvalidation/common.go index a35a231a..cc5f010c 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( @@ -50,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(