diff --git a/chain/gen/gen.go b/chain/gen/gen.go index 35bf58a38..384a89bde 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -519,10 +519,7 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add var winners []sectorbuilder.EPostCandidate for _, c := range candidates { - sectors := types.BigDiv(pow.MinerPower, types.NewInt(ssize)) - challangeCount := sectorbuilder.ElectionPostChallengeCount(sectors.Uint64()) - - if types.IsTicketWinner(c.PartialTicket[:], ssize, pow.TotalPower, int64(challangeCount)) { + if types.IsTicketWinner(c.PartialTicket[:], ssize, pow.TotalPower) { winners = append(winners, c) } } diff --git a/chain/sync.go b/chain/sync.go index dbf974cfa..abf8fe26d 100644 --- a/chain/sync.go +++ b/chain/sync.go @@ -545,7 +545,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err } winnerCheck := async.Err(func() error { - mpow, tpow, err := stmgr.GetPower(ctx, syncer.sm, baseTs, h.Miner) + _, tpow, err := stmgr.GetPower(ctx, syncer.sm, baseTs, h.Miner) if err != nil { return xerrors.Errorf("failed getting power: %w", err) } @@ -556,10 +556,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err } for _, t := range h.EPostProof.Candidates { - sectors := types.BigDiv(mpow, types.NewInt(ssize)) - challangeCount := sectorbuilder.ElectionPostChallengeCount(sectors.Uint64()) - - if !types.IsTicketWinner(t.Partial, ssize, tpow, int64(challangeCount)) { + if !types.IsTicketWinner(t.Partial, ssize, tpow) { return xerrors.Errorf("miner created a block but was not a winner") } } diff --git a/chain/types/blockheader.go b/chain/types/blockheader.go index 79585f1d2..03b03c0f3 100644 --- a/chain/types/blockheader.go +++ b/chain/types/blockheader.go @@ -172,7 +172,7 @@ func CidArrsEqual(a, b []cid.Cid) bool { var blocksPerEpoch = NewInt(build.BlocksPerEpoch) -func IsTicketWinner(partialTicket []byte, ssizeI uint64, totpow BigInt, sampleRate int64) bool { +func IsTicketWinner(partialTicket []byte, ssizeI uint64, totpow BigInt) bool { ssize := NewInt(ssizeI) /* @@ -189,7 +189,7 @@ func IsTicketWinner(partialTicket []byte, ssizeI uint64, totpow BigInt, sampleRa lhs := BigFromBytes(h[:]).Int lhs = lhs.Mul(lhs, totpow.Int) - lhs = lhs.Mul(lhs, big.NewInt(sampleRate)) + lhs = lhs.Mul(lhs, big.NewInt(build.SectorChallengeRatioDiv)) // rhs = sectorSize * 2^256 // rhs = sectorSize << 256