diff --git a/chain/gen/gen_test.go b/chain/gen/gen_test.go index 6c9c50602..b4b5b5908 100644 --- a/chain/gen/gen_test.go +++ b/chain/gen/gen_test.go @@ -5,6 +5,9 @@ import ( "github.com/filecoin-project/specs-actors/actors/abi" + _ "github.com/filecoin-project/lotus/lib/sigs/bls" + _ "github.com/filecoin-project/lotus/lib/sigs/secp" + "github.com/filecoin-project/lotus/build" ) @@ -16,7 +19,7 @@ func init() { func testGeneration(t testing.TB, n int, msgs int) { g, err := NewGenerator() if err != nil { - t.Fatal(err) + t.Fatalf("%+v", err) } g.msgsPerBlock = msgs diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index c33456d84..961f9df53 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -176,7 +176,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge return nil, xerrors.Errorf("unmarshaling account meta: %w", err) } - st, err := cst.Put(ctx, account.State{Address: ainfo.Owner}) + st, err := cst.Put(ctx, &account.State{Address: ainfo.Owner}) if err != nil { return nil, err } diff --git a/chain/gen/genesis/t01_init.go b/chain/gen/genesis/t01_init.go index 93afe81ba..a356b2f36 100644 --- a/chain/gen/genesis/t01_init.go +++ b/chain/gen/genesis/t01_init.go @@ -24,7 +24,7 @@ func SetupInitActor(bs bstore.Blockstore, netname string, initialActors []genesi ias.NetworkName = netname cst := cbor.NewCborStore(bs) - amap := hamt.NewNode(cst) + amap := hamt.NewNode(cst, hamt.UseTreeBitWidth(5)) // TODO: use spec adt map for i, a := range initialActors { if a.Type != genesis.TAccount { diff --git a/chain/gen/genesis/t04_power.go b/chain/gen/genesis/t04_power.go index e84fc7264..e2a5b4cc4 100644 --- a/chain/gen/genesis/t04_power.go +++ b/chain/gen/genesis/t04_power.go @@ -16,7 +16,7 @@ import ( func SetupStoragePowerActor(bs bstore.Blockstore) (*types.Actor, error) { ctx := context.TODO() cst := cbor.NewCborStore(bs) - nd := hamt.NewNode(cst) + nd := hamt.NewNode(cst, hamt.UseTreeBitWidth(5)) emptyhamt, err := cst.Put(ctx, nd) if err != nil { return nil, err diff --git a/chain/state/statetree.go b/chain/state/statetree.go index 7c765a14f..cbcf48bd3 100644 --- a/chain/state/statetree.go +++ b/chain/state/statetree.go @@ -36,7 +36,7 @@ func NewStateTree(cst cbor.IpldStore) (*StateTree, error) { } func LoadStateTree(cst cbor.IpldStore, c cid.Cid) (*StateTree, error) { - nd, err := hamt.LoadNode(context.Background(), cst, c) + nd, err := hamt.LoadNode(context.Background(), cst, c, hamt.UseTreeBitWidth(5)) if err != nil { log.Errorf("loading hamt node %s failed: %s", c, err) return nil, err @@ -192,7 +192,7 @@ func (a *adtStore) Context() context.Context { var _ adt.Store = (*adtStore)(nil) func (st *StateTree) Revert() error { - nd, err := hamt.LoadNode(context.Background(), st.Store, st.snapshot) + nd, err := hamt.LoadNode(context.Background(), st.Store, st.snapshot, hamt.UseTreeBitWidth(5)) if err != nil { return err } diff --git a/chain/stmgr/stmgr.go b/chain/stmgr/stmgr.go index 20a64a854..8a672a162 100644 --- a/chain/stmgr/stmgr.go +++ b/chain/stmgr/stmgr.go @@ -608,7 +608,7 @@ func (sm *StateManager) ListAllActors(ctx context.Context, ts *types.TipSet) ([] } cst := cbor.NewCborStore(sm.cs.Blockstore()) - r, err := hamt.LoadNode(ctx, cst, st) + r, err := hamt.LoadNode(ctx, cst, st, hamt.UseTreeBitWidth(5)) if err != nil { return nil, err } diff --git a/chain/vm/invoker.go b/chain/vm/invoker.go index 78878f6f8..77cd900fa 100644 --- a/chain/vm/invoker.go +++ b/chain/vm/invoker.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/filecoin-project/specs-actors/actors/abi" + "github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" "golang.org/x/xerrors" @@ -41,7 +42,7 @@ func NewInvoker() *invoker { inv.Register(actors.CronCodeCid, actors.CronActor{}, actors.CronActorState{}) inv.Register(actors.StoragePowerCodeCid, actors.StoragePowerActor{}, actors.StoragePowerState{}) inv.Register(actors.StorageMarketCodeCid, market.Actor{}, market.State{}) - inv.Register(actors.StorageMinerCodeCid, actors.StorageMinerActor{}, actors.StorageMinerActorState{}) + inv.Register(actors.StorageMinerCodeCid, miner.Actor{}, miner.State{}) inv.Register(actors.MultisigCodeCid, multisig.Actor{}, multisig.State{}) inv.Register(actors.PaymentChannelCodeCid, actors.PaymentChannelActor{}, actors.PaymentChannelActorState{}) diff --git a/cli/multisig.go b/cli/multisig.go index 735eaa93d..11d124a40 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -231,7 +231,7 @@ func GetMultisigPending(ctx context.Context, lapi api.FullNode, hroot cid.Cid) ( bs := apibstore.NewAPIBlockstore(lapi) cst := cbor.NewCborStore(bs) - nd, err := hamt.LoadNode(ctx, cst, hroot) + nd, err := hamt.LoadNode(ctx, cst, hroot, hamt.UseTreeBitWidth(5)) if err != nil { return nil, err } diff --git a/lib/sigs/secp/init.go b/lib/sigs/secp/init.go index 44728202d..1285b19b6 100644 --- a/lib/sigs/secp/init.go +++ b/lib/sigs/secp/init.go @@ -5,7 +5,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-crypto" - crypto2 "github.com/libp2p/go-libp2p-core/crypto" + crypto2 "github.com/filecoin-project/specs-actors/actors/crypto" "github.com/minio/blake2b-simd" "github.com/filecoin-project/lotus/lib/sigs" @@ -55,5 +55,5 @@ func (secpSigner) Verify(sig []byte, a address.Address, msg []byte) error { } func init() { - sigs.RegisterSignature(crypto2.Secp256k1, secpSigner{}) + sigs.RegisterSignature(crypto2.SigTypeSecp256k1, secpSigner{}) } diff --git a/lib/sigs/sigs.go b/lib/sigs/sigs.go index e6552372c..5f467b231 100644 --- a/lib/sigs/sigs.go +++ b/lib/sigs/sigs.go @@ -5,10 +5,11 @@ import ( "fmt" "github.com/filecoin-project/go-address" - "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/specs-actors/actors/crypto" "go.opencensus.io/trace" "golang.org/x/xerrors" + + "github.com/filecoin-project/lotus/chain/types" ) // Sign takes in signature type, private key and message. Returns a signature for that message. diff --git a/node/impl/full/chain.go b/node/impl/full/chain.go index 8abe991e3..4e2745b03 100644 --- a/node/impl/full/chain.go +++ b/node/impl/full/chain.go @@ -206,7 +206,7 @@ func resolveOnce(bs blockstore.Blockstore) func(ctx context.Context, ds ipld.Nod if strings.HasPrefix(names[0], "@H:") { cst := cbor.NewCborStore(bs) - h, err := hamt.LoadNode(ctx, cst, nd.Cid()) + h, err := hamt.LoadNode(ctx, cst, nd.Cid(), hamt.UseTreeBitWidth(5)) if err != nil { return nil, nil, xerrors.Errorf("resolving hamt link: %w", err) } diff --git a/node/impl/full/state.go b/node/impl/full/state.go index bca86746d..cf61160b5 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -254,11 +254,11 @@ func (a *StateAPI) StateMarketParticipants(ctx context.Context, ts *types.TipSet return nil, err } cst := cbor.NewCborStore(a.StateManager.ChainStore().Blockstore()) - escrow, err := hamt.LoadNode(ctx, cst, state.EscrowTable) + escrow, err := hamt.LoadNode(ctx, cst, state.EscrowTable, hamt.UseTreeBitWidth(5)) // todo: adt map if err != nil { return nil, err } - locked, err := hamt.LoadNode(ctx, cst, state.EscrowTable) + locked, err := hamt.LoadNode(ctx, cst, state.EscrowTable, hamt.UseTreeBitWidth(5)) if err != nil { return nil, err } @@ -338,12 +338,12 @@ func (a *StateAPI) StateMarketStorageDeal(ctx context.Context, dealId abi.DealID func (a *StateAPI) StateChangedActors(ctx context.Context, old cid.Cid, new cid.Cid) (map[string]types.Actor, error) { cst := cbor.NewCborStore(a.Chain.Blockstore()) - nh, err := hamt.LoadNode(ctx, cst, new) + nh, err := hamt.LoadNode(ctx, cst, new, hamt.UseTreeBitWidth(5)) if err != nil { return nil, err } - oh, err := hamt.LoadNode(ctx, cst, old) + oh, err := hamt.LoadNode(ctx, cst, old, hamt.UseTreeBitWidth(5)) if err != nil { return nil, err } diff --git a/storage/fpost_run.go b/storage/fpost_run.go index 9d39beb06..d389917ec 100644 --- a/storage/fpost_run.go +++ b/storage/fpost_run.go @@ -5,6 +5,7 @@ import ( "time" ffi "github.com/filecoin-project/filecoin-ffi" + "github.com/filecoin-project/go-address" sectorbuilder "github.com/filecoin-project/go-sectorbuilder" "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/builtin" @@ -107,7 +108,10 @@ func (s *FPoStScheduler) checkFaults(ctx context.Context, ssi sectorbuilder.Sort var faultIDs []abi.SectorNumber if len(faults) > 0 { - params := &miner.DeclareTemporaryFaultsParams{Duration: 900} // TODO: duration is annoying + params := &miner.DeclareTemporaryFaultsParams{ + Duration: 900, // TODO: duration is annoying + SectorNumbers:abi.NewBitField(), + } for _, fault := range faults { if _, ok := declaredFaults[(fault.SectorNum)]; ok { @@ -121,8 +125,8 @@ func (s *FPoStScheduler) checkFaults(ctx context.Context, ssi sectorbuilder.Sort faultIDs = make([]abi.SectorNumber, 0, len(declaredFaults)) for fault := range declaredFaults { faultIDs = append(faultIDs, fault) + params.SectorNumbers.Set(uint64(fault)) } - params.SectorNumbers = faultIDs if len(faultIDs) > 0 { if err := s.declareFaults(ctx, uint64(len(faultIDs)), params); err != nil { @@ -134,7 +138,7 @@ func (s *FPoStScheduler) checkFaults(ctx context.Context, ssi sectorbuilder.Sort return faultIDs, nil } -func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *types.TipSet) (*actors.SubmitFallbackPoStParams, error) { +func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *types.TipSet) (*abi.OnChainPoStVerifyInfo, error) { ctx, span := trace.StartSpan(ctx, "storage.runPost") defer span.End() @@ -177,18 +181,28 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty elapsed := time.Since(tsStart) log.Infow("submitting PoSt", "pLen", len(proof), "elapsed", elapsed) - candidates := make([]types.EPostTicket, len(scandidates)) + mid, err := address.IDFromAddress(s.actor) + if err != nil { + return nil, err + } + + candidates := make([]abi.PoStCandidate, len(scandidates)) for i, sc := range scandidates { part := make([]byte, 32) copy(part, sc.PartialTicket[:]) - candidates[i] = types.EPostTicket{ - Partial: part, - SectorID: sc.SectorNum, - ChallengeIndex: sc.SectorChallengeIndex, + candidates[i] = abi.PoStCandidate{ + RegisteredProof: abi.RegisteredProof_StackedDRG32GiBPoSt, // TODO: build setting + PartialTicket: part, + SectorID: abi.SectorID{ + Miner: abi.ActorID(mid), + Number: sc.SectorNum, + }, + ChallengeIndex: int64(sc.SectorChallengeIndex), // TODO: fix spec } } - return &actors.SubmitFallbackPoStParams{ + return &abi.OnChainPoStVerifyInfo{ + ProofType: abi.RegisteredProof_StackedDRG32GiBPoSt, // TODO: build setting Proof: proof, Candidates: candidates, }, nil @@ -217,7 +231,7 @@ func (s *FPoStScheduler) sortedSectorInfo(ctx context.Context, ts *types.TipSet) return sectorbuilder.NewSortedPublicSectorInfo(sbsi), nil } -func (s *FPoStScheduler) submitPost(ctx context.Context, proof *actors.SubmitFallbackPoStParams) error { +func (s *FPoStScheduler) submitPost(ctx context.Context, proof *abi.OnChainPoStVerifyInfo) error { ctx, span := trace.StartSpan(ctx, "storage.commitPost") defer span.End() @@ -229,7 +243,7 @@ func (s *FPoStScheduler) submitPost(ctx context.Context, proof *actors.SubmitFal msg := &types.Message{ To: s.actor, From: s.worker, - Method: builtin.MethodsMiner.SubmitFallbackPoSt, + Method: builtin.MethodsMiner.SubmitWindowedPoSt, Params: enc, Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late GasLimit: types.NewInt(10000000), // i dont know help