From 8d48e1866875fc7d83eb5e3efb313143853ddf6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Mon, 16 Aug 2021 20:40:27 +0100 Subject: [PATCH] Revert "refactor: pass deal proposal instead of deal ID to OnDealExpiredOrSlashed (#476)" This reverts commit 2e06ce3307ed3a7c23f4abba907d7020c1f732e7. --- storagemarket/impl/clientstates/client_states.go | 2 +- storagemarket/impl/clientstates/client_states_test.go | 1 - storagemarket/impl/providerstates/provider_states.go | 2 +- storagemarket/nodes.go | 2 +- storagemarket/testnodes/testnodes.go | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/storagemarket/impl/clientstates/client_states.go b/storagemarket/impl/clientstates/client_states.go index b3589dc2..0d60f049 100644 --- a/storagemarket/impl/clientstates/client_states.go +++ b/storagemarket/impl/clientstates/client_states.go @@ -309,7 +309,7 @@ func WaitForDealCompletion(ctx fsm.Context, environment ClientDealEnvironment, d } } - if err := node.OnDealExpiredOrSlashed(ctx.Context(), *deal.PublishMessage, deal.Proposal, expiredCb, slashedCb); err != nil { + if err := node.OnDealExpiredOrSlashed(ctx.Context(), deal.DealID, expiredCb, slashedCb); err != nil { return ctx.Trigger(storagemarket.ClientEventDealCompletionFailed, err) } diff --git a/storagemarket/impl/clientstates/client_states_test.go b/storagemarket/impl/clientstates/client_states_test.go index 91e56f12..2fda2c2c 100644 --- a/storagemarket/impl/clientstates/client_states_test.go +++ b/storagemarket/impl/clientstates/client_states_test.go @@ -610,7 +610,6 @@ func makeExecutor(ctx context.Context, dealState, err := tut.MakeTestClientDeal(initialState, clientDealProposal, envParams.manualTransfer) assert.NoError(t, err) dealState.AddFundsCid = &tut.GenerateCids(1)[0] - dealState.PublishMessage = &tut.GenerateCids(1)[0] dealState.FastRetrieval = dealParams.fastRetrieval dealState.TransferChannelID = &datatransfer.ChannelID{} diff --git a/storagemarket/impl/providerstates/provider_states.go b/storagemarket/impl/providerstates/provider_states.go index 0356869c..81d1fef2 100644 --- a/storagemarket/impl/providerstates/provider_states.go +++ b/storagemarket/impl/providerstates/provider_states.go @@ -507,7 +507,7 @@ func WaitForDealCompletion(ctx fsm.Context, environment ProviderDealEnvironment, } } - if err := node.OnDealExpiredOrSlashed(ctx.Context(), *deal.PublishCid, deal.Proposal, expiredCb, slashedCb); err != nil { + if err := node.OnDealExpiredOrSlashed(ctx.Context(), deal.DealID, expiredCb, slashedCb); err != nil { return ctx.Trigger(storagemarket.ProviderEventDealCompletionFailed, err) } diff --git a/storagemarket/nodes.go b/storagemarket/nodes.go index cd9e0f0a..c2266527 100644 --- a/storagemarket/nodes.go +++ b/storagemarket/nodes.go @@ -67,7 +67,7 @@ type StorageCommon interface { OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, sectorNumber abi.SectorNumber, proposal market.DealProposal, publishCid *cid.Cid, cb DealSectorCommittedCallback) error // OnDealExpiredOrSlashed registers callbacks to be called when the deal expires or is slashed - OnDealExpiredOrSlashed(ctx context.Context, publishCid cid.Cid, proposal market.DealProposal, onDealExpired DealExpiredCallback, onDealSlashed DealSlashedCallback) error + OnDealExpiredOrSlashed(ctx context.Context, dealID abi.DealID, onDealExpired DealExpiredCallback, onDealSlashed DealSlashedCallback) error } // PackingResult returns information about how a deal was put into a sector diff --git a/storagemarket/testnodes/testnodes.go b/storagemarket/testnodes/testnodes.go index eb10bd58..18d60fdb 100644 --- a/storagemarket/testnodes/testnodes.go +++ b/storagemarket/testnodes/testnodes.go @@ -231,7 +231,7 @@ func (n *FakeCommonNode) OnDealSectorCommitted(ctx context.Context, provider add } // OnDealExpiredOrSlashed simulates waiting for a deal to be expired or slashed, but provides stubbed behavior -func (n *FakeCommonNode) OnDealExpiredOrSlashed(ctx context.Context, publishCid cid.Cid, proposal market.DealProposal, onDealExpired storagemarket.DealExpiredCallback, onDealSlashed storagemarket.DealSlashedCallback) error { +func (n *FakeCommonNode) OnDealExpiredOrSlashed(ctx context.Context, dealID abi.DealID, onDealExpired storagemarket.DealExpiredCallback, onDealSlashed storagemarket.DealSlashedCallback) error { if n.DelayFakeCommonNode.OnDealExpiredOrSlashed { select { case <-ctx.Done():