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

Upgrade to SDK v0.43+ #948

Merged
merged 45 commits into from
Aug 19, 2021
Merged

Upgrade to SDK v0.43+ #948

merged 45 commits into from
Aug 19, 2021

Conversation

ancazamfir
Copy link
Collaborator

@ancazamfir ancazamfir commented May 15, 2021

Closes: #947
Closes: #918

Description

The proto files in this branch are currently aligned with:


For contributor use:

  • Updated the Unreleased section of CHANGELOG.md with the issue.
  • If applicable: Unit tests written, added test to CI.
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments.
  • Re-reviewed Files changed in the Github PR explorer.

@colin-axner
Copy link
Contributor

colin-axner commented May 19, 2021

Did some testing using this branch between a gaia bin on v4.2.1 and the hub/cosmoshub-4.6 branch. Everything works great! I do get some "packet already received" errors when running hermes start-multi. See logs. Is this expected?

The main downside is lost fees for retrying these transactions

Edit: It works fine if I use gaiad to initiate the transfer. Must be related to hermes tx raw

@ancazamfir
Copy link
Collaborator Author

ancazamfir commented May 19, 2021

Did some testing using this branch between a gaia bin on v4.2.1 and the hub/cosmoshub-4.6 branch. Everything works great! I do get some "packet already received" errors when running hermes start-multi. See logs. Is this expected?

The main downside is lost fees for retrying these transactions

Edit: It works fine if I use gaiad to initiate the transfer. Must be related to hermes tx raw

This is not expected unless you had another relayer running in parallel. Could you give more detail of the setup? And the exact ft-transfer command you used? I use this command often and haven't seen this before.

@colin-axner
Copy link
Contributor

colin-axner commented May 20, 2021

