itests: More fixes after fixing sector metadata import
This commit is contained in:
parent
6d2990314f
commit
8294e03d4e
@ -60,7 +60,7 @@ func runTestCCUpgrade(t *testing.T) *kit.TestFullNode {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1)
|
||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner)
|
||||
fmt.Printf("CCUpgrade: %d\n", CCUpgrade)
|
||||
|
||||
miner.PledgeSectors(ctx, 1, 0, nil)
|
||||
|
@ -235,11 +235,14 @@ func (n *Ensemble) Miner(minerNode *TestMiner, full *TestFullNode, opts ...NodeO
|
||||
}
|
||||
|
||||
ownerKey := options.ownerKey
|
||||
var presealSectors int
|
||||
|
||||
if !n.bootstrapped {
|
||||
presealSectors = options.sectors
|
||||
|
||||
var (
|
||||
sectors = options.sectors
|
||||
k *types.KeyInfo
|
||||
genm *genesis.Miner
|
||||
k *types.KeyInfo
|
||||
genm *genesis.Miner
|
||||
)
|
||||
|
||||
// Will use 2KiB sectors by default (default value of sectorSize).
|
||||
@ -248,9 +251,9 @@ func (n *Ensemble) Miner(minerNode *TestMiner, full *TestFullNode, opts ...NodeO
|
||||
|
||||
// Create the preseal commitment.
|
||||
if n.options.mockProofs {
|
||||
genm, k, err = mock.PreSeal(proofType, actorAddr, sectors)
|
||||
genm, k, err = mock.PreSeal(proofType, actorAddr, presealSectors)
|
||||
} else {
|
||||
genm, k, err = seed.PreSeal(actorAddr, proofType, 0, sectors, tdir, []byte("make genesis mem random"), nil, true)
|
||||
genm, k, err = seed.PreSeal(actorAddr, proofType, 0, presealSectors, tdir, []byte("make genesis mem random"), nil, true)
|
||||
}
|
||||
require.NoError(n.t, err)
|
||||
|
||||
@ -281,6 +284,7 @@ func (n *Ensemble) Miner(minerNode *TestMiner, full *TestFullNode, opts ...NodeO
|
||||
OwnerKey: ownerKey,
|
||||
FullNode: full,
|
||||
PresealDir: tdir,
|
||||
PresealSectors: presealSectors,
|
||||
options: options,
|
||||
RemoteListener: rl,
|
||||
}
|
||||
@ -537,7 +541,10 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
err = ds.Put(ctx, datastore.NewKey("miner-address"), m.ActorAddr.Bytes())
|
||||
require.NoError(n.t, err)
|
||||
|
||||
require.NoError(n.t, importPreSealMeta(ctx, n.genesis.miners[i], ds))
|
||||
if i < len(n.genesis.miners) && !n.bootstrapped {
|
||||
// if this is a genesis miner, import preseal metadata
|
||||
require.NoError(n.t, importPreSealMeta(ctx, n.genesis.miners[i], ds))
|
||||
}
|
||||
|
||||
// using real proofs, therefore need real sectors.
|
||||
if !n.bootstrapped && !n.options.mockProofs {
|
||||
|
@ -77,8 +77,9 @@ type TestMiner struct {
|
||||
MineOne func(context.Context, miner.MineReq) error
|
||||
Stop func(context.Context) error
|
||||
|
||||
FullNode *TestFullNode
|
||||
PresealDir string
|
||||
FullNode *TestFullNode
|
||||
PresealDir string
|
||||
PresealSectors int
|
||||
|
||||
Libp2p struct {
|
||||
PeerID peer.ID
|
||||
@ -131,7 +132,7 @@ func (tm *TestMiner) StartPledge(ctx context.Context, n, existing int, blockNoti
|
||||
for {
|
||||
s, err := tm.SectorsListNonGenesis(ctx)
|
||||
require.NoError(tm.t, err)
|
||||
fmt.Printf("Sectors: %d\n", len(s))
|
||||
fmt.Printf("Sectors: %d (n %d, ex %d)\n", len(s), n, existing)
|
||||
if len(s) >= n+existing {
|
||||
break
|
||||
}
|
||||
@ -216,5 +217,5 @@ func (tm *TestMiner) SectorsListNonGenesis(ctx context.Context) ([]abi.SectorNum
|
||||
return l[i] < l[j]
|
||||
})
|
||||
|
||||
return l[tm.options.sectors:], nil
|
||||
return l[tm.PresealSectors:], nil
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ func TestMakeAvailable(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1)
|
||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner)
|
||||
|
||||
miner.PledgeSectors(ctx, 1, 0, nil)
|
||||
sl, err := miner.SectorsListNonGenesis(ctx)
|
||||
|
@ -34,8 +34,8 @@ func TestPreferNoUpgrade(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1)
|
||||
Sealed := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 2)
|
||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner)
|
||||
Sealed := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1)
|
||||
|
||||
{
|
||||
miner.PledgeSectors(ctx, 1, 0, nil)
|
||||
|
@ -31,7 +31,7 @@ func TestAbortUpgradeAvailable(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1)
|
||||
CCUpgrade := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner)
|
||||
fmt.Printf("CCUpgrade: %d\n", CCUpgrade)
|
||||
|
||||
miner.PledgeSectors(ctx, 1, 0, nil)
|
||||
|
Loading…
Reference in New Issue
Block a user