Skip to content

Commit f97c52f

Browse files
authored
fix: check provider for ddo deals (#1973)
* check provider for ddo deals * github action don't fail early
1 parent ffc5c56 commit f97c52f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
runs-on: [self-hosted, docker]
6767
needs: [setup-params]
6868
strategy:
69+
fail-fast: false # Continue running even if one test fails
6970
matrix:
7071
test-suite:
7172
- name: test-itest-dummydeal_offline

storagemarket/direct_deals_provider.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,22 @@ func (ddp *DirectDealsProvider) Accept(ctx context.Context, entry *types.DirectD
149149

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

152+
mid, err := address.IDFromAddress(ddp.Address)
153+
if err != nil {
154+
log.Warnw("failed to get miner ID from address", "err", err)
155+
return &api.ProviderDealRejectionInfo{
156+
Accepted: false,
157+
Reason: "server error: miner address to ID conversion",
158+
}, nil
159+
}
160+
161+
if allocation.Provider != abi.ActorID(mid) {
162+
return &api.ProviderDealRejectionInfo{
163+
Accepted: false,
164+
Reason: fmt.Sprintf("allocation provider %s does not match miner address %s", allocation.Provider, ddp.Address),
165+
}, nil
166+
}
167+
152168
// If the TermMin is longer than initial sector duration, the deal will be dropped from the sector
153169
if allocation.TermMin > miner13types.MaxSectorExpirationExtension-policy.SealRandomnessLookback {
154170
return &api.ProviderDealRejectionInfo{

0 commit comments

Comments
 (0)