I setup an old/new gaia using the gaiad manager. Created channels and sent tokens using ts-relayer. Then stopped the ts-relayer (I'm fairly certain)

Created channels using hermes, started hermes via start-multi. Sent using

hermes tx raw ft-transfer network2 network1 transfer channel-0 1 -o 1000 -n 1 -d localcoin

got the above logs.

Then sent using gaiad afterwards and it worked fine.

I will try to reproduce again later today

I realize that the transfer is being sent over channel-0. I created channel-0 with ts-relayer and channel-1 with hermes

@colin-axner
Copy link
Contributor

I managed to reproduce. The problem scenario is when the ts-relayer is also running. Specifically:

  • start ts-relayer
  • send packet
  • wait for ts-relayer to log that it has relayed the packet
  • start hermes

Then hermes will actually beat the ts-relayer to the acknowledgement process but get stuck on trying to relay the packet

Does hermes rely on the ibc-go error codes at all? We are planning on making the error numbers as apart of our API for versioning so we don't change them often and when we do it is well documented. We can turn the unordered channel packet already received into an error code so that hermes could stop retries. Would this help?

@ancazamfir
Copy link
Collaborator Author

Does hermes rely on the ibc-go error codes at all? We are planning on making the error numbers as apart of our API for versioning so we don't change them often and when we do it is well documented. We can turn the unordered channel packet already received into an error code so that hermes could stop retries. Would this help?

Thanks @colin-axner ! We are working on better error filtering and definitely having the error code here will help.

BTW, this also happens with two hermes relayers running. We haven't really started doing these types of tests heavily and understand the issues. But it's coming.

@colin-axner
Copy link
Contributor

opened a pr to update the error messages, also opened an issue on the spec repo

Please checkout the ibc-go pr and see if there is anything missing that'd be useful. The only scenario I could think of not covered is already timed out packets on ordered channels. This is tricky since by construction only 1 packet can be timed out at the moment (since the channel closes). Since ICS20 doesn't use ordered channels, I'd prefer to wait to fix until more than 1 packet can be timed out

@ancazamfir
Copy link
Collaborator Author

Opened #984 to check if the event has been previously handled by another relayer. This should reduce the number of retries to one. I tested with two hermes instances and the ft-transfer command.

@adizere adizere marked this pull request as ready for review August 12, 2021 11:06
@adizere adizere requested a review from romac as a code owner August 12, 2021 11:06
@adizere
Copy link
Member

adizere commented Aug 12, 2021

Some context on this PR: Even if we build Hermes with these new proto files (SDK 0.43 and ibc-go v1), the relayer should still be able to submit chain upgrade proposals and upgrade clients with 0.42-based chains (gaiad 5.0.5) for instance.

So merging this PR should not break any CLI and we should retain backwards compat with 0.42-based chains. We need to test for that.

Update: Romain's tests reminded me that my statement above was wrong. Issue #1209 documents that we'll need an explicit --legacy flag to maintain backwards compatibility when it comes to the chain upgrade CLI.

Another thing is that we should update compatibility.rs to mark 0.43 as a compat. version.

@romac
Copy link
Member

romac commented Aug 12, 2021

Running the following command using Hermes built from this branch and two v4.2.1 Gaia nodes setup via gm yields:

❯ hermes -c ~/.hermes/gm-config.toml tx raw upgrade-chain network1 network2 07-tendermint-0 10000000 3000

Aug 12 14:53:15.911  INFO Message UpgradePlanOptions { src_chain_config: ChainConfig { id: ChainId { id: "network2", version: 0 }, rpc_addr: Url { inner: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(27030), path: "/", query: None, fragment: None }, scheme: Http, host: "localhost", port: 27030 }, websocket_addr: Url { inner: Url { scheme: "ws", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(27030), path: "/websocket", query: None, fragment: None }, scheme: WebSocket, host: "localhost", port: 27030 }, grpc_addr: Url { inner: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(27032), path: "/", query: None, fragment: None }, scheme: Http, host: "localhost", port: 27032 }, rpc_timeout: 10s, account_prefix: "cosmos", key_name: "wallet", store_prefix: "ibc", max_gas: Some(500000), gas_adjustment: None, max_msg_num: MaxMsgNum(30), max_tx_size: MaxTxSize(2097152), clock_drift: 5s, trusting_period: 1209600s, trust_threshold: TrustThresholdFraction { numerator: 1, denominator: 3 }, gas_price: GasPrice { price: 0.001, denom: "stake" }, packet_filter: AllowAll }, dst_chain_config: ChainConfig { id: ChainId { id: "network1", version: 0 }, rpc_addr: Url { inner: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(27020), path: "/", query: None, fragment: None }, scheme: Http, host: "localhost", port: 27020 }, websocket_addr: Url { inner: Url { scheme: "ws", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(27020), path: "/websocket", query: None, fragment: None }, scheme: WebSocket, host: "localhost", port: 27020 }, grpc_addr: Url { inner: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(27022), path: "/", query: None, fragment: None }, scheme: Http, host: "localhost", port: 27022 }, rpc_timeout: 10s, account_prefix: "cosmos", key_name: "wallet", store_prefix: "ibc", max_gas: Some(500000), gas_adjustment: None, max_msg_num: MaxMsgNum(30), max_tx_size: MaxTxSize(2097152), clock_drift: 5s, trusting_period: 1209600s, trust_threshold: TrustThresholdFraction { numerator: 1, denominator: 3 }, gas_price: GasPrice { price: 0.001, denom: "stake" }, packet_filter: AllowAll }, src_client_id: ClientId("07-tendermint-0"), amount: 10000000, height_offset: 3000, upgraded_chain_id: ChainId { id: "network1", version: 0 }, upgraded_unbonding_period: None, upgrade_plan_name: "plan" }

Error:
   0: upgrade chain error
   1: tx response event consists of an error: deliver_tx on chain network1 for Tx hash 6FCF5B01B97296451F774BCD2DE8CEE47CA16E6F84CC3A6A5AE4F33249A1B05B reports error: code=Err(2), log=Log("unable to resolve type URL /ibc.core.client.v1.UpgradeProposal: tx parse error")

@romac
Copy link
Member

romac commented Aug 12, 2021

The issue is likely that

  • SDK 0.42 expects a /cosmos.upgrade.v1beta1.SoftwareUpgradeProposal message
  • SDK 0.43 expects a /ibc.core.client.v1.UpgradeProposal message

UPDATE: This is already tracked in #1209 and will be addressed in a follow-up PR.

@romac romac self-assigned this Aug 12, 2021
@hu55a1n1
Copy link
Member

I have tested this branch against all gaia versions v4.0.3 onwards, i.e. SDK version >=0.41.3. All E2E tests are passing.

This was referenced Aug 16, 2021
* Add legacy upgrade support

* Fix check for legacy

* Update .changelog

