zeta-chain / node

ZetaChain’s blockchain node and an observer validator client
https://zetachain.com
MIT License
168 stars 108 forks source link

fix: add legacy messages back to codec #2909

Closed lumtis closed 1 month ago

lumtis commented 1 month ago

Description

Closes: https://github.com/zeta-chain/node/issues/2835

Summary by CodeRabbit

coderabbitai[bot] commented 1 month ago
📝 Walkthrough ## Walkthrough The pull request introduces significant updates across multiple files, focusing on enhancements to message definitions and functionality for cross-chain transactions. Key changes include the addition of new message types, modifications to existing message structures, and updates to the codec registration for backward compatibility. The changelog reflects the introduction of features such as stateful precompiled contracts and improvements to Bitcoin chain support. Additionally, there are refactoring efforts to clean up code and expand testing coverage for newly added functionalities. ## Changes | File Path | Change Summary | |------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| | changelog.md | Updated to reflect new features, refactoring, tests, and fixes across versions, including staking and Bitcoin support. | | docs/spec/crosschain/messages.md | Added new fields to `MsgVoteGasPrice`, `MsgVoteOutbound`, and `MsgVoteInbound` messages. | | proto/zetachain/zetacore/crosschain/legacy_msgs.proto | Introduced new messages for outbound and inbound transaction tracking, and gas price voting for legacy compatibility. | | proto/zetachain/zetacore/crosschain/tx.proto | Updated `MsgVoteGasPrice` to mark `supply` field as unused. | | typescript/zetachain/zetacore/crosschain/index.d.ts | Added export for `legacy_msgs_pb` to enhance public API. | | x/crosschain/types/codec.go | Registered new message types for backward compatibility in codec functions. | | x/crosschain/types/legacy_msgs.go | Implemented several message types that follow the `sdk.Msg` interface for transaction handling. | ## Assessment against linked issues | Objective | Addressed | Explanation | |-----------------------------------------------------------------------|-----------|--------------------------------------| | Unknown field errors when querying pre-v19 height cosmos transactions ( #2835 ) | ✅ | | ## Possibly related PRs - **#2795**: Adds support for restricted addresses in Solana, relevant to multi-chain enhancements. - **#2870**: Introduces support for multiple Bitcoin chain configurations, aligning with Bitcoin functionality updates. - **#2907**: Adds functionality for deriving Bitcoin TSS addresses by chain ID, directly related to Bitcoin support updates. - **#2957**: Focuses on parsing Bitcoin deposit memos with inscriptions, relevant to Bitcoin functionality improvements. ## Suggested labels `no-changelog` ## Suggested reviewers - fbac - kingpinXD - skosito - brewmaster012 - swift1337 - ws4charlie

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 84 lines in your changes missing coverage. Please review.

Project coverage is 65.80%. Comparing base (404bd96) to head (d919a0f). Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
x/crosschain/types/legacy_msgs.go 0.00% 84 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/zeta-chain/node/pull/2909/graphs/tree.svg?width=650&height=150&src=pr&token=JABAIMO8MP&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain)](https://app.codecov.io/gh/zeta-chain/node/pull/2909?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain) ```diff @@ Coverage Diff @@ ## develop #2909 +/- ## =========================================== - Coverage 66.05% 65.80% -0.25% =========================================== Files 397 398 +1 Lines 22313 22397 +84 =========================================== Hits 14739 14739 - Misses 6806 6890 +84 Partials 768 768 ``` | [Files with missing lines](https://app.codecov.io/gh/zeta-chain/node/pull/2909?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain) | Coverage Δ | | |---|---|---| | [x/crosschain/types/legacy\_msgs.go](https://app.codecov.io/gh/zeta-chain/node/pull/2909?src=pr&el=tree&filepath=x%2Fcrosschain%2Ftypes%2Flegacy_msgs.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain#diff-eC9jcm9zc2NoYWluL3R5cGVzL2xlZ2FjeV9tc2dzLmdv) | `0.00% <0.00%> (ø)` | |
CryptoFewka commented 1 month ago

@kingpinXD & @lumtis,

I've set up a basic Athens full node from a v19 snapshot, and ran it to the v20 upgrade. At the v20 upgrade height, I used a binary built from https://github.com/zeta-chain/node/tree/v20-restore-old-messages. That branch was based on release/v20 and I cherry picked in the commits from https://github.com/zeta-chain/node/pull/2909.

The v20 flavor of the binary I produced runs, though the node only has blocks from 6711001 onward, which is after the v19 upgrade and presumably is missing knowledge of the blocks which contains the messages we need to test.

If needed, we can run this v20 binary with a copy of an archive node's data.

Were there any messages present in v19 but not v20 that could be used to test?

lumtis commented 1 month ago

@kingpinXD & @lumtis,

I've set up a basic Athens full node from a v19 snapshot, and ran it to the v20 upgrade. At the v20 upgrade height, I used a binary built from https://github.com/zeta-chain/node/tree/v20-restore-old-messages. That branch was based on release/v20 and I cherry picked in the commits from #2909.

The v20 flavor of the binary I produced runs, though the node only has blocks from 6711001 onward, which is after the v19 upgrade and presumably is missing knowledge of the blocks which contains the messages we need to test.

If needed, we can run this v20 binary with a copy of an archive node's data.

Were there any messages present in v19 but not v20 that could be used to test?

The test would be the same as on the initial issue https://github.com/zeta-chain/node/issues/2835

This PR should solve the error encountered during the query but it is on mainnnet.

If needed I can look into having an example to test with Athens3

CryptoFewka commented 1 month ago

The same query provided in the issue also fails when pointed at an Athens testnet archive node. It returns this response:

{"code":2,"message":"codespace sdk code 2: tx parse error: unable to resolve type URL /zetachain.zetacore.crosschain.MsgGasPriceVoter","details":[]}
CryptoFewka commented 1 month ago

This does seem to fix MsgVoteGasPrice (looked at block 6325419 right before the v19 upgrade on Athens) but MsgGasPriceVoter from block 4667204 does not work. I would expect the same to be true for Mainnet blocks created on a pre-v16 network.

lumtis commented 1 month ago

This does seem to fix MsgVoteGasPrice (looked at block 6325419 right before the v19 upgrade on Athens) but MsgGasPriceVoter from block 4667204 does not work. I would expect the same to be true for Mainnet blocks created on a pre-v16 network.

Ok, wanted to check with the initial query of the issue first. MsgGasPriceVoter was also missing, added it here, if we can check again the query with the new version of the binary would be great!

I checked the previous breaking changes, we should not have other message used frequently that should have this compatibility issue

lumtis commented 1 month ago

@skosito @fbac please check back