Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check provider for ddo deals #1973

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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