fix proof types.
This commit is contained in:
parent
7ee184e965
commit
d1b291de5e
@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
@ -170,9 +171,10 @@ func (ts *apiSuite) testMiningReal(t *testing.T) {
|
||||
func (ts *apiSuite) testNonGenesisMiner(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
full, genesisMiner, ens := kit.EnsembleMinimal(t, ts.opts...)
|
||||
full, genesisMiner, ens := kit.EnsembleMinimal(t, append(ts.opts, kit.MockProofs())...)
|
||||
ens.InterconnectAll().BeginMining(4 * time.Millisecond)
|
||||
|
||||
ens.BeginMining(4 * time.Millisecond)
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
gaa, err := genesisMiner.ActorAddress(ctx)
|
||||
require.NoError(t, err)
|
||||
@ -181,7 +183,10 @@ func (ts *apiSuite) testNonGenesisMiner(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
var newMiner kit.TestMiner
|
||||
ens.Miner(&newMiner, full, kit.OwnerAddr(full.DefaultKey)).Start()
|
||||
ens.Miner(&newMiner, full,
|
||||
kit.OwnerAddr(full.DefaultKey),
|
||||
kit.ProofType(abi.RegisteredSealProof_StackedDrg2KiBV1), // we're using v0 actors with old proofs.
|
||||
).Start().InterconnectAll()
|
||||
|
||||
ta, err := newMiner.ActorAddress(ctx)
|
||||
require.NoError(t, err)
|
||||
|
@ -337,7 +337,7 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
params, aerr := actors.SerializeParams(&power2.CreateMinerParams{
|
||||
Owner: m.OwnerKey.Address,
|
||||
Worker: m.OwnerKey.Address,
|
||||
SealProofType: n.options.proofType,
|
||||
SealProofType: m.options.proofType,
|
||||
Peer: abi.PeerID(m.Libp2p.PeerID),
|
||||
})
|
||||
require.NoError(n.t, aerr)
|
||||
|
@ -16,7 +16,6 @@ type genesisAccount struct {
|
||||
|
||||
type ensembleOpts struct {
|
||||
pastOffset time.Duration
|
||||
proofType abi.RegisteredSealProof
|
||||
verifiedRoot genesisAccount
|
||||
accounts []genesisAccount
|
||||
mockProofs bool
|
||||
@ -24,14 +23,6 @@ type ensembleOpts struct {
|
||||
|
||||
var DefaultEnsembleOpts = ensembleOpts{
|
||||
pastOffset: 10000000 * time.Second, // time sufficiently in the past to trigger catch-up mining.
|
||||
proofType: abi.RegisteredSealProof_StackedDrg2KiBV1_1, // default _concrete_ proof type for non-genesis miners (notice the _1).
|
||||
}
|
||||
|
||||
func ProofType(proofType abi.RegisteredSealProof) EnsembleOpt {
|
||||
return func(opts *ensembleOpts) error {
|
||||
opts.proofType = proofType
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// MockProofs activates mock proofs for the entire ensemble.
|
||||
|
@ -26,12 +26,14 @@ type nodeOpts struct {
|
||||
ownerKey *wallet.Key
|
||||
extraNodeOpts []node.Option
|
||||
optBuilders []OptBuilder
|
||||
proofType abi.RegisteredSealProof
|
||||
}
|
||||
|
||||
// DefaultNodeOpts are the default options that will be applied to test nodes.
|
||||
var DefaultNodeOpts = nodeOpts{
|
||||
balance: big.Mul(big.NewInt(100000000), types.NewInt(build.FilecoinPrecision)),
|
||||
sectors: DefaultPresealsPerBootstrapMiner,
|
||||
proofType: abi.RegisteredSealProof_StackedDrg2KiBV1_1, // default _concrete_ proof type for non-genesis miners (notice the _1) for new actors versions.
|
||||
}
|
||||
|
||||
// OptBuilder is used to create an option after some other node is already
|
||||
@ -95,11 +97,11 @@ func ConstructorOpts(extra ...node.Option) NodeOpt {
|
||||
}
|
||||
}
|
||||
|
||||
// AddOptBuilder adds an OptionBuilder to a node. It is used to add Lotus node
|
||||
// constructor options after some nodes are already active.
|
||||
func AddOptBuilder(optBuilder OptBuilder) NodeOpt {
|
||||
// ProofType sets the proof type for this node. If you're using new actor
|
||||
// versions, this should be a _1 proof type.
|
||||
func ProofType(proofType abi.RegisteredSealProof) NodeOpt {
|
||||
return func(opts *nodeOpts) error {
|
||||
opts.optBuilders = append(opts.optBuilders, optBuilder)
|
||||
opts.proofType = proofType
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user