Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(relayer): check event status one more time before sending call #17120

Merged
merged 13 commits into from
May 14, 2024
19 changes: 19 additions & 0 deletions packages/relayer/processor/process_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,25 @@ func (p *Processor) sendProcessMessageCall(
estimatedCost = gasUsed * (baseFee.Uint64() + gasTipCap.Uint64())
}

// we should check event status one more time, after we have waiting for
// confirmations, and after we have generated proof. its possible another relayer
// or the user themself has claimed this in the time it took
// for us to do this work, which would cause us to revert.
eventStatus, err := p.eventStatusFromMsgHash(ctx, event.MsgHash)
if err != nil {
return nil, errors.Wrap(err, "p.eventStatusFromMsgHash")
}

if !canProcessMessage(
ctx,
eventStatus,
event.Message.SrcOwner,
p.relayerAddr,
uint64(event.Message.GasLimit),
) {
return nil, errUnprocessable
}

candidate := txmgr.TxCandidate{
TxData: data,
Blobs: nil,
Expand Down