Skip to content

Commit

Permalink
feat(prover): fix an issue in BlockProposed event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed May 9, 2024
1 parent 9e85e2f commit 948242c
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions packages/taiko-client/prover/event_handler/block_proposed.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,24 @@ func (h *BlockProposedEventHandler) checkExpirationAndSubmitProof(
return nil
}

// The proof submitted to protocol is invalid.
h.proofContestCh <- &proofProducer.ContestRequestBody{
BlockID: e.BlockId,
ProposedIn: new(big.Int).SetUint64(e.Raw.BlockNumber),
ParentHash: proofStatus.ParentHeader.Hash(),
Meta: &e.Meta,
Tier: e.Meta.MinTier,
// If the current proof has not been contested, we should contest it at first.
if proofStatus.CurrentTransitionState.Contester == rpc.ZeroAddress {
h.proofContestCh <- &proofProducer.ContestRequestBody{
BlockID: e.BlockId,
ProposedIn: new(big.Int).SetUint64(e.Raw.BlockNumber),
ParentHash: proofStatus.ParentHeader.Hash(),
Meta: &e.Meta,
Tier: e.Meta.MinTier,
}
} else {
// The invalid proof submitted to protocol is contested by another prover,
// we need to submit a proof with a higher tier.
h.proofSubmissionCh <- &proofProducer.ProofRequestBody{
Tier: proofStatus.CurrentTransitionState.Tier + 1,
Event: e,
}
}

return nil
}

Expand Down

0 comments on commit 948242c

Please sign in to comment.