self review: some cleanup

This commit is contained in:
whyrusleeping 2019-11-30 22:02:52 -06:00
parent 59d9c681ad
commit 422e25c8e6
5 changed files with 7 additions and 30 deletions

View File

@ -54,9 +54,6 @@ func GetParams(storage bool, tests bool) error {
ft := &fetch{}
for name, info := range params {
if info.SectorSize != 1024 {
continue
}
if !(SupportedSectorSize(info.SectorSize) || (tests && info.SectorSize == 1<<10)) {
continue
}

View File

@ -61,7 +61,6 @@ type ChainGen struct {
eppProvs map[address.Address]ElectionPoStProver
Miners []address.Address
mworkers []address.Address
receivers []address.Address
banker address.Address
bankerNonce uint64
@ -125,8 +124,6 @@ func NewGenerator() (*ChainGen, error) {
}
}
// TODO: this is really weird, we have to guess the miner addresses that
// will be created in order to preseal data for them
maddr1, err := address.NewFromString("t0300")
if err != nil {
return nil, err
@ -212,9 +209,8 @@ func NewGenerator() (*ChainGen, error) {
genesis: genb.Genesis,
w: w,
Miners: minercfg.MinerAddrs,
eppProvs: mgen,
//mworkers: minercfg.Workers,
Miners: minercfg.MinerAddrs,
eppProvs: mgen,
banker: banker,
receivers: receievers,
@ -256,7 +252,6 @@ func (cg *ChainGen) nextBlockProof(ctx context.Context, pts *types.TipSet, m add
return nil, nil, xerrors.Errorf("get miner worker: %w", err)
}
log.Warnf("compute VRF ROUND: %d %s %s", round, m, worker)
vrfout, err := ComputeVRF(ctx, cg.w.Sign, worker, m, DSepTicket, lastTicket.VRFProof)
if err != nil {
return nil, nil, xerrors.Errorf("compute VRF: %w", err)
@ -308,7 +303,6 @@ func (cg *ChainGen) NextTipSetFromMiners(base *types.TipSet, miners []address.Ad
}
if proof != nil {
log.Warn("making block, ticket: ", t.VRFProof)
fblk, err := cg.makeBlock(base, m, proof, t, uint64(round), msgs)
if err != nil {
return nil, xerrors.Errorf("making a block for next tipset failed: %w", err)
@ -510,7 +504,6 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
sectors := sectorbuilder.NewSortedPublicSectorInfo(sinfos)
hvrf := sha256.Sum256(vrfout)
log.Info("Replicas: ", sectors)
candidates, err := epp.GenerateCandidates(ctx, sectors, hvrf[:])
if err != nil {
return false, nil, xerrors.Errorf("failed to generate electionPoSt candidates: %w", err)

View File

@ -620,7 +620,6 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err
err := gen.VerifyVRF(ctx, waddr, h.Miner, gen.DSepTicket, vrfBase, h.Ticket.VRFProof)
if err != nil {
log.Warnf("BAD TICKET: %d %x %x %s %s %x", h.Height, h.Ticket.VRFProof, vrfBase, waddr, h.Miner, baseTs.MinTicket().VRFProof)
return xerrors.Errorf("validating block tickets failed: %w", err)
}
return nil

View File

@ -23,7 +23,7 @@ import (
const PoStReservedWorkers = 1
const PoRepProofPartitions = 2
var LastSectorIdKey = datastore.NewKey("/sectorbuilder/last")
var lastSectorIdKey = datastore.NewKey("/sectorbuilder/last")
var log = logging.Logger("sectorbuilder")
@ -89,7 +89,7 @@ func New(cfg *Config, ds dtypes.MetadataDS) (*SectorBuilder, error) {
}
var lastUsedID uint64
b, err := ds.Get(LastSectorIdKey)
b, err := ds.Get(lastSectorIdKey)
switch err {
case nil:
i, err := strconv.ParseInt(string(b), 10, 64)
@ -101,7 +101,6 @@ func New(cfg *Config, ds dtypes.MetadataDS) (*SectorBuilder, error) {
default:
return nil, err
}
log.Warn("STARTING UP SECTOR BULIDER, LAST ID: ", lastUsedID)
sb := &SectorBuilder{
ds: ds,
@ -148,7 +147,7 @@ func (sb *SectorBuilder) AcquireSectorId() (uint64, error) {
sb.lastID++
id := sb.lastID
err := sb.ds.Put(LastSectorIdKey, []byte(fmt.Sprint(id)))
err := sb.ds.Put(lastSectorIdKey, []byte(fmt.Sprint(id)))
if err != nil {
return 0, err
}
@ -267,14 +266,6 @@ func (sb *SectorBuilder) SealCommit(sectorID uint64, ticket SealTicket, seed Sea
return proof, nil
}
/*
func (sb *SectorBuilder) GeneratePoSt(sectorInfo SortedSectorInfo, challengeSeed [CommLen]byte, faults []uint64) ([]byte, error) {
// Wait, this is a blocking method with no way of interrupting it?
// does it checkpoint itself?
return sectorbuilder.GeneratePoSt(sb.handle, sectorInfo, challengeSeed, faults)
}
*/
func (sb *SectorBuilder) SectorSize() uint64 {
return sb.ssize
}
@ -292,8 +283,6 @@ func (sb *SectorBuilder) ComputeElectionPoSt(sectorInfo SortedPublicSectorInfo,
}
proverID := addressToProverID(sb.Miner)
log.Info("GENERATING ELECTION POST")
defer log.Info("DONE GENERATING ELECTION POST")
return sectorbuilder.GeneratePoSt(sb.ssize, proverID, privsects, cseed, winners)
}
@ -441,12 +430,12 @@ func (sb *SectorBuilder) ImportFrom(osb *SectorBuilder) error {
return err
}
val, err := osb.ds.Get(LastSectorIdKey)
val, err := osb.ds.Get(lastSectorIdKey)
if err != nil {
return err
}
if err := sb.ds.Put(LastSectorIdKey, val); err != nil {
if err := sb.ds.Put(lastSectorIdKey, val); err != nil {
return err
}

View File

@ -119,7 +119,6 @@ func (m *Miner) Unregister(ctx context.Context, addr address.Address) error {
}
func (m *Miner) mine(ctx context.Context) {
log.Warn("Starting mining!!")
ctx, span := trace.StartSpan(ctx, "/mine")
defer span.End()