diff --git a/api/api_full.go b/api/api_full.go index 57f7b121a..49878f8d1 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -381,7 +381,7 @@ type MiningBaseInfo struct { MinerPower types.BigInt NetworkPower types.BigInt Sectors []*ChainSectorInfo - Worker address.Address + WorkerKey address.Address SectorSize abi.SectorSize PrevBeaconEntry types.BeaconEntry } diff --git a/chain/gen/gen.go b/chain/gen/gen.go index 71a7f3127..3b57b1d88 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -537,7 +537,7 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round abi.ChainEpoch, return nil, xerrors.Errorf("failed to draw randomness: %w", err) } - vrfout, err := ComputeVRF(ctx, a.WalletSign, mbi.Worker, electionRand) + vrfout, err := ComputeVRF(ctx, a.WalletSign, mbi.WorkerKey, electionRand) if err != nil { return nil, xerrors.Errorf("failed to compute VRF: %w", err) } diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index 0946ebe76..a576139d0 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -185,11 +185,11 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid RegisteredProof: preseal.ProofType, SectorNumber: preseal.SectorID, SealedCID: preseal.CommR, - SealRandEpoch: 0, + SealRandEpoch: 0, // TODO: REVIEW: Correct? DealIDs: []abi.DealID{dealIDs[pi]}, Expiration: preseal.Deal.EndEpoch, }, - ActivationEpoch: 0, + ActivationEpoch: 0, // TODO: REVIEW: Correct? DealWeight: dealWeight, } @@ -200,7 +200,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid return xerrors.Errorf("failed to prove commit: %v", err) } - panic("assign deadlines") return nil }) if err != nil { diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index ae3d898e6..56df6f711 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -417,11 +417,16 @@ func MinerGetBaseInfo(ctx context.Context, sm *StateManager, tsk types.TipSetKey return nil, xerrors.Errorf("failed to get latest beacon entry: %w", err) } + worker, err := sm.ResolveToKeyAddress(ctx, mas.GetWorker(), ts) + if err != nil { + return nil, xerrors.Errorf("resolving worker address: %w", err) + } + return &api.MiningBaseInfo{ MinerPower: mpow, NetworkPower: tpow, Sectors: provset, - Worker: mas.GetWorker(), + WorkerKey: worker, SectorSize: mas.Info.SectorSize, PrevBeaconEntry: *prev, }, nil diff --git a/chain/vm/syscalls.go b/chain/vm/syscalls.go index eba2660a0..28062a30b 100644 --- a/chain/vm/syscalls.go +++ b/chain/vm/syscalls.go @@ -6,6 +6,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/ipfs/go-cid" + "github.com/minio/blake2b-simd" mh "github.com/multiformats/go-multihash" "golang.org/x/xerrors" @@ -46,7 +47,7 @@ func (ss *syscallShim) ComputeUnsealedSectorCID(st abi.RegisteredProof, pieces [ } func (ss *syscallShim) HashBlake2b(data []byte) [32]byte { - panic("NYI") + return blake2b.Sum256(data) } func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime.ConsensusFault, error) { diff --git a/storage/wdpost_sched.go b/storage/wdpost_sched.go index cf972ee17..0a2243462 100644 --- a/storage/wdpost_sched.go +++ b/storage/wdpost_sched.go @@ -12,7 +12,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-storage/storage" - "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" ) @@ -56,10 +55,6 @@ func NewWindowedPoStScheduler(api storageMinerApi, sb storage.Prover, actor addr return &WindowPoStScheduler{api: api, prover: sb, actor: actor, worker: worker, proofType: rt}, nil } -const ProvingDeadlineEpochs = (30 * 60) / build.BlockDelay -const ProvingPeriodDeadlines = 48 -const ProvingPeriodEpochs = ProvingDeadlineEpochs * ProvingDeadlineEpochs - type Deadline struct { // ID start abi.ChainEpoch @@ -223,6 +218,8 @@ func (s *WindowPoStScheduler) abortActivePoSt() { } func (s *WindowPoStScheduler) shouldPost(ctx context.Context, ts *types.TipSet) (bool, *Deadline, error) { + + // call getCurrentDeadline, set activeDeadline if needed panic("todo check actor state for post in the deadline") return true, nil, nil