Skip to content

Commit cc75c04

Browse files
authoredOct 17, 2023
fix: add missing msg type when parse from event (#1196)
* add missing EventTypeChannelClosed * add missing EventTypeUpgradeChain EventTypeUpgradeClientProposal * add change doc * mark channel closed * revert client types change * reuse with messageInfo * reuse with utils * fix build * Apply suggestions from code review * fix resolve
1 parent cb4708b commit cc75c04

11 files changed

+556
-1000
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* [\#1178](https://github.com/cosmos/relayer/pull/1178) Add max-gas-amount parameter in chain configs.
1818
* [\#1180](https://github.com/cosmos/relayer/pull/1180) Update SDK from v0.47.0 to v0.47.2.
1919
* [\#1205](https://github.com/cosmos/relayer/pull/1205) Update ibc-go to v7.0.1.
20+
* [\#1196](https://github.com/cosmos/relayer/pull/1196) Add missing `EventTypeChannelClosed` when parse from event.
2021
* [\#1179](https://github.com/cosmos/relayer/pull/1179) Add extension-options parameter in chain configs and update SDK to v0.47.3.
2122
* [\#1208](https://github.com/cosmos/relayer/pull/1208) Replace gogo/protobuf to cosmos/gogoproto.
2223
* [\#1221](https://github.com/cosmos/relayer/pull/1221) Update cometbft to v0.37.2 and ibc-go to v7.2.0.

‎relayer/chains/cosmos/cosmos_chain_processor.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/cosmos/relayer/v2/relayer/provider"
1818

1919
ctypes "github.com/cometbft/cometbft/rpc/core/types"
20+
"github.com/cosmos/relayer/v2/relayer/chains"
2021
"go.uber.org/zap"
2122
"golang.org/x/sync/errgroup"
2223
)
@@ -89,22 +90,22 @@ const (
8990
// latestClientState is a map of clientID to the latest clientInfo for that client.
9091
type latestClientState map[string]provider.ClientState
9192

92-
func (l latestClientState) update(ctx context.Context, clientInfo clientInfo, ccp *CosmosChainProcessor) {
93-
existingClientInfo, ok := l[clientInfo.clientID]
93+
func (l latestClientState) update(ctx context.Context, clientInfo chains.ClientInfo, ccp *CosmosChainProcessor) {
94+
existingClientInfo, ok := l[clientInfo.ClientID]
9495
var trustingPeriod time.Duration
9596
if ok {
96-
if clientInfo.consensusHeight.LT(existingClientInfo.ConsensusHeight) {
97+
if clientInfo.ConsensusHeight.LT(existingClientInfo.ConsensusHeight) {
9798
// height is less than latest, so no-op
9899
return
99100
}
100101
trustingPeriod = existingClientInfo.TrustingPeriod
101102
}
102103
if trustingPeriod == 0 {
103-
cs, err := ccp.chainProvider.queryTMClientState(ctx, 0, clientInfo.clientID)
104+
cs, err := ccp.chainProvider.queryTMClientState(ctx, 0, clientInfo.ClientID)
104105
if err != nil {
105106
ccp.log.Error(
106107
"Failed to query client state to get trusting period",
107-
zap.String("client_id", clientInfo.clientID),
108+
zap.String("client_id", clientInfo.ClientID),
108109
zap.Error(err),
109110
)
110111
return
@@ -114,7 +115,7 @@ func (l latestClientState) update(ctx context.Context, clientInfo clientInfo, cc
114115
clientState := clientInfo.ClientState(trustingPeriod)
115116

116117
// update latest if no existing state or provided consensus height is newer
117-
l[clientInfo.clientID] = clientState
118+
l[clientInfo.ClientID] = clientState
118119
}
119120

120121
// Provider returns the ChainProvider, which provides the methods for querying, assembling IBC messages, and sending transactions.
@@ -467,7 +468,7 @@ func (ccp *CosmosChainProcessor) queryCycle(ctx context.Context, persistence *qu
467468
// tx was not successful
468469
continue
469470
}
470-
messages := ibcMessagesFromEvents(ccp.log, tx.Events, chainID, heightUint64, base64Encoded)
471+
messages := chains.IbcMessagesFromEvents(ccp.log, tx.Events, chainID, heightUint64, base64Encoded)
471472

472473
for _, m := range messages {
473474
ccp.handleMessage(ctx, m, ibcMessagesCache)

0 commit comments

Comments
 (0)