-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6653 from filecoin-project/fix/finalize-in-storage
storage: Fix FinalizeSector with sectors in stoage paths
- Loading branch information
Showing
8 changed files
with
164 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package itests | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" | ||
"github.com/filecoin-project/lotus/itests/kit" | ||
"github.com/filecoin-project/lotus/node" | ||
"github.com/filecoin-project/lotus/node/config" | ||
"github.com/filecoin-project/lotus/node/modules" | ||
"github.com/filecoin-project/lotus/node/modules/dtypes" | ||
"github.com/filecoin-project/lotus/node/repo" | ||
) | ||
|
||
func TestDealsWithFinalizeEarly(t *testing.T) { | ||
if testing.Short() { | ||
t.Skip("skipping test in short mode") | ||
} | ||
|
||
kit.QuietMiningLogs() | ||
|
||
var blockTime = 50 * time.Millisecond | ||
|
||
client, miner, ens := kit.EnsembleMinimal(t, kit.ThroughRPC(), kit.ConstructorOpts( | ||
node.ApplyIf(node.IsType(repo.StorageMiner), node.Override(new(dtypes.GetSealingConfigFunc), func() (dtypes.GetSealingConfigFunc, error) { | ||
return func() (sealiface.Config, error) { | ||
cf := config.DefaultStorageMiner() | ||
cf.Sealing.FinalizeEarly = true | ||
return modules.ToSealingConfig(cf), nil | ||
}, nil | ||
})))) // no mock proofs. | ||
ens.InterconnectAll().BeginMining(blockTime) | ||
dh := kit.NewDealHarness(t, client, miner) | ||
|
||
ctx := context.Background() | ||
|
||
miner.AddStorage(ctx, t, 1000000000, true, false) | ||
miner.AddStorage(ctx, t, 1000000000, false, true) | ||
|
||
sl, err := miner.StorageList(ctx) | ||
require.NoError(t, err) | ||
for si, d := range sl { | ||
i, err := miner.StorageInfo(ctx, si) | ||
require.NoError(t, err) | ||
|
||
fmt.Printf("stor d:%d %+v\n", len(d), i) | ||
} | ||
|
||
t.Run("single", func(t *testing.T) { | ||
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{N: 1}) | ||
}) | ||
|
||
sl, err = miner.StorageList(ctx) | ||
require.NoError(t, err) | ||
for si, d := range sl { | ||
i, err := miner.StorageInfo(ctx, si) | ||
require.NoError(t, err) | ||
|
||
fmt.Printf("stor d:%d %+v\n", len(d), i) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters