Skip to content

Commit

Permalink
Merge pull request #890 from crypto-com/feat/ibc-msg-eth-tx
Browse files Browse the repository at this point in the history
Fix: parse ibc connection msg
  • Loading branch information
vincentysc authored Aug 5, 2024
2 parents 60eecbe + b9fe0b0 commit 844b0c4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GOLANGCI_LINT_VERSION := "v1.49.0"
GO = $(shell command -v go)
GINKGO = $(shell command -v ginkgo)
DOCKER = $(shell command -v docker)
DOCKER_COMPOSE = $(shell command -v docker-compose)
DOCKER_COMPOSE = $(shell command -v docker compose)

TEST_DB ?= 1

Expand All @@ -30,7 +30,7 @@ endif

has_docker_compose:
ifndef DOCKER_COMPOSE
@echo "docker-compose not found. Please install docker-compose and try again."
@echo "docker compose not found. Please install docker compose and try again."
@exit 1
endif

Expand All @@ -49,7 +49,7 @@ build_ginkgo_image:

test: has_docker has_docker_compose has_golang build_ginkgo_image
ifeq ($(TEST_DB), 1)
docker-compose -f docker/docker-compose.test.yml up --abort-on-container-exit
docker compose -f docker/docker-compose.test.yml up --abort-on-container-exit
else
# TODO: Migrate coin test cases to Ginkgo
docker run --rm -v $(shell pwd):/app -w /app \
Expand Down
4 changes: 2 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ handle_ctrlc() {

teardown() {
if [[ "${TEST_DB}" == 1 ]]; then
docker-compose -f ./docker/docker-compose.test.yml -p "${DOCKER_COMPOSE_PROJECT}" down
docker compose -f ./docker/docker-compose.test.yml -p "${DOCKER_COMPOSE_PROJECT}" down
fi
}

setup() {
if [[ "${TEST_DB}" == 1 ]]; then
docker-compose -f ./docker/docker-compose.test.yml -p "${DOCKER_COMPOSE_PROJECT}" up -d
docker compose -f ./docker/docker-compose.test.yml -p "${DOCKER_COMPOSE_PROJECT}" up -d
wait_postgres_ready
fi
}
Expand Down
22 changes: 14 additions & 8 deletions usecase/parser/ibc/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,13 @@ func ParseMsgConnectionOpenInit(
func ParseMsgConnectionOpenTry(
parserParams utils.CosmosParserParams,
) ([]command.Command, []string) {
clientStateType := parserParams.Msg["client_state"].(map[string]interface{})["@type"]
if clientStateType != "/ibc.lightclients.tendermint.v1.ClientState" {
// TODO: SoloMachine and Localhost LightClient
return []command.Command{}, []string{}
clientState, ok := parserParams.Msg["client_state"]
if ok {
clientStateType := clientState.(map[string]interface{})["@type"]
if clientStateType != "/ibc.lightclients.tendermint.v1.ClientState" {
// TODO: SoloMachine and Localhost LightClient
return []command.Command{}, []string{}
}
}

var rawMsg ibc_model.RawMsgConnectionOpenTryTendermintClient
Expand Down Expand Up @@ -319,10 +322,13 @@ func ParseMsgConnectionOpenTry(
func ParseMsgConnectionOpenAck(
parserParams utils.CosmosParserParams,
) ([]command.Command, []string) {
clientStateType := parserParams.Msg["client_state"].(map[string]interface{})["@type"]
if clientStateType != "/ibc.lightclients.tendermint.v1.ClientState" {
// TODO: SoloMachine and Localhost LightClient
return []command.Command{}, []string{}
clientState, ok := parserParams.Msg["client_state"]
if ok {
clientStateType := clientState.(map[string]interface{})["@type"]
if clientStateType != "/ibc.lightclients.tendermint.v1.ClientState" {
// TODO: SoloMachine and Localhost LightClient
return []command.Command{}, []string{}
}
}

var rawMsg ibc_model.RawMsgConnectionOpenAckTendermintClient
Expand Down

0 comments on commit 844b0c4

Please sign in to comment.