Skip to content

Commit

Permalink
fix(relayer): nil check (#17625)
Browse files Browse the repository at this point in the history
Co-authored-by: d1onys1us <13951458+d1onys1us@users.noreply.github.com>
  • Loading branch information
cyberhorsey and d1onys1us committed Jun 19, 2024
1 parent 6bcda30 commit 47fd810
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extend-exclude = [
"packages/protocol/contracts/automata-attestation/**",
"packages/protocol/contracts/thirdparty/**",
"packages/protocol/contracts/compiled/**",
"packages/protocol/deployments/**",
# TODO: fix typos and remove these
"packages/taiko-client/**",
]
5 changes: 5 additions & 0 deletions packages/relayer/indexer/save_event_to_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func (i *Indexer) saveEventToDB(
return 0, errors.Wrap(err, "relayer.DecodeMessageData")
}

if eventType == relayer.EventTypeSendETH {
canonicalToken = nil
amount = eventValue
}

// check if we have an existing event already. this is mostly likely only true
// in the case of us crawling past blocks.
existingEvent, err := i.eventRepo.FirstByEventAndMsgHash(
Expand Down
6 changes: 6 additions & 0 deletions packages/relayer/processor/process_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ func (p *Processor) processMessage(
return false, 0, errors.Wrap(err, "json.Unmarshal")
}

if msgBody.Event == nil {
slog.Warn("empty msgBody", "id", msgBody.ID)

return false, 0, errors.New("empty message body")
}

slog.Info("message received", "srcTxHash", msgBody.Event.Raw.TxHash.Hex())

// check if we already processing this hash
Expand Down

0 comments on commit 47fd810

Please sign in to comment.