Skip to content

Commit

Permalink
fix: fix icon to archway/neutron IBC relay setup using custom icon ch…
Browse files Browse the repository at this point in the history
…ain fail (#184)

* test: add test scripts and functional tests for neutron chain, neutron-archway ibc, icon-neutron ibc

* refactor: change RunStarlarkPackage to RunStarlarkRemotePackage in neutron.go

* test: add functional tests for icon to neutron/archway ibc relay

* test: add functional tests for icon to neutron/archway running with custom configuration

* fix: fix icon to archway/neutron ibc fail

* fix: fix icon to neutron/archway ibc relay setup with custom icon chain fail
  • Loading branch information
abhiyana authored Oct 3, 2023
1 parent bbcf272 commit cabd3f2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
13 changes: 11 additions & 2 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def run_cosmos_ibc_relay_for_already_running_chains(plan, src_chain_config, dst_
}

# Open BTP network on ICON chain
icon_setup_node.open_btp_network(plan, src_chain_service_name, src_data, src_chain_config["endpoint"], src_chain_config["keystore_path"], src_chain_config["keypassword"], src_chain_config["nid"])
tx_result_open_btp_network = icon_setup_node.open_btp_network(plan, src_chain_service_name, src_data, src_chain_config["endpoint"], src_chain_config["keystore_path"], src_chain_config["keypassword"], src_chain_config["nid"])

icon_bind_port = icon_relay_setup.bindPort(plan, src_chain_service_name, deploy_icon_contracts["xcall_connection"], src_chain_config["keystore_path"], src_chain_config["keypassword"], src_chain_config["nid"], src_chain_config["endpoint"], deploy_icon_contracts["ibc_core"], "xcall")

Expand All @@ -333,11 +333,20 @@ def run_cosmos_ibc_relay_for_already_running_chains(plan, src_chain_config, dst_
config_data["contracts"][src_chain_service_name] = deploy_icon_contracts
config_data["contracts"][dst_chain_service_name] = deploy_cosmos_contracts

src_chain_id = src_chain_config["network_name"].split('-', 1)[1]

network_id = icon_setup_node.hex_to_int(plan, src_chain_service_name, src_chain_config["nid"])
btp_network_id = icon_setup_node.hex_to_int(plan, src_chain_service_name, tx_result_open_btp_network["extract.network_id"])
btp_network_type_id = icon_setup_node.hex_to_int(plan, src_chain_service_name, tx_result_open_btp_network["extract.network_type_id"])

src_chain_data = {
"chain_id": "0xacbc4e",
"chain_id": src_chain_id,
"rpc_address": src_chain_config["endpoint"],
"ibc_address": deploy_icon_contracts["ibc_core"],
"password": src_chain_config["keypassword"],
"network_id": network_id,
"btp_network_id": btp_network_id,
"btp_network_type_id": btp_network_type_id
}

dst_chain_data = {
Expand Down
3 changes: 3 additions & 0 deletions services/bridges/ibc/src/bridge.star
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def start_cosmos_relay_for_icon_to_cosmos(plan, src_chain_config, dst_chain_conf
"CHAINID": src_chain_config["chain_id"],
"RPCADDRESS": src_chain_config["rpc_address"],
"IBCADDRESS": src_chain_config["ibc_address"],
"ICONNETWORKNID": src_chain_config["network_id"],
"BTPNETWORKID": src_chain_config["btp_network_id"],
"BTPNETWORKTYPEID": src_chain_config["btp_network_type_id"]
}

plan.render_templates(
Expand Down
6 changes: 3 additions & 3 deletions services/bridges/ibc/static-files/config/icon.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"timeout": "30s",
"keystore": "keystore",
"password": "gochain",
"icon-network-id": 3,
"btp-network-id": 1,
"btp-network-type-id": 1,
"icon-network-id": {{.ICONNETWORKNID}},
"btp-network-id": {{.BTPNETWORKID}},
"btp-network-type-id": {{.BTPNETWORKTYPEID}},
"start-height": 0,
"ibc-handler-address":"{{.IBCADDRESS}}",
"first-retry-block-after": 0,
Expand Down
2 changes: 1 addition & 1 deletion test/functional/dive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should start IBC relay between already running custom icon and neutron chain", func() {
dive.RunCustomIconNode()
dive.RunNeutronNode()
cmd.Args = append(cmd.Args, "bridge", "ibc", "--chainA", "icon", "--chainB", "neutron", "--chainAServiceName", "icon-node-0xacbc4e", "--chainBServiceName", "neutron-node-test-chain1")
cmd.Args = append(cmd.Args, "bridge", "ibc", "--chainA", "icon", "--chainB", "neutron", "--chainAServiceName", "icon-node-0x42f1f3", "--chainBServiceName", "neutron-node-test-chain1")
err := cmd.Run()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
})
Expand Down

0 comments on commit cabd3f2

Please sign in to comment.