fix: add legacy messages back to codec
Description
- Add old field in
VoteGasPriceback in the message - Define pre-v19 messages back to add in codec
Closes: https://github.com/zeta-chain/node/issues/2835
Summary by CodeRabbit
-
New Features
- Introduced support for stateful precompiled contracts and enhancements for Bitcoin chain support, including multiple chains and testnet capabilities.
- Added staking precompiled contract with event emission and support for restricted addresses in Solana.
- Expanded cross-chain transaction message definitions with new fields for improved data capture.
-
Bug Fixes
- Improved outbound tracker functionality and fixed issues with Bitcoin transaction processing.
-
Tests
- Expanded end-to-end testing for new features, including staking precompiled contracts and Bitcoin deposit functionalities.
-
Documentation
- Updated changelog and message definitions to reflect recent changes and enhancements.
📝 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?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, 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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
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
@@ 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 | Coverage Δ | |
|---|---|---|
| x/crosschain/types/legacy_msgs.go | 0.00% <0.00%> (ø) |
@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?
@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/v20and 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
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":[]}
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.
This does seem to fix
MsgVoteGasPrice(looked at block6325419right before the v19 upgrade on Athens) butMsgGasPriceVoterfrom block4667204does 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
@skosito @fbac please check back