Fix build errors
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
9c250f24fa
commit
9fd1b95fd5
@ -543,33 +543,37 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err
|
|||||||
return xerrors.Errorf("received block was from slashed or invalid miner")
|
return xerrors.Errorf("received block was from slashed or invalid miner")
|
||||||
}
|
}
|
||||||
|
|
||||||
mpow, tpow, err := stmgr.GetPower(ctx, syncer.sm, baseTs, h.Miner)
|
// TODO fix winners
|
||||||
if err != nil {
|
/*
|
||||||
return xerrors.Errorf("failed getting power: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize, err := stmgr.GetMinerSectorSize(ctx, syncer.sm, baseTs, h.Miner)
|
mpow, tpow, err := stmgr.GetPower(ctx, syncer.sm, baseTs, h.Miner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to get sector size for block miner: %w", err)
|
return xerrors.Errorf("failed getting power: %w", err)
|
||||||
}
|
|
||||||
|
|
||||||
snum := types.BigDiv(mpow, types.NewInt(uint64(ssize)))
|
|
||||||
|
|
||||||
if len(h.EPostProof.Candidates) == 0 {
|
|
||||||
return xerrors.Errorf("no candidates")
|
|
||||||
}
|
|
||||||
|
|
||||||
wins := make(map[uint64]bool)
|
|
||||||
for _, t := range h.EPostProof.Candidates {
|
|
||||||
if wins[t.ChallengeIndex] {
|
|
||||||
return xerrors.Errorf("block had duplicate epost candidates")
|
|
||||||
}
|
}
|
||||||
wins[t.ChallengeIndex] = true
|
|
||||||
|
|
||||||
if !types.IsTicketWinner(t.Partial, ssize, snum.Uint64(), tpow) {
|
ssize, err := stmgr.GetMinerSectorSize(ctx, syncer.sm, baseTs, h.Miner)
|
||||||
return xerrors.Errorf("miner created a block but was not a winner")
|
if err != nil {
|
||||||
|
return xerrors.Errorf("failed to get sector size for block miner: %w", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
snum := types.BigDiv(mpow, types.NewInt(uint64(ssize)))
|
||||||
|
|
||||||
|
if len(h.EPostProof.Candidates) == 0 {
|
||||||
|
return xerrors.Errorf("no candidates")
|
||||||
|
}
|
||||||
|
wins := make(map[uint64]bool)
|
||||||
|
for _, t := range h.EPostProof.Candidates {
|
||||||
|
if wins[t.ChallengeIndex] {
|
||||||
|
return xerrors.Errorf("block had duplicate epost candidates")
|
||||||
|
}
|
||||||
|
wins[t.ChallengeIndex] = true
|
||||||
|
|
||||||
|
if !types.IsTicketWinner(t.Partial, ssize, snum.Uint64(), tpow) {
|
||||||
|
return xerrors.Errorf("miner created a block but was not a winner")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -978,13 +982,12 @@ func (syncer *Syncer) collectHeaders(ctx context.Context, from *types.TipSet, to
|
|||||||
syncer.bad.Add(from.Cids()[0], "no beacon entires")
|
syncer.bad.Add(from.Cids()[0], "no beacon entires")
|
||||||
return nil, xerrors.Errorf("block (%s) contained no drand entires", from.Cids()[0])
|
return nil, xerrors.Errorf("block (%s) contained no drand entires", from.Cids()[0])
|
||||||
}
|
}
|
||||||
cur := targetBE[0].Index
|
cur := targetBE[0].Index
|
||||||
|
|
||||||
for _, e := range targetBE[1:] {
|
for _, e := range targetBE[1:] {
|
||||||
if cur >= e.Index {
|
if cur >= e.Index {
|
||||||
syncer.bad.Add(from.Cids()[0], "wrong order of beacon entires")
|
syncer.bad.Add(from.Cids()[0], "wrong order of beacon entires")
|
||||||
return nil, xerrors.Errorf("wrong order of beacon entires")
|
return nil, xerrors.Errorf("wrong order of beacon entires")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningB
|
|||||||
return nil, xerrors.Errorf("scratching ticket failed: %w", err)
|
return nil, xerrors.Errorf("scratching ticket failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
proofin, err := gen.IsRoundWinner(ctx, base.ts, int64(round), addr, m.epp, bvals[len(bvals)-1] m.api)
|
proofin, err := gen.IsRoundWinner(ctx, base.ts, int64(round), addr, m.epp, bvals[len(bvals)-1], m.api)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to check if we win next round: %w", err)
|
return nil, xerrors.Errorf("failed to check if we win next round: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user