From 4c661118f347c0c061094f94c763d1f23f7db1b0 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Mon, 11 Mar 2024 20:29:42 +0400 Subject: [PATCH 1/5] remove tmin, max check --- cmd/boost/util/util.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cmd/boost/util/util.go b/cmd/boost/util/util.go index efc02f6d6..4d9e756af 100644 --- a/cmd/boost/util/util.go +++ b/cmd/boost/util/util.go @@ -89,15 +89,6 @@ func CreateAllocationMsg(ctx context.Context, api api.Gateway, pInfos, miners [] return nil, fmt.Errorf("maximum duration %d cannot be smaller than minimum duration %d", tmax, tmin) } - head, err := api.ChainHead(ctx) - if err != nil { - 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 { From 5569e4eb1fc3f00a6537e7419f88204f95ecf504 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Mon, 11 Mar 2024 20:41:01 +0400 Subject: [PATCH 2/5] increase timeout for itest --- itests/lid_cleanup_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itests/lid_cleanup_test.go b/itests/lid_cleanup_test.go index a9af2dafd..c20ee62d0 100644 --- a/itests/lid_cleanup_test.go +++ b/itests/lid_cleanup_test.go @@ -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) From f425c5761e870dd01626a708efe9d7e42c16216c Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Mon, 11 Mar 2024 21:04:49 +0400 Subject: [PATCH 3/5] replace for with eventually --- itests/ddo_test.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/itests/ddo_test.go b/itests/ddo_test.go index f51170c1a..06857b12f 100644 --- a/itests/ddo_test.go +++ b/itests/ddo_test.go @@ -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) From 903d89bab6cf4ee7a210635d93508f4f5df82106 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Mon, 11 Mar 2024 21:17:21 +0400 Subject: [PATCH 4/5] fix epiration --- cmd/boost/util/util.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/boost/util/util.go b/cmd/boost/util/util.go index 4d9e756af..609a2d95f 100644 --- a/cmd/boost/util/util.go +++ b/cmd/boost/util/util.go @@ -89,6 +89,11 @@ func CreateAllocationMsg(ctx context.Context, api api.Gateway, pInfos, miners [] return nil, fmt.Errorf("maximum duration %d cannot be smaller than minimum duration %d", tmax, tmin) } + head, err := api.ChainHead(ctx) + if err != nil { + return nil, err + } + // Create allocation requests var allocationRequests []verifreg.AllocationRequest for mid, minfo := range maddrs { @@ -102,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, }) } } From ade2f47a68ccf8f31094e8abef0f92f3231e25d0 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Mon, 11 Mar 2024 21:47:49 +0400 Subject: [PATCH 5/5] fix segFault for expired allocs --- cmd/boostd/import_direct_data.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/boostd/import_direct_data.go b/cmd/boostd/import_direct_data.go index 03330c5cb..8c33ae6e0 100644 --- a/cmd/boostd/import_direct_data.go +++ b/cmd/boostd/import_direct_data.go @@ -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)