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

Commit

Permalink
fix(prover): check latest verified ID on proof submission (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Sep 12, 2023
1 parent ebdb3da commit 8157550
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions prover/proof_submitter/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@ func sendTxWithBackoff(
return nil
}

// check if latest verified head is ahead of this block proof
stateVars, err := cli.GetProtocolStateVariables(&bind.CallOpts{Context: ctx})
if err != nil {
log.Warn("failed to fetch state vars",
"blockID", blockID,
"error", err,
)
return err
}

latestVerifiedId := stateVars.LastVerifiedBlockId

if new(big.Int).SetUint64(latestVerifiedId).Cmp(blockID) >= 0 {
log.Warn("Block is already verified, skip current proof submission",
"blockID", blockID.Uint64(),
"latestVerifiedId", latestVerifiedId,
)
return nil
}

tx, err := sendTxFunc()
if err != nil {
err = encoding.TryParsingCustomError(err)
Expand Down

0 comments on commit 8157550

Please sign in to comment.