From 14b1266321a72a44a069ec8c4ffea768b527c338 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Tue, 7 May 2024 08:18:52 +0800 Subject: [PATCH 1/2] fix: avoid counterparty recv packet message get removed before open channel (#1455) * fix: avoid counterparty recv packet message get removed before open channel this change was related to /~https://github.com/cosmos/relayer/pull/1393/commits/8b7184bfbbb6def03dce9dc3650beac81d18efca * add retry instead * separate max --- CHANGELOG.md | 1 + relayer/processor/path_end_runtime.go | 9 +++++++-- relayer/processor/path_processor.go | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65a5dd6e4..8cdc5868d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/relayer/processor/path_end_runtime.go b/relayer/processor/path_end_runtime.go index 687553eb6..9765aad73 100644 --- a/relayer/processor/path_end_runtime.go +++ b/relayer/processor/path_end_runtime.go @@ -59,6 +59,7 @@ type pathEndRuntime struct { metrics *PrometheusMetrics finishedProcessing chan messageToTrack + retryCount uint64 } func newPathEndRuntime(log *zap.Logger, pathEnd PathEnd, metrics *PrometheusMetrics) *pathEndRuntime { @@ -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 { diff --git a/relayer/processor/path_processor.go b/relayer/processor/path_processor.go index a6e31bd60..3cc2668da 100644 --- a/relayer/processor/path_processor.go +++ b/relayer/processor/path_processor.go @@ -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 From e48edffc5d61d669b90f55c1b684d92220a8c753 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 00:42:23 +0000 Subject: [PATCH 2/2] build(deps): bump github.com/hashicorp/go-getter from 1.7.3 to 1.7.4 (#1453) Bumps [github.com/hashicorp/go-getter](/~https://github.com/hashicorp/go-getter) from 1.7.3 to 1.7.4. - [Release notes](/~https://github.com/hashicorp/go-getter/releases) - [Changelog](/~https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml) - [Commits](/~https://github.com/hashicorp/go-getter/compare/v1.7.3...v1.7.4) --- updated-dependencies: - dependency-name: github.com/hashicorp/go-getter dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 204cd07e8..010cefb26 100644 --- a/go.mod +++ b/go.mod @@ -123,7 +123,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.3 // indirect + github.com/hashicorp/go-getter v1.7.4 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.2 // indirect diff --git a/go.sum b/go.sum index 81bfd731f..f090160bc 100644 --- a/go.sum +++ b/go.sum @@ -709,8 +709,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E= -github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.4 h1:3yQjWuxICvSpYwqSayAdKRFcvBl1y/vogCxczWSmix0= +github.com/hashicorp/go-getter v1.7.4/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=