This commit is contained in:
vyzo 2022-04-08 13:48:54 +03:00
parent fcf69e7b82
commit 2c9ea8c46b

View File

@ -59,6 +59,13 @@ import (
testing2 "github.com/filecoin-project/lotus/node/modules/testing" testing2 "github.com/filecoin-project/lotus/node/modules/testing"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage/mockstorage" "github.com/filecoin-project/lotus/storage/mockstorage"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
power3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/power"
"github.com/ipfs/go-datastore"
libp2pcrypto "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
"github.com/stretchr/testify/require"
) )
func init() { func init() {
@ -408,17 +415,20 @@ func (n *Ensemble) Start() *Ensemble {
// we get the proof type for the requested sector size, for // we get the proof type for the requested sector size, for
// the current network version. // the current network version.
nv, err := m.FullNode.FullNode.StateNetworkVersion(ctx, types.EmptyTSK) // nv, err := m.FullNode.FullNode.StateNetworkVersion(ctx, types.EmptyTSK)
require.NoError(n.t, err) // require.NoError(n.t, err)
proofType, err := miner.SealProofTypeFromSectorSize(m.options.sectorSize, nv) // this doesn't currently work with the FVM -- we need to specify policy somehow
require.NoError(n.t, err) // proofType, err := miner.WindowPoStProofTypeFromSectorSize(m.options.sectorSize)
// require.NoError(n.t, err)
// so do this instead, which works:
proofType := abi.RegisteredPoStProof_StackedDrgWindow64GiBV1
params, aerr := actors.SerializeParams(&power2.CreateMinerParams{ params, aerr := actors.SerializeParams(&power3.CreateMinerParams{
Owner: m.OwnerKey.Address, Owner: m.OwnerKey.Address,
Worker: m.OwnerKey.Address, Worker: m.OwnerKey.Address,
SealProofType: proofType, WindowPoStProofType: proofType,
Peer: abi.PeerID(m.Libp2p.PeerID), Peer: abi.PeerID(m.Libp2p.PeerID),
}) })
require.NoError(n.t, aerr) require.NoError(n.t, aerr)
@ -437,7 +447,7 @@ func (n *Ensemble) Start() *Ensemble {
require.NoError(n.t, err) require.NoError(n.t, err)
require.Equal(n.t, exitcode.Ok, mw.Receipt.ExitCode) require.Equal(n.t, exitcode.Ok, mw.Receipt.ExitCode)
var retval power2.CreateMinerReturn var retval power3.CreateMinerReturn
err = retval.UnmarshalCBOR(bytes.NewReader(mw.Receipt.Return)) err = retval.UnmarshalCBOR(bytes.NewReader(mw.Receipt.Return))
require.NoError(n.t, err, "failed to create miner") require.NoError(n.t, err, "failed to create miner")