Skip to content

Commit

Permalink
fix: check provider for ddo deals (#1973)
Browse files Browse the repository at this point in the history
* check provider for ddo deals

* github action don't fail early
  • Loading branch information
LexLuthr authored Oct 15, 2024
1 parent ffc5c56 commit f97c52f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
runs-on: [self-hosted, docker]
needs: [setup-params]
strategy:
fail-fast: false # Continue running even if one test fails
matrix:
test-suite:
- name: test-itest-dummydeal_offline
Expand Down
16 changes: 16 additions & 0 deletions storagemarket/direct_deals_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,22 @@ func (ddp *DirectDealsProvider) Accept(ctx context.Context, entry *types.DirectD

log.Infow("found allocation for client", "allocation", spew.Sdump(allocation))

mid, err := address.IDFromAddress(ddp.Address)
if err != nil {
log.Warnw("failed to get miner ID from address", "err", err)
return &api.ProviderDealRejectionInfo{
Accepted: false,
Reason: "server error: miner address to ID conversion",
}, nil
}

if allocation.Provider != abi.ActorID(mid) {
return &api.ProviderDealRejectionInfo{
Accepted: false,
Reason: fmt.Sprintf("allocation provider %s does not match miner address %s", allocation.Provider, ddp.Address),
}, nil
}

// If the TermMin is longer than initial sector duration, the deal will be dropped from the sector
if allocation.TermMin > miner13types.MaxSectorExpirationExtension-policy.SealRandomnessLookback {
return &api.ProviderDealRejectionInfo{
Expand Down

0 comments on commit f97c52f

Please sign in to comment.