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: allocate should not compare tmin and tmax with head #1890

Merged
merged 5 commits into from
Mar 11, 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
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
Loading