condition randomness changes on fork height

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
whyrusleeping 2020-09-09 20:06:23 -07:00 committed by Aayush Rajasekaran
parent 7a46c5ff31
commit db6bd890d9
3 changed files with 11 additions and 4 deletions

View File

@ -358,7 +358,9 @@ func (cg *ChainGen) nextBlockProof(ctx context.Context, pts *types.TipSet, m add
return nil, nil, nil, xerrors.Errorf("failed to cbor marshal address: %w", err) return nil, nil, nil, xerrors.Errorf("failed to cbor marshal address: %w", err)
} }
buf.Write(pts.MinTicket().VRFProof) if round > build.UpgradeSmokeHeight {
buf.Write(pts.MinTicket().VRFProof)
}
ticketRand, err := store.DrawRandomness(rbase.Data, crypto.DomainSeparationTag_TicketProduction, round-build.TicketRandomnessLookback, buf.Bytes()) ticketRand, err := store.DrawRandomness(rbase.Data, crypto.DomainSeparationTag_TicketProduction, round-build.TicketRandomnessLookback, buf.Bytes())
if err != nil { if err != nil {

View File

@ -891,7 +891,9 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) (er
return xerrors.Errorf("failed to marshal miner address to cbor: %w", err) return xerrors.Errorf("failed to marshal miner address to cbor: %w", err)
} }
buf.Write(baseTs.MinTicket().VRFProof) if h.Height > build.UpgradeSmokeHeight {
buf.Write(baseTs.MinTicket().VRFProof)
}
beaconBase := *prevBeacon beaconBase := *prevBeacon
if len(h.BeaconEntries) != 0 { if len(h.BeaconEntries) != 0 {

View File

@ -447,9 +447,12 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types.BeaconEntry, bas
return nil, xerrors.Errorf("failed to marshal address to cbor: %w", err) return nil, xerrors.Errorf("failed to marshal address to cbor: %w", err)
} }
buf.Write(base.TipSet.MinTicket().VRFProof) round := base.TipSet.Height() + base.NullRounds + 1
if round > build.UpgradeSmokeHeight {
buf.Write(base.TipSet.MinTicket().VRFProof)
}
input, err := store.DrawRandomness(brand.Data, crypto.DomainSeparationTag_TicketProduction, base.TipSet.Height()+base.NullRounds+1-build.TicketRandomnessLookback, buf.Bytes()) input, err := store.DrawRandomness(brand.Data, crypto.DomainSeparationTag_TicketProduction, round-build.TicketRandomnessLookback, buf.Bytes())
if err != nil { if err != nil {
return nil, err return nil, err
} }