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

fix: avoid counterparty recv packet message get removed before open channel #1455

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* [\#1326](https://github.com/cosmos/relayer/pull/1326) Avoid sending channel close confirm message after channel get closed successfully.
* [\#1364](https://github.com/cosmos/relayer/pull/1364) Include feegrant message when calculate gas.
* [\#1390](https://github.com/cosmos/relayer/pull/1390) Avoid no concrete type registered for type URL error of EthAccount.
* [\#1455](https://github.com/cosmos/relayer/pull/1455) Allow retry for pathEnd to avoid packet message get removed before open channel.

## v0.9.3

Expand Down
9 changes: 7 additions & 2 deletions relayer/processor/path_end_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type pathEndRuntime struct {
metrics *PrometheusMetrics

finishedProcessing chan messageToTrack
retryCount uint64
}

func newPathEndRuntime(log *zap.Logger, pathEnd PathEnd, metrics *PrometheusMetrics) *pathEndRuntime {
Expand Down Expand Up @@ -560,8 +561,12 @@ func (pathEnd *pathEndRuntime) shouldSendPacketMessage(message packetIBCMessage,
zap.Uint64("sequence", sequence),
zap.Inline(k),
)
pathEnd.removePacketRetention(counterparty, eventType, k, sequence)
return false
if pathEnd.retryCount >= maxMessageSendRetriesIfChannelNotOpen {
pathEnd.removePacketRetention(counterparty, eventType, k, sequence)
pathEnd.retryCount = 0
return false
}
pathEnd.retryCount++
}
msgProcessCache, ok := pathEnd.packetProcessing[k]
if !ok {
Expand Down
3 changes: 3 additions & 0 deletions relayer/processor/path_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const (
// How many times to retry sending a message before giving up on it.
maxMessageSendRetries = 5

// How many times to retry sending a message if channel is not opened.
maxMessageSendRetriesIfChannelNotOpen = 1

// How many blocks of history to retain ibc headers in the cache for.
ibcHeadersToCache = 10

Expand Down
Loading