fix some tests
This commit is contained in:
parent
226685dc1c
commit
97425ea1c9
@ -7,6 +7,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/store"
|
"github.com/filecoin-project/lotus/chain/store"
|
||||||
@ -68,8 +69,8 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
|
|||||||
Messages: msgcid,
|
Messages: msgcid,
|
||||||
ParentMessageReceipts: dummyCid,
|
ParentMessageReceipts: dummyCid,
|
||||||
|
|
||||||
BlockSig: &types.Signature{Type: types.KTBLS},
|
BlockSig: &types.Signature{Type: crypto.SigTypeBLS},
|
||||||
BLSAggregate: types.Signature{Type: types.KTBLS},
|
BLSAggregate: types.Signature{Type: crypto.SigTypeBLS},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Height: h,
|
Height: h,
|
||||||
@ -81,8 +82,8 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
|
|||||||
Messages: msgcid,
|
Messages: msgcid,
|
||||||
ParentMessageReceipts: dummyCid,
|
ParentMessageReceipts: dummyCid,
|
||||||
|
|
||||||
BlockSig: &types.Signature{Type: types.KTBLS},
|
BlockSig: &types.Signature{Type: crypto.SigTypeBLS},
|
||||||
BLSAggregate: types.Signature{Type: types.KTBLS},
|
BLSAggregate: types.Signature{Type: crypto.SigTypeBLS},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -536,7 +537,7 @@ func TestAtChainedConfidenceNull(t *testing.T) {
|
|||||||
require.Equal(t, false, reverted)
|
require.Equal(t, false, reverted)
|
||||||
}
|
}
|
||||||
|
|
||||||
func matchAddrMethod(to address.Address, m uint64) func(msg *types.Message) (bool, error) {
|
func matchAddrMethod(to address.Address, m abi.MethodNum) func(msg *types.Message) (bool, error) {
|
||||||
return func(msg *types.Message) (bool, error) {
|
return func(msg *types.Message) (bool, error) {
|
||||||
return to == msg.To && m == msg.Method, nil
|
return to == msg.To && m == msg.Method, nil
|
||||||
}
|
}
|
||||||
@ -617,7 +618,7 @@ func TestCalled(t *testing.T) {
|
|||||||
require.Equal(t, abi.ChainEpoch(10), appliedH)
|
require.Equal(t, abi.ChainEpoch(10), appliedH)
|
||||||
require.Equal(t, t0123, appliedMsg.To)
|
require.Equal(t, t0123, appliedMsg.To)
|
||||||
require.Equal(t, uint64(1), appliedMsg.Nonce)
|
require.Equal(t, uint64(1), appliedMsg.Nonce)
|
||||||
require.Equal(t, uint64(5), appliedMsg.Method)
|
require.Equal(t, abi.MethodNum(5), appliedMsg.Method)
|
||||||
|
|
||||||
// revert some blocks, keep the message
|
// revert some blocks, keep the message
|
||||||
|
|
||||||
@ -654,7 +655,7 @@ func TestCalled(t *testing.T) {
|
|||||||
require.Equal(t, abi.ChainEpoch(12), appliedH)
|
require.Equal(t, abi.ChainEpoch(12), appliedH)
|
||||||
require.Equal(t, t0123, appliedMsg.To)
|
require.Equal(t, t0123, appliedMsg.To)
|
||||||
require.Equal(t, uint64(2), appliedMsg.Nonce)
|
require.Equal(t, uint64(2), appliedMsg.Nonce)
|
||||||
require.Equal(t, uint64(5), appliedMsg.Method)
|
require.Equal(t, abi.MethodNum(5), appliedMsg.Method)
|
||||||
|
|
||||||
// revert and apply at different height
|
// revert and apply at different height
|
||||||
|
|
||||||
@ -675,7 +676,7 @@ func TestCalled(t *testing.T) {
|
|||||||
require.Equal(t, abi.ChainEpoch(14), appliedH)
|
require.Equal(t, abi.ChainEpoch(14), appliedH)
|
||||||
require.Equal(t, t0123, appliedMsg.To)
|
require.Equal(t, t0123, appliedMsg.To)
|
||||||
require.Equal(t, uint64(2), appliedMsg.Nonce)
|
require.Equal(t, uint64(2), appliedMsg.Nonce)
|
||||||
require.Equal(t, uint64(5), appliedMsg.Method)
|
require.Equal(t, abi.MethodNum(5), appliedMsg.Method)
|
||||||
|
|
||||||
// call method again
|
// call method again
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
@ -28,8 +29,8 @@ func TestTsCache(t *testing.T) {
|
|||||||
ParentStateRoot: dummyCid,
|
ParentStateRoot: dummyCid,
|
||||||
Messages: dummyCid,
|
Messages: dummyCid,
|
||||||
ParentMessageReceipts: dummyCid,
|
ParentMessageReceipts: dummyCid,
|
||||||
BlockSig: &types.Signature{Type: types.KTBLS},
|
BlockSig: &types.Signature{Type: crypto.SigTypeBLS},
|
||||||
BLSAggregate: types.Signature{Type: types.KTBLS},
|
BLSAggregate: types.Signature{Type: crypto.SigTypeBLS},
|
||||||
}})
|
}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -70,8 +71,8 @@ func TestTsCacheNulls(t *testing.T) {
|
|||||||
ParentStateRoot: dummyCid,
|
ParentStateRoot: dummyCid,
|
||||||
Messages: dummyCid,
|
Messages: dummyCid,
|
||||||
ParentMessageReceipts: dummyCid,
|
ParentMessageReceipts: dummyCid,
|
||||||
BlockSig: &types.Signature{Type: types.KTBLS},
|
BlockSig: &types.Signature{Type: crypto.SigTypeBLS},
|
||||||
BLSAggregate: types.Signature{Type: types.KTBLS},
|
BLSAggregate: types.Signature{Type: crypto.SigTypeBLS},
|
||||||
}})
|
}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/wallet"
|
"github.com/filecoin-project/lotus/chain/wallet"
|
||||||
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
||||||
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
)
|
)
|
||||||
@ -146,7 +147,7 @@ func TestMessagePool(t *testing.T) {
|
|||||||
|
|
||||||
a := mock.MkBlock(nil, 1, 1)
|
a := mock.MkBlock(nil, 1, 1)
|
||||||
|
|
||||||
sender, err := w.GenerateKey(types.KTBLS)
|
sender, err := w.GenerateKey(crypto.SigTypeBLS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -188,7 +189,7 @@ func TestRevertMessages(t *testing.T) {
|
|||||||
a := mock.MkBlock(nil, 1, 1)
|
a := mock.MkBlock(nil, 1, 1)
|
||||||
b := mock.MkBlock(mock.TipSet(a), 1, 1)
|
b := mock.MkBlock(mock.TipSet(a), 1, 1)
|
||||||
|
|
||||||
sender, err := w.GenerateKey(types.KTBLS)
|
sender, err := w.GenerateKey(crypto.SigTypeBLS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package validation
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -11,9 +12,9 @@ import (
|
|||||||
vtypes "github.com/filecoin-project/chain-validation/pkg/state/types"
|
vtypes "github.com/filecoin-project/chain-validation/pkg/state/types"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ func (mf *MessageFactory) MakeMessage(from, to vaddress.Address, method vchain.M
|
|||||||
valueDec,
|
valueDec,
|
||||||
types.BigInt{gasPrice.Int},
|
types.BigInt{gasPrice.Int},
|
||||||
types.NewInt(uint64(gasLimit)),
|
types.NewInt(uint64(gasLimit)),
|
||||||
methodId,
|
abi.MethodNum(methodId),
|
||||||
params,
|
params,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,18 +73,17 @@ func (mf *MessageFactory) FromActorCodeCid(code vactors.ActorCodeID) cid.Cid {
|
|||||||
// This will change to a mapping to method ids when method dispatch is updated to use integers.
|
// This will change to a mapping to method ids when method dispatch is updated to use integers.
|
||||||
var methods = []uint64{
|
var methods = []uint64{
|
||||||
vchain.NoMethod: 0,
|
vchain.NoMethod: 0,
|
||||||
vchain.InitExec: actors.IAMethods.Exec,
|
vchain.InitExec: uint64(builtin.MethodsInit.Exec),
|
||||||
|
|
||||||
vchain.StoragePowerConstructor: actors.SPAMethods.Constructor,
|
vchain.StoragePowerConstructor: uint64(builtin.MethodsPower.Constructor),
|
||||||
vchain.StoragePowerCreateStorageMiner: actors.SPAMethods.CreateStorageMiner,
|
vchain.StoragePowerCreateStorageMiner: uint64(builtin.MethodsPower.CreateMiner),
|
||||||
vchain.StoragePowerUpdatePower: actors.SPAMethods.UpdateStorage,
|
|
||||||
|
|
||||||
vchain.StorageMinerUpdatePeerID: actors.MAMethods.UpdatePeerID,
|
vchain.StorageMinerUpdatePeerID: 0, //actors.MAMethods.UpdatePeerID,
|
||||||
vchain.StorageMinerGetOwner: actors.MAMethods.GetOwner,
|
vchain.StorageMinerGetOwner: 0, //actors.MAMethods.GetOwner,
|
||||||
vchain.StorageMinerGetPower: actors.MAMethods.GetPower,
|
vchain.StorageMinerGetPower: 0, //actors.MAMethods.GetPower,
|
||||||
vchain.StorageMinerGetWorkerAddr: actors.MAMethods.GetWorkerAddr,
|
vchain.StorageMinerGetWorkerAddr: 0, //actors.MAMethods.GetWorkerAddr,
|
||||||
vchain.StorageMinerGetPeerID: actors.MAMethods.GetPeerID,
|
vchain.StorageMinerGetPeerID: 0, //actors.MAMethods.GetPeerID,
|
||||||
vchain.StorageMinerGetSectorSize: actors.MAMethods.GetSectorSize,
|
vchain.StorageMinerGetSectorSize: 0, //actors.MAMethods.GetSectorSize,
|
||||||
|
|
||||||
vchain.MultiSigConstructor: uint64(builtin.MethodsMultisig.Constructor),
|
vchain.MultiSigConstructor: uint64(builtin.MethodsMultisig.Constructor),
|
||||||
vchain.MultiSigPropose: uint64(builtin.MethodsMultisig.Propose),
|
vchain.MultiSigPropose: uint64(builtin.MethodsMultisig.Propose),
|
||||||
|
@ -133,7 +133,7 @@ func (s *StateWrapper) SetSingletonActor(addr vactors.SingletonActorID, balance
|
|||||||
|
|
||||||
switch lotusAddr {
|
switch lotusAddr {
|
||||||
case actors.InitAddress:
|
case actors.InitAddress:
|
||||||
initact, err := genesis.SetupInitActor(s.bs, nil)
|
initact, err := genesis.SetupInitActor(s.bs, "testing", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ func (s *StateWrapper) SetSingletonActor(addr vactors.SingletonActorID, balance
|
|||||||
|
|
||||||
return &actorWrapper{*initact}, s.storage, s.flush(tree)
|
return &actorWrapper{*initact}, s.storage, s.flush(tree)
|
||||||
case actors.StorageMarketAddress:
|
case actors.StorageMarketAddress:
|
||||||
nsroot, err := genesis.SetupStorageMarketActor(s.bs, s.stateRoot, nil)
|
nsroot, err := genesis.SetupStorageMarketActor(s.bs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,12 @@ func (api *api) Spawn() (nodeInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sbroot := filepath.Join(dir, "preseal")
|
sbroot := filepath.Join(dir, "preseal")
|
||||||
genm, err := seed.PreSeal(genMiner, build.SectorSizes[0], 0, 2, sbroot, []byte("8"))
|
genm, ki, err := seed.PreSeal(genMiner, build.SectorSizes[0], 0, 2, sbroot, []byte("8"), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nodeInfo{}, xerrors.Errorf("preseal failed: %w", err)
|
return nodeInfo{}, xerrors.Errorf("preseal failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := seed.WriteGenesisMiner(genMiner, sbroot, genm); err != nil {
|
if err := seed.WriteGenesisMiner(genMiner, sbroot, genm, ki); err != nil {
|
||||||
return nodeInfo{}, xerrors.Errorf("failed to write genminer info: %w", err)
|
return nodeInfo{}, xerrors.Errorf("failed to write genminer info: %w", err)
|
||||||
}
|
}
|
||||||
params = append(params, "--genesis-presealed-sectors="+filepath.Join(dir, "preseal", "pre-seal-t0101.json"))
|
params = append(params, "--genesis-presealed-sectors="+filepath.Join(dir, "preseal", "pre-seal-t0101.json"))
|
||||||
|
@ -14,9 +14,11 @@ import (
|
|||||||
sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
|
sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis"
|
genesis "github.com/filecoin-project/lotus/genesis"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
"github.com/ipfs/go-datastore/namespace"
|
"github.com/ipfs/go-datastore/namespace"
|
||||||
badger "github.com/ipfs/go-ds-badger2"
|
badger "github.com/ipfs/go-ds-badger2"
|
||||||
@ -32,7 +34,6 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
||||||
"github.com/filecoin-project/lotus/genesis"
|
|
||||||
"github.com/filecoin-project/lotus/lib/jsonrpc"
|
"github.com/filecoin-project/lotus/lib/jsonrpc"
|
||||||
"github.com/filecoin-project/lotus/miner"
|
"github.com/filecoin-project/lotus/miner"
|
||||||
"github.com/filecoin-project/lotus/node"
|
"github.com/filecoin-project/lotus/node"
|
||||||
@ -79,13 +80,13 @@ func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, a
|
|||||||
peerid, err := peer.IDFromPrivateKey(pk)
|
peerid, err := peer.IDFromPrivateKey(pk)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
enc, err := actors.SerializeParams(&actors.UpdatePeerIDParams{PeerID: peerid})
|
enc, err := actors.SerializeParams(&saminer.ChangePeerIDParams{NewID: peerid})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
msg := &types.Message{
|
msg := &types.Message{
|
||||||
To: act,
|
To: act,
|
||||||
From: waddr,
|
From: waddr,
|
||||||
Method: actors.MAMethods.UpdatePeerID,
|
Method: builtin.MethodsMiner.ChangePeerID,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
@ -148,6 +149,8 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
|
|||||||
minerPid, err := peer.IDFromPrivateKey(pk)
|
minerPid, err := peer.IDFromPrivateKey(pk)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
_ = minerPid // TODO: what do we do with this now?
|
||||||
|
|
||||||
var genbuf bytes.Buffer
|
var genbuf bytes.Buffer
|
||||||
|
|
||||||
if len(storage) > 1 {
|
if len(storage) > 1 {
|
||||||
@ -155,10 +158,9 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
|
|||||||
}
|
}
|
||||||
// PRESEAL SECTION, TRY TO REPLACE WITH BETTER IN THE FUTURE
|
// PRESEAL SECTION, TRY TO REPLACE WITH BETTER IN THE FUTURE
|
||||||
// TODO: would be great if there was a better way to fake the preseals
|
// TODO: would be great if there was a better way to fake the preseals
|
||||||
gmc := &genesis2.GenMinerCfg{
|
|
||||||
PeerIDs: []peer.ID{minerPid}, // TODO: if we have more miners, need more peer IDs
|
var genms []genesis.Miner
|
||||||
PreSeals: map[string]genesis.GenesisMiner{},
|
var maddrs []address.Address
|
||||||
}
|
|
||||||
|
|
||||||
var presealDirs []string
|
var presealDirs []string
|
||||||
for i := 0; i < len(storage); i++ {
|
for i := 0; i < len(storage); i++ {
|
||||||
@ -170,14 +172,18 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
genm, err := seed.PreSeal(maddr, 1024, 0, 1, tdir, []byte("make genesis mem random"))
|
genm, _, err := seed.PreSeal(maddr, 1024, 0, 1, tdir, []byte("make genesis mem random"), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
presealDirs = append(presealDirs, tdir)
|
presealDirs = append(presealDirs, tdir)
|
||||||
gmc.MinerAddrs = append(gmc.MinerAddrs, maddr)
|
maddrs = append(maddrs, maddr)
|
||||||
gmc.PreSeals[maddr.String()] = *genm
|
genms = append(genms, *genm)
|
||||||
|
}
|
||||||
|
|
||||||
|
templ := &genesis.Template{
|
||||||
|
Miners: genms,
|
||||||
}
|
}
|
||||||
|
|
||||||
// END PRESEAL SECTION
|
// END PRESEAL SECTION
|
||||||
@ -185,7 +191,7 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
|
|||||||
for i := 0; i < nFull; i++ {
|
for i := 0; i < nFull; i++ {
|
||||||
var genesis node.Option
|
var genesis node.Option
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
genesis = node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genbuf, gmc))
|
genesis = node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genbuf, *templ))
|
||||||
} else {
|
} else {
|
||||||
genesis = node.Override(new(modules.Genesis), modules.LoadGenesis(genbuf.Bytes()))
|
genesis = node.Override(new(modules.Genesis), modules.LoadGenesis(genbuf.Bytes()))
|
||||||
}
|
}
|
||||||
@ -218,8 +224,8 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
|
|||||||
|
|
||||||
f := fulls[full]
|
f := fulls[full]
|
||||||
|
|
||||||
genMiner := gmc.MinerAddrs[i]
|
genMiner := maddrs[i]
|
||||||
wa := gmc.PreSeals[genMiner.String()].Worker
|
wa := genms[i].Worker
|
||||||
|
|
||||||
storers[i] = testStorageNode(ctx, t, wa, genMiner, pk, f, mn, node.Options())
|
storers[i] = testStorageNode(ctx, t, wa, genMiner, pk, f, mn, node.Options())
|
||||||
|
|
||||||
@ -267,6 +273,8 @@ func mockSbBuilder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []t
|
|||||||
minerPid, err := peer.IDFromPrivateKey(pk)
|
minerPid, err := peer.IDFromPrivateKey(pk)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
_ = minerPid // TODO
|
||||||
|
|
||||||
var genbuf bytes.Buffer
|
var genbuf bytes.Buffer
|
||||||
|
|
||||||
if len(storage) > 1 {
|
if len(storage) > 1 {
|
||||||
@ -274,11 +282,9 @@ func mockSbBuilder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []t
|
|||||||
}
|
}
|
||||||
// PRESEAL SECTION, TRY TO REPLACE WITH BETTER IN THE FUTURE
|
// PRESEAL SECTION, TRY TO REPLACE WITH BETTER IN THE FUTURE
|
||||||
// TODO: would be great if there was a better way to fake the preseals
|
// TODO: would be great if there was a better way to fake the preseals
|
||||||
gmc := &genesis2.GenMinerCfg{
|
|
||||||
PeerIDs: []peer.ID{minerPid}, // TODO: if we have more miners, need more peer IDs
|
|
||||||
PreSeals: map[string]genesis.GenesisMiner{},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
var genms []genesis.Miner
|
||||||
|
var maddrs []address.Address
|
||||||
var presealDirs []string
|
var presealDirs []string
|
||||||
for i := 0; i < len(storage); i++ {
|
for i := 0; i < len(storage); i++ {
|
||||||
maddr, err := address.NewIDAddress(300 + uint64(i))
|
maddr, err := address.NewIDAddress(300 + uint64(i))
|
||||||
@ -295,8 +301,11 @@ func mockSbBuilder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []t
|
|||||||
}
|
}
|
||||||
|
|
||||||
presealDirs = append(presealDirs, tdir)
|
presealDirs = append(presealDirs, tdir)
|
||||||
gmc.MinerAddrs = append(gmc.MinerAddrs, maddr)
|
maddrs = append(maddrs, maddr)
|
||||||
gmc.PreSeals[maddr.String()] = *genm
|
genms = append(genms, *genm)
|
||||||
|
}
|
||||||
|
templ := &genesis.Template{
|
||||||
|
Miners: genms,
|
||||||
}
|
}
|
||||||
|
|
||||||
// END PRESEAL SECTION
|
// END PRESEAL SECTION
|
||||||
@ -304,7 +313,7 @@ func mockSbBuilder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []t
|
|||||||
for i := 0; i < nFull; i++ {
|
for i := 0; i < nFull; i++ {
|
||||||
var genesis node.Option
|
var genesis node.Option
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
genesis = node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genbuf, gmc))
|
genesis = node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genbuf, *templ))
|
||||||
} else {
|
} else {
|
||||||
genesis = node.Override(new(modules.Genesis), modules.LoadGenesis(genbuf.Bytes()))
|
genesis = node.Override(new(modules.Genesis), modules.LoadGenesis(genbuf.Bytes()))
|
||||||
}
|
}
|
||||||
@ -339,8 +348,8 @@ func mockSbBuilder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []t
|
|||||||
|
|
||||||
f := fulls[full]
|
f := fulls[full]
|
||||||
|
|
||||||
genMiner := gmc.MinerAddrs[i]
|
genMiner := maddrs[i]
|
||||||
wa := gmc.PreSeals[genMiner.String()].Worker
|
wa := genms[i].Worker
|
||||||
|
|
||||||
storers[i] = testStorageNode(ctx, t, wa, genMiner, pk, f, mn, node.Options(
|
storers[i] = testStorageNode(ctx, t, wa, genMiner, pk, f, mn, node.Options(
|
||||||
node.Override(new(sectorbuilder.Interface), sbmock.NewMockSectorBuilder(5, build.SectorSizes[0])),
|
node.Override(new(sectorbuilder.Interface), sbmock.NewMockSectorBuilder(5, build.SectorSizes[0])),
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ func RecordTipsetStatePoints(ctx context.Context, api api.FullNode, pl *PointLis
|
|||||||
p := NewPoint("chain.pledge_collateral", pcFilFloat)
|
p := NewPoint("chain.pledge_collateral", pcFilFloat)
|
||||||
pl.AddPoint(p)
|
pl.AddPoint(p)
|
||||||
|
|
||||||
netBal, err := api.WalletBalance(ctx, actors.NetworkAddress)
|
netBal, err := api.WalletBalance(ctx, builtin.RewardActorAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ func RecordTipsetMessagesPoints(ctx context.Context, api api.FullNode, pl *Point
|
|||||||
}
|
}
|
||||||
tag := msgTag{
|
tag := msgTag{
|
||||||
actor: string(dm.Digest),
|
actor: string(dm.Digest),
|
||||||
method: msg.Message.Method,
|
method: uint64(msg.Message.Method),
|
||||||
exitcode: recp[i].ExitCode,
|
exitcode: recp[i].ExitCode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user