Skip to content

Commit

Permalink
Market actor accepts deals published from miner control addresses (fi…
Browse files Browse the repository at this point in the history
  • Loading branch information
anorth authored and bibibong committed Feb 19, 2021
1 parent 935462d commit 5581ee4
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 249 deletions.
14 changes: 11 additions & 3 deletions actors/builtin/market/market_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,17 @@ func (a Actor) PublishStorageDeals(rt Runtime, params *PublishStorageDealsParams
rt.Abortf(exitcode.ErrIllegalArgument, "deal provider is not a StorageMinerActor")
}

_, worker, _ := builtin.RequestMinerControlAddrs(rt, provider)
if worker != rt.Caller() {
rt.Abortf(exitcode.ErrForbidden, "caller is not provider %v", provider)
caller := rt.Caller()
_, worker, controllers := builtin.RequestMinerControlAddrs(rt, provider)
callerOk := caller == worker
for _, controller := range controllers {
if callerOk {
break
}
callerOk = caller == controller
}
if !callerOk {
rt.Abortf(exitcode.ErrForbidden, "caller %v is not worker or control address of provider %v", caller, provider)
}

pids := make([]builtin.CheckedCID, 0, len(params.Deals))
Expand Down
Loading

0 comments on commit 5581ee4

Please sign in to comment.