Skip to content

Commit

Permalink
fix: allocate should not compare tmin and tmax with head (#1890)
Browse files Browse the repository at this point in the history
* remove tmin, max check

* increase timeout for itest

* replace for with eventually

* fix epiration

* fix segFault for expired allocs
  • Loading branch information
LexLuthr authored Mar 11, 2024
1 parent 6d1202c commit 9018571
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
6 changes: 1 addition & 5 deletions cmd/boost/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ func CreateAllocationMsg(ctx context.Context, api api.Gateway, pInfos, miners []
return nil, err
}

if tmax < head.Height() || tmin < head.Height() {
return nil, fmt.Errorf("current chain head %d is greater than TermMin %d or TermMax %d", head.Height(), tmin, tmax)
}

// Create allocation requests
var allocationRequests []verifreg.AllocationRequest
for mid, minfo := range maddrs {
Expand All @@ -111,7 +107,7 @@ func CreateAllocationMsg(ctx context.Context, api api.Gateway, pInfos, miners []
Size: p.Size,
TermMin: tmin,
TermMax: tmax,
Expiration: exp,
Expiration: head.Height() + exp,
})
}
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/boostd/import_direct_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ var importDirectDataCmd = &cli.Command{
if err != nil {
return fmt.Errorf("getting claim details from chain: %w", err)
}
if alloc == nil {
return fmt.Errorf("no allocation found with ID %d", allocationId)
}

if alloc.Expiration < startEpoch {
return fmt.Errorf("allocation will expire on %d before start epoch %d", alloc.Expiration, startEpoch)
Expand Down
21 changes: 4 additions & 17 deletions itests/ddo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,26 +144,13 @@ func TestDirectDeal(t *testing.T) {
// Wait for sector to start sealing
time.Sleep(2 * time.Second)

for {
secNums, err := f.LotusMiner.SectorsList(ctx)
require.NoError(t, err)
if len(secNums) > 2 {
break
}
time.Sleep(100 * time.Millisecond)
}

// Wait till sector 2 is Proving
states := []lapi.SectorState{lapi.SectorState(sealing.Proving)}

// Exit if sector 2 is now proving
for {
require.Eventuallyf(t, func() bool {
stateList, err := f.LotusMiner.SectorsListInStates(ctx, states)
require.NoError(t, err)
if len(stateList) > 2 {
break
}
time.Sleep(2 * time.Second)
}
return len(stateList) == 3
}, 5*time.Minute, 2*time.Second, "sector 2 is still not proving after 5 minutes")

// Confirm we have 0 allocations left
allocations, err = f.FullNode.StateGetAllocations(ctx, f.ClientAddr, types.EmptyTSK)
Expand Down
2 changes: 1 addition & 1 deletion itests/lid_cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func TestLIDCleanup(t *testing.T) {
stateList, err := f.LotusMiner.SectorsListInStates(ctx, states)
require.NoError(t, err)
return len(stateList) == 5
}, time.Minute, 2*time.Second, "sectors are still not proving after a minute")
}, 5*time.Minute, 2*time.Second, "sectors are still not proving after 5 minutes")

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

0 comments on commit 9018571

Please # to comment.