Skip to content

Commit 9018571

Browse files
authored
fix: allocate should not compare tmin and tmax with head (#1890)
* remove tmin, max check * increase timeout for itest * replace for with eventually * fix epiration * fix segFault for expired allocs
1 parent 6d1202c commit 9018571

File tree

4 files changed

+9
-23
lines changed

4 files changed

+9
-23
lines changed

cmd/boost/util/util.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ func CreateAllocationMsg(ctx context.Context, api api.Gateway, pInfos, miners []
9494
return nil, err
9595
}
9696

97-
if tmax < head.Height() || tmin < head.Height() {
98-
return nil, fmt.Errorf("current chain head %d is greater than TermMin %d or TermMax %d", head.Height(), tmin, tmax)
99-
}
100-
10197
// Create allocation requests
10298
var allocationRequests []verifreg.AllocationRequest
10399
for mid, minfo := range maddrs {
@@ -111,7 +107,7 @@ func CreateAllocationMsg(ctx context.Context, api api.Gateway, pInfos, miners []
111107
Size: p.Size,
112108
TermMin: tmin,
113109
TermMax: tmax,
114-
Expiration: exp,
110+
Expiration: head.Height() + exp,
115111
})
116112
}
117113
}

cmd/boostd/import_direct_data.go

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ var importDirectDataCmd = &cli.Command{
116116
if err != nil {
117117
return fmt.Errorf("getting claim details from chain: %w", err)
118118
}
119+
if alloc == nil {
120+
return fmt.Errorf("no allocation found with ID %d", allocationId)
121+
}
119122

120123
if alloc.Expiration < startEpoch {
121124
return fmt.Errorf("allocation will expire on %d before start epoch %d", alloc.Expiration, startEpoch)

itests/ddo_test.go

+4-17
Original file line numberDiff line numberDiff line change
@@ -144,26 +144,13 @@ func TestDirectDeal(t *testing.T) {
144144
// Wait for sector to start sealing
145145
time.Sleep(2 * time.Second)
146146

147-
for {
148-
secNums, err := f.LotusMiner.SectorsList(ctx)
149-
require.NoError(t, err)
150-
if len(secNums) > 2 {
151-
break
152-
}
153-
time.Sleep(100 * time.Millisecond)
154-
}
155-
147+
// Wait till sector 2 is Proving
156148
states := []lapi.SectorState{lapi.SectorState(sealing.Proving)}
157-
158-
// Exit if sector 2 is now proving
159-
for {
149+
require.Eventuallyf(t, func() bool {
160150
stateList, err := f.LotusMiner.SectorsListInStates(ctx, states)
161151
require.NoError(t, err)
162-
if len(stateList) > 2 {
163-
break
164-
}
165-
time.Sleep(2 * time.Second)
166-
}
152+
return len(stateList) == 3
153+
}, 5*time.Minute, 2*time.Second, "sector 2 is still not proving after 5 minutes")
167154

168155
// Confirm we have 0 allocations left
169156
allocations, err = f.FullNode.StateGetAllocations(ctx, f.ClientAddr, types.EmptyTSK)

itests/lid_cleanup_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func TestLIDCleanup(t *testing.T) {
208208
stateList, err := f.LotusMiner.SectorsListInStates(ctx, states)
209209
require.NoError(t, err)
210210
return len(stateList) == 5
211-
}, time.Minute, 2*time.Second, "sectors are still not proving after a minute")
211+
}, 5*time.Minute, 2*time.Second, "sectors are still not proving after 5 minutes")
212212

213213
// Verify that LID has entries for all deals
214214
prop1, err := cborutil.AsIpld(&res1.DealParams.ClientDealProposal)

0 commit comments

Comments
 (0)