Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Jul 22, 2020
1 parent 98c8558 commit 7fb62fe
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 18 deletions.
45 changes: 29 additions & 16 deletions ldevnet/ldevnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,30 +123,40 @@ func New(numMiners int, blockDur time.Duration, bigSector bool, ipfsAddr string)
for mine {
time.Sleep(blockDur)
if ctx.Err() != nil {
panic("context cancelled")
mine = false
continue
}
if err := sn[i].MineOne(context.Background(), func(bool, error) {}); err != nil {
panic(err)
}

i = (i + 1) % len(miners)
snums, err := sn[i].SectorsList(ctx)
if err != nil {
panic(err)
}
}
}()

for _, snum := range snums {
si, err := sn[i].SectorsStatus(ctx, snum)
go func() {
for {
for i := 0; i < numMiners; i++ {
snums, err := sn[i].SectorsList(ctx)
if err != nil {
panic(err)
}

if si.State == api.SectorState(sealing.WaitDeals) {
if err := sn[i].SectorStartSealing(ctx, snum); err != nil {
for _, snum := range snums {
si, err := sn[i].SectorsStatus(ctx, snum)
if err != nil {
panic(err)
}

if si.State == api.SectorState(sealing.WaitDeals) {
if err := sn[i].SectorStartSealing(ctx, snum); err != nil {
panic(err)

}
}
}
}
time.Sleep(time.Second)
}
}()

Expand Down Expand Up @@ -356,9 +366,6 @@ func mockSbBuilder(nFull int, storage []test.StorageMiner, bigSector bool, ipfsA
node.Override(new(ffiwrapper.Verifier), mock.MockVerifier),
node.Unset(new(*sectorstorage.Manager)),
))
//if err := storers[i].StorageMiner.MarketSetPrice(ctx, types.NewInt(1000)); err != nil {
// return nil, nil, err
//}
}

if err := mn.LinkAll(); err != nil {
Expand Down Expand Up @@ -398,11 +405,17 @@ func testStorageNode(ctx context.Context, waddr address.Address, act address.Add
if err != nil {
panic(err)
}
nic := storedcounter.New(ds, datastore.NewKey("/storage/nextid"))
nic := storedcounter.New(ds, datastore.NewKey(modules.StorageCounterDSPrefix))
for i := 0; i < nGenesisPreseals; i++ {
nic.Next()
_, err := nic.Next()
if err != nil {
panic(err)
}
}
_, err = nic.Next()
if err != nil {
panic(err)
}
nic.Next()

err = lr.Close()
if err != nil {
Expand All @@ -423,7 +436,7 @@ func testStorageNode(ctx context.Context, waddr address.Address, act address.Add
Params: enc,
Value: types.NewInt(0),
GasPrice: types.NewInt(0),
GasLimit: 1000000,
GasLimit: 0,
}

_, err = tnd.MpoolPushMessage(ctx, msg)
Expand Down
9 changes: 7 additions & 2 deletions ldevnet/ldevnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ import (

func TestMain(m *testing.M) {
//logging.SetAllLoggers(logging.LevelDebug)
logging.SetLogLevel("miner", "ERROR")
logging.SetLogLevel("chainstore", "ERROR")
logging.SetLogLevel("chain", "ERROR")
logging.SetLogLevel("sub", "ERROR")
logging.SetLogLevel("storageminer", "ERROR")
_ = logging.ErrNoSuchLogger
os.Exit(m.Run())
}
Expand All @@ -38,7 +43,7 @@ func TestStore(t *testing.T) {

func dealSpecificMiner(t *testing.T, numMiners int, concreteMiner int) func(*testing.T) {
return func(t *testing.T) {
_, err := New(numMiners, time.Millisecond*500, true, "")
_, err := New(numMiners, time.Millisecond*100, true, "")
require.Nil(t, err)

var client apistruct.FullNodeStruct
Expand Down Expand Up @@ -71,7 +76,7 @@ func dealSpecificMiner(t *testing.T, numMiners int, concreteMiner int) func(*tes

r := rand.New(rand.NewSource(22))
for i := 0; i < 2; i++ {
data := make([]byte, 1024*1024*50)
data := make([]byte, 50*1024*1024)
r.Read(data)
err = ioutil.WriteFile(tmpf.Name(), data, 0644)
require.Nil(t, err)
Expand Down

0 comments on commit 7fb62fe

Please sign in to comment.