Fix tests
This commit is contained in:
parent
ee9060aa14
commit
95f344540e
@ -67,9 +67,9 @@ var infoCmd = &cli.Command{
|
|||||||
fmt.Printf("\tProving: %s\n", types.BigMul(types.NewInt(secCounts.Pset), types.NewInt(sizeByte)).SizeStr())
|
fmt.Printf("\tProving: %s\n", types.BigMul(types.NewInt(secCounts.Pset), types.NewInt(sizeByte)).SizeStr())
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("\tProving: %s (%s Faulty, %.2f%%)\n",
|
fmt.Printf("\tProving: %s (%s Faulty, %.2f%%)\n",
|
||||||
types.BigMul(types.NewInt(secCounts.Pset - uint64(len(faults))), types.NewInt(sizeByte)).SizeStr(),
|
types.BigMul(types.NewInt(secCounts.Pset-uint64(len(faults))), types.NewInt(sizeByte)).SizeStr(),
|
||||||
types.BigMul(types.NewInt(uint64(len(faults))), types.NewInt(sizeByte)).SizeStr(),
|
types.BigMul(types.NewInt(uint64(len(faults))), types.NewInt(sizeByte)).SizeStr(),
|
||||||
float64(10000 * uint64(len(faults)) / secCounts.Pset) / 100.)
|
float64(10000*uint64(len(faults))/secCounts.Pset)/100.)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: indicate whether the post worker is in use
|
// TODO: indicate whether the post worker is in use
|
||||||
|
@ -232,7 +232,7 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
|
|||||||
SectorSize: 1024,
|
SectorSize: 1024,
|
||||||
WorkerThreads: 2,
|
WorkerThreads: 2,
|
||||||
Miner: genMiner,
|
Miner: genMiner,
|
||||||
Dir: psd,
|
Paths: sectorbuilder.SimplePath(psd),
|
||||||
}, namespace.Wrap(mds, datastore.NewKey("/sectorbuilder")))
|
}, namespace.Wrap(mds, datastore.NewKey("/sectorbuilder")))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -311,11 +311,11 @@ func (sb *SBMock) StageFakeData() (uint64, []sectorbuilder.PublicPieceInfo, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sb *SBMock) FinalizeSector(context.Context, uint64) error {
|
func (sb *SBMock) FinalizeSector(context.Context, uint64) error {
|
||||||
panic("implement me")
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *SBMock) DropStaged(context.Context, uint64) error {
|
func (sb *SBMock) DropStaged(context.Context, uint64) error {
|
||||||
panic("implement me")
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *SBMock) SectorPath(typ fs.DataType, sectorID uint64) (fs.SectorPath, error) {
|
func (sb *SBMock) SectorPath(typ fs.DataType, sectorID uint64) (fs.SectorPath, error) {
|
||||||
|
@ -50,6 +50,9 @@ func TestHappyPath(t *testing.T) {
|
|||||||
require.Equal(m.t, m.state.State, api.CommitWait)
|
require.Equal(m.t, m.state.State, api.CommitWait)
|
||||||
|
|
||||||
m.planSingle(SectorProving{})
|
m.planSingle(SectorProving{})
|
||||||
|
require.Equal(m.t, m.state.State, api.FinalizeSector)
|
||||||
|
|
||||||
|
m.planSingle(SectorFinalized{})
|
||||||
require.Equal(m.t, m.state.State, api.Proving)
|
require.Equal(m.t, m.state.State, api.Proving)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +84,9 @@ func TestSeedRevert(t *testing.T) {
|
|||||||
require.Equal(m.t, m.state.State, api.CommitWait)
|
require.Equal(m.t, m.state.State, api.CommitWait)
|
||||||
|
|
||||||
m.planSingle(SectorProving{})
|
m.planSingle(SectorProving{})
|
||||||
|
require.Equal(m.t, m.state.State, api.FinalizeSector)
|
||||||
|
|
||||||
|
m.planSingle(SectorFinalized{})
|
||||||
require.Equal(m.t, m.state.State, api.Proving)
|
require.Equal(m.t, m.state.State, api.Proving)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,11 +49,11 @@ func fillersFromRem(toFill uint64) ([]uint64, error) {
|
|||||||
|
|
||||||
func (m *Sealing) fastPledgeCommitment(size uint64, parts uint64) (commP [sectorbuilder.CommLen]byte, err error) {
|
func (m *Sealing) fastPledgeCommitment(size uint64, parts uint64) (commP [sectorbuilder.CommLen]byte, err error) {
|
||||||
parts = 1 << bits.Len64(parts) // round down to nearest power of 2
|
parts = 1 << bits.Len64(parts) // round down to nearest power of 2
|
||||||
if size / parts < 127 {
|
if size/parts < 127 {
|
||||||
parts = size / 127
|
parts = size / 127
|
||||||
}
|
}
|
||||||
|
|
||||||
piece := sectorbuilder.UserBytesForSectorSize((size + size / 127) / parts)
|
piece := sectorbuilder.UserBytesForSectorSize((size + size/127) / parts)
|
||||||
out := make([]sectorbuilder.PublicPieceInfo, parts)
|
out := make([]sectorbuilder.PublicPieceInfo, parts)
|
||||||
var lk sync.Mutex
|
var lk sync.Mutex
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user