fix proof types.
This commit is contained in:
parent
7ee184e965
commit
d1b291de5e
@ -7,6 +7,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"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/big"
|
||||||
"github.com/filecoin-project/go-state-types/exitcode"
|
"github.com/filecoin-project/go-state-types/exitcode"
|
||||||
lapi "github.com/filecoin-project/lotus/api"
|
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) {
|
func (ts *apiSuite) testNonGenesisMiner(t *testing.T) {
|
||||||
ctx := context.Background()
|
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)
|
gaa, err := genesisMiner.ActorAddress(ctx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -181,7 +183,10 @@ func (ts *apiSuite) testNonGenesisMiner(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
var newMiner kit.TestMiner
|
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)
|
ta, err := newMiner.ActorAddress(ctx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -337,7 +337,7 @@ func (n *Ensemble) Start() *Ensemble {
|
|||||||
params, aerr := actors.SerializeParams(&power2.CreateMinerParams{
|
params, aerr := actors.SerializeParams(&power2.CreateMinerParams{
|
||||||
Owner: m.OwnerKey.Address,
|
Owner: m.OwnerKey.Address,
|
||||||
Worker: m.OwnerKey.Address,
|
Worker: m.OwnerKey.Address,
|
||||||
SealProofType: n.options.proofType,
|
SealProofType: m.options.proofType,
|
||||||
Peer: abi.PeerID(m.Libp2p.PeerID),
|
Peer: abi.PeerID(m.Libp2p.PeerID),
|
||||||
})
|
})
|
||||||
require.NoError(n.t, aerr)
|
require.NoError(n.t, aerr)
|
||||||
|
@ -16,22 +16,13 @@ type genesisAccount struct {
|
|||||||
|
|
||||||
type ensembleOpts struct {
|
type ensembleOpts struct {
|
||||||
pastOffset time.Duration
|
pastOffset time.Duration
|
||||||
proofType abi.RegisteredSealProof
|
|
||||||
verifiedRoot genesisAccount
|
verifiedRoot genesisAccount
|
||||||
accounts []genesisAccount
|
accounts []genesisAccount
|
||||||
mockProofs bool
|
mockProofs bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var DefaultEnsembleOpts = ensembleOpts{
|
var DefaultEnsembleOpts = ensembleOpts{
|
||||||
pastOffset: 10000000 * time.Second, // time sufficiently in the past to trigger catch-up mining.
|
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.
|
// MockProofs activates mock proofs for the entire ensemble.
|
||||||
|
@ -26,12 +26,14 @@ type nodeOpts struct {
|
|||||||
ownerKey *wallet.Key
|
ownerKey *wallet.Key
|
||||||
extraNodeOpts []node.Option
|
extraNodeOpts []node.Option
|
||||||
optBuilders []OptBuilder
|
optBuilders []OptBuilder
|
||||||
|
proofType abi.RegisteredSealProof
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultNodeOpts are the default options that will be applied to test nodes.
|
// DefaultNodeOpts are the default options that will be applied to test nodes.
|
||||||
var DefaultNodeOpts = nodeOpts{
|
var DefaultNodeOpts = nodeOpts{
|
||||||
balance: big.Mul(big.NewInt(100000000), types.NewInt(build.FilecoinPrecision)),
|
balance: big.Mul(big.NewInt(100000000), types.NewInt(build.FilecoinPrecision)),
|
||||||
sectors: DefaultPresealsPerBootstrapMiner,
|
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
|
// 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
|
// ProofType sets the proof type for this node. If you're using new actor
|
||||||
// constructor options after some nodes are already active.
|
// versions, this should be a _1 proof type.
|
||||||
func AddOptBuilder(optBuilder OptBuilder) NodeOpt {
|
func ProofType(proofType abi.RegisteredSealProof) NodeOpt {
|
||||||
return func(opts *nodeOpts) error {
|
return func(opts *nodeOpts) error {
|
||||||
opts.optBuilders = append(opts.optBuilders, optBuilder)
|
opts.proofType = proofType
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user