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

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 3c8d88d commit 83f57df
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions prover/event_handler/block_proposed.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,22 @@ 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 83f57df

Please sign in to comment.