Fix genesis creation

This commit is contained in:
Łukasz Magiera 2020-04-16 19:17:56 +02:00
parent 98f3cab24e
commit 8338be3a6e
6 changed files with 14 additions and 12 deletions

View File

@ -381,7 +381,7 @@ type MiningBaseInfo struct {
MinerPower types.BigInt MinerPower types.BigInt
NetworkPower types.BigInt NetworkPower types.BigInt
Sectors []*ChainSectorInfo Sectors []*ChainSectorInfo
Worker address.Address WorkerKey address.Address
SectorSize abi.SectorSize SectorSize abi.SectorSize
PrevBeaconEntry types.BeaconEntry PrevBeaconEntry types.BeaconEntry
} }

View File

@ -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) 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 { if err != nil {
return nil, xerrors.Errorf("failed to compute VRF: %w", err) return nil, xerrors.Errorf("failed to compute VRF: %w", err)
} }

View File

@ -185,11 +185,11 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
RegisteredProof: preseal.ProofType, RegisteredProof: preseal.ProofType,
SectorNumber: preseal.SectorID, SectorNumber: preseal.SectorID,
SealedCID: preseal.CommR, SealedCID: preseal.CommR,
SealRandEpoch: 0, SealRandEpoch: 0, // TODO: REVIEW: Correct?
DealIDs: []abi.DealID{dealIDs[pi]}, DealIDs: []abi.DealID{dealIDs[pi]},
Expiration: preseal.Deal.EndEpoch, Expiration: preseal.Deal.EndEpoch,
}, },
ActivationEpoch: 0, ActivationEpoch: 0, // TODO: REVIEW: Correct?
DealWeight: dealWeight, 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) return xerrors.Errorf("failed to prove commit: %v", err)
} }
panic("assign deadlines")
return nil return nil
}) })
if err != nil { if err != nil {

View File

@ -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) 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{ return &api.MiningBaseInfo{
MinerPower: mpow, MinerPower: mpow,
NetworkPower: tpow, NetworkPower: tpow,
Sectors: provset, Sectors: provset,
Worker: mas.GetWorker(), WorkerKey: worker,
SectorSize: mas.Info.SectorSize, SectorSize: mas.Info.SectorSize,
PrevBeaconEntry: *prev, PrevBeaconEntry: *prev,
}, nil }, nil

View File

@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/minio/blake2b-simd"
mh "github.com/multiformats/go-multihash" mh "github.com/multiformats/go-multihash"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -46,7 +47,7 @@ func (ss *syscallShim) ComputeUnsealedSectorCID(st abi.RegisteredProof, pieces [
} }
func (ss *syscallShim) HashBlake2b(data []byte) [32]byte { 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) { func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime.ConsensusFault, error) {

View File

@ -12,7 +12,6 @@ import (
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-storage/storage" "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/store"
"github.com/filecoin-project/lotus/chain/types" "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 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 { type Deadline struct {
// ID // ID
start abi.ChainEpoch start abi.ChainEpoch
@ -223,6 +218,8 @@ func (s *WindowPoStScheduler) abortActivePoSt() {
} }
func (s *WindowPoStScheduler) shouldPost(ctx context.Context, ts *types.TipSet) (bool, *Deadline, error) { func (s *WindowPoStScheduler) shouldPost(ctx context.Context, ts *types.TipSet) (bool, *Deadline, error) {
// call getCurrentDeadline, set activeDeadline if needed // call getCurrentDeadline, set activeDeadline if needed
panic("todo check actor state for post in the deadline") panic("todo check actor state for post in the deadline")
return true, nil, nil return true, nil, nil