Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Remove cid caching from deal proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenGround0 committed Sep 27, 2021
1 parent 2afc142 commit e21a485
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 84 deletions.
67 changes: 3 additions & 64 deletions actors/builtin/market/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 5 additions & 18 deletions actors/builtin/market/deal.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package market

import (
"github.com/filecoin-project/go-state-types/crypto"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/ipfs/go-cid"
)

//var PieceCIDPrefix = cid.Prefix{
Expand Down Expand Up @@ -47,19 +45,8 @@ var PieceCIDPrefix = market0.PieceCIDPrefix
type DealProposal = market0.DealProposal

// ClientDealProposal is a DealProposal signed by a client
type ClientDealProposal struct {
Proposal DealProposal
ClientSignature crypto.Signature

// internal cache
cid cid.Cid
}

func (c *ClientDealProposal) ProposalCid() (cid.Cid, error) {
var err error
if c.cid.Equals(cid.Undef) {
c.cid, err = c.Proposal.Cid()
return c.cid, err
}
return c.cid, nil
}
// type ClientDealProposal struct {
// Proposal DealProposal
// ClientSignature crypto.Signature
// }
type ClientDealProposal = market0.ClientDealProposal
2 changes: 1 addition & 1 deletion actors/builtin/market/market_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (a Actor) PublishStorageDeals(rt Runtime, params *PublishStorageDealsParams
resolvedAddrs[deal.Proposal.Client] = client
deal.Proposal.Client = client

pcid, err := deal.ProposalCid()
pcid, err := deal.Proposal.Cid()
builtin.RequireNoErr(rt, err, exitcode.ErrIllegalArgument, "failed to take cid of proposal %d", di)

// check proposalCids for duplication within message batch
Expand Down
2 changes: 1 addition & 1 deletion gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func main() {
//market.OnMinerSectorsTerminateParams{}, // Aliased from v0
// other types
//market.DealProposal{}, // Aliased from v0
market.ClientDealProposal{},
//market.ClientDealProposal{},
market.SectorDeals{},
market.SectorWeights{},
market.DealState{},
Expand Down

0 comments on commit e21a485

Please sign in to comment.