Skip to content

Commit

Permalink
Use MockSbBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
jennijuju committed May 31, 2021
1 parent ac2887c commit 4a88470
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
6 changes: 1 addition & 5 deletions api/test/verifreg.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package test

import (
"context"
"fmt"
"os"
lapi "github.com/filecoin-project/lotus/api"
"strings"

"github.com/filecoin-project/lotus/chain/actors"
Expand All @@ -15,10 +14,7 @@ import (
"time"

"github.com/filecoin-project/go-state-types/big"
lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
logging "github.com/ipfs/go-log/v2"
)


Expand Down
2 changes: 1 addition & 1 deletion node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,5 @@ func TestDeadlineToggling(t *testing.T) {
func TestVerifiedClientTopUp(t *testing.T) {
logging.SetLogLevel("storageminer", "FATAL")
logging.SetLogLevel("chain", "ERROR")
test.AddVerifiedClient(t, builder.Builder)
test.AddVerifiedClient(t, builder.MockSbBuilder)
}
20 changes: 19 additions & 1 deletion node/test/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,26 @@ func mockSbBuilderOpts(t *testing.T, fullOpts []test.FullNodeOpts, storage []tes
maddrs = append(maddrs, maddr)
genms = append(genms, *genm)
}

rkhKey, err := wallet.GenerateKey(types.KTSecp256k1)
if err != nil {
return nil, nil
}

vrk := genesis.Actor{
Type: genesis.TAccount,
Balance: big.Mul(big.NewInt(400000000), types.NewInt(build.FilecoinPrecision)),
Meta: (&genesis.AccountMeta{Owner: rkhKey.Address}).ActorMeta(),
}
keys = append(keys, rkhKey)


templ := &genesis.Template{
Accounts: genaccs,
Miners: genms,
NetworkName: "test",
Timestamp: uint64(time.Now().Unix()) - (build.BlockDelaySecs * 20000),
VerifregRootKey: gen.DefaultVerifregRootkeyActor,
VerifregRootKey: vrk,
RemainderAccount: gen.DefaultRemainderAccountActor,
}

Expand Down Expand Up @@ -511,6 +525,10 @@ func mockSbBuilderOpts(t *testing.T, fullOpts []test.FullNodeOpts, storage []tes
))
}

if _, err := fulls[0].FullNode.WalletImport(ctx, &rkhKey.KeyInfo); err != nil {
t.Fatal(err)
}

for i, def := range storage {
// TODO: support non-bootstrap miners

Expand Down

0 comments on commit 4a88470

Please sign in to comment.