Lotus的PoSt的部分从electionPoSt变成两种新的PoSt,一种是winningPoSt,一种是windowPoSt。先讲讲winningPoSt吧。winningPoSt,顾名思义,在winning的时候进行的PoSt。所谓的winning,也就是获取出块权。
简单的说,winningPoSt,随机抽查的一个sector,该sector中的66条随机抽查的merkle path都能正确。接着讲讲代码逻辑。从Lotus的go的代码说起。一切从出块开始 - lotus/miner/miner.go的Miner结构的mineOne函数。
func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningBase) (*types.BlockMsg, error) {
mbi, err := m.api.MinerGetBaseInfo(ctx, addr, round, base.TipSet.Key())
rand, err := m.api.ChainGetRandomness(ctx, base.TipSet.Key(), crypto.DomainSeparationTag_WinningPoStChallengeSeed, base.TipSet.Height()+base.NullRounds, nil)
prand := abi.PoStRandomness(rand)
postProof, err := m.epp.ComputeProof(ctx, mbi.Sectors, prand)
其中,MinerGetBaseInfo函数是获取一些基本信息,其中包括需要抽取的sector信息。ComputeProof函数就是计算winningPoSt证明。
因为这些逻辑的具体实现是在rust-fil-proofs,也就是r