* Add TODO

* Apply suggestion

Co-authored-by: Adi Seredinschi <[email protected]>

Co-authored-by: Adi Seredinschi <[email protected]>
Copy link
Member

@adizere adizere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few ideas for improvements, none are blockers.


// TODO: These consts should move into the ICS27 namespace
pub const ICS27_BANK_SEND_TYPE_URL: &str = "/cosmos.bank.v1beta1.MsgSend";
pub const ICS27_SEND_TYPE_URL: &str = "/intertx.MsgSend";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI to share context: this is necessary for the Interchain Accounts module that @seantking is doing. Adding these lines is a temporary fix, so we'll need a permanent fix instead. Will open an issue for tracking that and detailing the problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later edit: these constants should be deleted with PR https://github.com/informalsystems/ibc-rs/pull/1172/files.

proto-compiler/README.md Show resolved Hide resolved
proto/src/prost/tendermint.crypto.rs Outdated Show resolved Hide resolved
proto/src/prost/tendermint.p2p.rs Outdated Show resolved Hide resolved
proto/src/prost/tendermint.version.rs Outdated Show resolved Hide resolved
proto/src/prost/tendermint.types.rs Outdated Show resolved Hide resolved
relayer/src/event/rpc.rs Show resolved Hide resolved
@hu55a1n1
Copy link
Member

hu55a1n1 commented Aug 18, 2021

Also ran the E2E tests on some heterogeneous setups ->

  • v4.0.3 <> colin-fee-event-testing (i.e. earliest v/s latest SDK versions supported)
  • v5.0.5 <> colin-fee-event-testing (latest release v/s latest supported)
  • v5.0.5 <> v4.0.3 (latest release v/s earliest supported)
  • v4.1.2 <> colin-fee-event-testing (possibly widely deployed)
  • v5.0.5 <> v5.0.2 (random)

All tests are passing. ✅

@romac romac mentioned this pull request Aug 18, 2021
10 tasks
@romac romac merged commit c4b6e30 into master Aug 19, 2021
@romac romac deleted the adi/ibc-go-1-proto branch August 19, 2021 13:26
hu55a1n1 added a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* Adapted proto compiler. Regenerated Rust files

* Adapt to newer namespace for apps.

* Manual fix for Staking erroneous compilation

* Workaround: disabled chain upgrade

* Added specific GRPC-web port to prevent conflict on 9091.

* Upgrade protos

* Add support for new message action strings

* Improved output for one-chain script

* CLI for chain upgrade proposal adapted to gaia v5.

* Re-generated proto files with updated proto-compiler (fmt enabled).

* Manual fix for staking::Validators erroneous compilation; added the .applications.transfer generated file

* Quick feature for parametrizing upgraded chain

* Clippy fix. Meta for params for better display.

* Adapted query_upgraded_client_state

* Adapted query_upgraded_consensus_state to ibc-go-v1

* Moved from gRPC to ABCI

* Adapted send_tx_simulate to new def of SimulateRequest

* Added parametrizable upgrade plan name

* Fix unwraps. Retain unbonding period if none specified.

* Missing post-merge bracket

* Removed register and send match arms for rpc events

* Support for new message.actions strings of ICS27

Based on discussion from
cosmos/cosmos-sdk#9139 (comment)
This is not yet tested!

* Update protos sdk(v0.43.0-rc2) & ibc-go(v1.0.0-rc3)

* Revert "Added specific GRPC-web port to prevent conflict on 9091."

This reverts commit abf6dba.

* Add missing fields in upgrade Plan

* Fix clippy warnings

* Added another action field to match intertx MsgSend

* Update protos sdk(v0.43.0) & ibc-go(v1.0.0)

* Update cosmos SDK module version requirement in compatibility.rs

* Add legacy upgrade support (informalsystems#1289)

* Add legacy upgrade support

* Fix check for legacy

* Update .changelog

* Add TODO

* Apply suggestion

Co-authored-by: Adi Seredinschi <[email protected]>

Co-authored-by: Adi Seredinschi <[email protected]>

* Apply suggestions

* Update .changelog

* Fix .changelog entry

Co-authored-by: Adi Seredinschi <[email protected]>
Co-authored-by: Shoaib Ahmed <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to SDK v0.43 Event parsing message.action preparation for new SDK version
5 participants