Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(prover): add some prover logs (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Jul 3, 2023
1 parent 7324547 commit e36c76c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8e398f40bd8693af5966c3ac7bf21cb3516d4b2d
478ba5e9e91fb186abaf2c033aa148b2b4e00b91
1 change: 1 addition & 0 deletions pkg/rpc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func NeedNewProof(
}

if fc.Prover == encoding.OracleProverAddress {
log.Info("Only oracle proof submitted, try generating a normal proof", "blockID", id)
return true, nil
}

Expand Down
27 changes: 20 additions & 7 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,21 +452,34 @@ func (p *Prover) onBlockProposed(
return err
}

log.Info(
"Proposed block information",
"blockID", event.Id,
"prover", block.AssignedProver.Hex(),
"proposedAt", block.ProposedAt,
"proofWindow", block.ProofWindow,
)

proofWindowExpired := uint64(time.Now().Unix()) > block.ProposedAt+block.ProofWindow
// zero address means anyone can prove, proofWindowExpired means anyone can prove even if not zero address
if block.AssignedProver != p.proverAddress && block.AssignedProver != zeroAddress && !proofWindowExpired {
log.Info("proposed block not proveable", "blockID", event.Id, "prover", block.AssignedProver.Hex())
log.Info("Proposed block not proveable", "blockID", event.Id, "prover", block.AssignedProver.Hex())

if !proofWindowExpired {
// if we cant prove it
p.currentBlocksWaitingForProofWindowMutex.Lock()
p.currentBlocksWaitingForProofWindow = append(p.currentBlocksWaitingForProofWindow, event.Meta.Id)
p.currentBlocksBeingProvenMutex.Unlock()
}
// if we cant prove it
p.currentBlocksWaitingForProofWindowMutex.Lock()
p.currentBlocksWaitingForProofWindow = append(p.currentBlocksWaitingForProofWindow, event.Meta.Id)
p.currentBlocksBeingProvenMutex.Unlock()

return nil
}

log.Info(
"Proposed block is proveable",
"blockID", event.Id,
"prover", block.AssignedProver.Hex(),
"proofWindowExpired", proofWindowExpired,
)

ctx, cancelCtx := context.WithCancel(ctx)
p.currentBlocksBeingProvenMutex.Lock()
p.currentBlocksBeingProven[event.Id.Uint64()] = cancelFunc(func() {
Expand Down

0 comments on commit e36c76c

Please sign in to comment.