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: add missing msg type when parse from event #1196

Merged
merged 15 commits into from
Oct 17, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* [\#1178](https://github.com/cosmos/relayer/pull/1178) Add max-gas-amount parameter in chain configs.
* [\#1180](https://github.com/cosmos/relayer/pull/1180) Update SDK from v0.47.0 to v0.47.2.
* [\#1205](https://github.com/cosmos/relayer/pull/1205) Update ibc-go to v7.0.1.
* [\#1196](https://github.com/cosmos/relayer/pull/1196) Add missing `EventTypeChannelClosed` when parse from event.
* [\#1179](https://github.com/cosmos/relayer/pull/1179) Add extension-options parameter in chain configs and update SDK to v0.47.3.
* [\#1208](https://github.com/cosmos/relayer/pull/1208) Replace gogo/protobuf to cosmos/gogoproto.
* [\#1221](https://github.com/cosmos/relayer/pull/1221) Update cometbft to v0.37.2 and ibc-go to v7.2.0.
Expand Down
15 changes: 8 additions & 7 deletions relayer/chains/cosmos/cosmos_chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/cosmos/relayer/v2/relayer/provider"

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

func (l latestClientState) update(ctx context.Context, clientInfo clientInfo, ccp *CosmosChainProcessor) {
existingClientInfo, ok := l[clientInfo.clientID]
func (l latestClientState) update(ctx context.Context, clientInfo chains.ClientInfo, ccp *CosmosChainProcessor) {
existingClientInfo, ok := l[clientInfo.ClientID]
var trustingPeriod time.Duration
if ok {
if clientInfo.consensusHeight.LT(existingClientInfo.ConsensusHeight) {
if clientInfo.ConsensusHeight.LT(existingClientInfo.ConsensusHeight) {
// height is less than latest, so no-op
return
}
trustingPeriod = existingClientInfo.TrustingPeriod
}
if trustingPeriod == 0 {
cs, err := ccp.chainProvider.queryTMClientState(ctx, 0, clientInfo.clientID)
cs, err := ccp.chainProvider.queryTMClientState(ctx, 0, clientInfo.ClientID)
if err != nil {
ccp.log.Error(
"Failed to query client state to get trusting period",
zap.String("client_id", clientInfo.clientID),
zap.String("client_id", clientInfo.ClientID),
zap.Error(err),
)
return
Expand All @@ -114,7 +115,7 @@ func (l latestClientState) update(ctx context.Context, clientInfo clientInfo, cc
clientState := clientInfo.ClientState(trustingPeriod)

// update latest if no existing state or provided consensus height is newer
l[clientInfo.clientID] = clientState
l[clientInfo.ClientID] = clientState
}

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

for _, m := range messages {
ccp.handleMessage(ctx, m, ibcMessagesCache)
Expand Down
Loading
Loading