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

fix(zetacore): bring back reserved fields as deprecated #3297

Merged
merged 5 commits into from
Dec 16, 2024

Conversation

swift1337
Copy link
Contributor

@swift1337 swift1337 commented Dec 16, 2024

Cosmos SDK's proto decoder explicitly fails to decode fields marked as "reserved." This PR reinstates legacy fields as deprecated. Deprecated fields should also be excluded from JSON and YAML encoders

Closes #3280

Summary by CodeRabbit

  • New Features

    • Added a new boolean property proved to the OpenAPI specifications.
    • Enhanced tracking capabilities for cross-chain transactions with new fields in the MsgAddOutboundTracker and MsgAddInboundTracker messages, including proof and indexing information.
  • Bug Fixes

    • Deprecated previous fields in the TxHash, MsgAddOutboundTracker, and MsgAddInboundTracker messages to improve clarity and functionality.
  • Documentation

    • Updated documentation to reflect changes in message definitions and new properties.

@swift1337 swift1337 self-assigned this Dec 16, 2024
Copy link
Contributor

coderabbitai bot commented Dec 16, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request introduces modifications to cross-chain transaction tracking mechanisms, focusing on enhancing proof and transaction metadata handling. The changes primarily involve updating protocol buffer message definitions across multiple files, adding new fields for proof tracking, and deprecating certain existing fields. The modifications aim to improve the robustness of transaction verification and indexing processes.

Changes

File Change Summary
docs/openapi/openapi.swagger.yaml Added new proved boolean property in definitions
docs/spec/crosschain/messages.md Updated MsgAddOutboundTracker and MsgAddInboundTracker with new proof and indexing fields
proto/zetachain/zetacore/crosschain/outbound_tracker.proto Added proved boolean field, deprecated proven field
proto/zetachain/zetacore/crosschain/tx.proto Added deprecated fields for proof, block hash, and transaction index in tracker messages

Assessment against linked issues

Objective Addressed Explanation
Resolve Cosmos SDK HTTP API transaction hash query error [#3280]

Possibly related PRs

Suggested reviewers

  • fbac
  • kingpinXD
  • skosito
  • ws4charlie
  • lumtis

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
🪧 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 @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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 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.

@swift1337 swift1337 added no-changelog Skip changelog CI check and removed breaking:proto labels Dec 16, 2024
@swift1337 swift1337 marked this pull request as ready for review December 16, 2024 13:06
@swift1337 swift1337 requested a review from a team as a code owner December 16, 2024 13:06
@swift1337 swift1337 added the UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light label Dec 16, 2024
Copy link

gitguardian bot commented Dec 16, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
14567965 Triggered Generic Password c0c8076 cmd/zetaclientd/start.go View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Copy link
Contributor

@kingpinXD kingpinXD left a comment

Choose a reason for hiding this comment

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

lgtm ,
Is there any way to test this before merging ?

We can maybe try putting this binary on a rpc node , and they trying to run the query and see if it works ?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/spec/crosschain/messages.md (1)

15-17: Fix indentation: Replace tabs with spaces.

The message definitions use hard tabs. For better markdown compatibility and consistency, replace tabs with spaces.

Apply this formatting change:

-	pkg.proofs.Proof proof = 5;
-	string block_hash = 6;
-	int64 tx_index = 7;
+    pkg.proofs.Proof proof = 5;
+    string block_hash = 6;
+    int64 tx_index = 7;

Also applies to: 31-33

🧰 Tools
🪛 Markdownlint (0.37.0)

15-15: Column: 1
Hard tabs

(MD010, no-hard-tabs)


16-16: Column: 1
Hard tabs

(MD010, no-hard-tabs)


17-17: Column: 1
Hard tabs

(MD010, no-hard-tabs)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8710921 and c0c8076.

⛔ Files ignored due to path filters (4)
  • typescript/zetachain/zetacore/crosschain/outbound_tracker_pb.d.ts is excluded by !**/*_pb.d.ts
  • typescript/zetachain/zetacore/crosschain/tx_pb.d.ts is excluded by !**/*_pb.d.ts
  • x/crosschain/types/outbound_tracker.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • x/crosschain/types/tx.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
📒 Files selected for processing (4)
  • docs/openapi/openapi.swagger.yaml (1 hunks)
  • docs/spec/crosschain/messages.md (2 hunks)
  • proto/zetachain/zetacore/crosschain/outbound_tracker.proto (1 hunks)
  • proto/zetachain/zetacore/crosschain/tx.proto (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
proto/zetachain/zetacore/crosschain/outbound_tracker.proto (1)

Pattern **/*.proto: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.

proto/zetachain/zetacore/crosschain/tx.proto (1)

Pattern **/*.proto: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.

🪛 buf (1.47.2)
proto/zetachain/zetacore/crosschain/outbound_tracker.proto

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

🪛 Markdownlint (0.37.0)
docs/spec/crosschain/messages.md

15-15: Column: 1
Hard tabs

(MD010, no-hard-tabs)


16-16: Column: 1
Hard tabs

(MD010, no-hard-tabs)


17-17: Column: 1
Hard tabs

(MD010, no-hard-tabs)


31-31: Column: 1
Hard tabs

(MD010, no-hard-tabs)


32-32: Column: 1
Hard tabs

(MD010, no-hard-tabs)


33-33: Column: 1
Hard tabs

(MD010, no-hard-tabs)

🔇 Additional comments (5)
proto/zetachain/zetacore/crosschain/outbound_tracker.proto (2)

11-15: LGTM: Proper deprecation of the proved field.

The field is correctly marked as deprecated and excluded from JSON/YAML serialization, which aligns with the PR objective of maintaining proto decoder compatibility while preventing active usage.


4-4: ⚠️ Potential issue

Fix the import path for gogoproto.

The import "gogoproto/gogo.proto" needs to be properly configured in your build system. Ensure the proto path includes the gogoproto package.

🧰 Tools
🪛 buf (1.47.2)

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

proto/zetachain/zetacore/crosschain/tx.proto (2)

69-83: LGTM: Consistent deprecation pattern for proof-related fields.

The fields are properly marked as deprecated and excluded from serialization, maintaining backward compatibility while preventing active usage.


109-123: LGTM: Consistent implementation with MsgAddInboundTracker.

The deprecation pattern matches the inbound tracker implementation, ensuring a uniform approach across the codebase.

docs/spec/crosschain/messages.md (1)

15-17: LGTM: Documentation accurately reflects proto changes.

The message definitions in the documentation correctly reflect the changes made to the protocol buffer files, maintaining consistency between implementation and documentation.

Also applies to: 31-33

🧰 Tools
🪛 Markdownlint (0.37.0)

15-15: Column: 1
Hard tabs

(MD010, no-hard-tabs)


16-16: Column: 1
Hard tabs

(MD010, no-hard-tabs)


17-17: Column: 1
Hard tabs

(MD010, no-hard-tabs)

docs/openapi/openapi.swagger.yaml Outdated Show resolved Hide resolved
@swift1337
Copy link
Contributor Author

swift1337 commented Dec 16, 2024

@kingpinXD @fadeev @CharlieMc0 fixed. However, due to gogoproto that used for proto2json marshalling, we can't hide those deprecated fields from json/yaml responded.

zetacored q tx 6C86B759289ACB1BE2EEC35619B7F9227EC4AF4AC235BC70F366C1DCDF76539A --node=https://zetachain-mainnet.g.allthatnode.com:443/archive/tendermint -o json | jq
{
  "height": "6057922",
  "txhash": "6C86B759289ACB1BE2EEC35619B7F9227EC4AF4AC235BC70F366C1DCDF76539A",
  "codespace": "",
  "code": 0,
  "data": "122B0A252F636F736D6F732E617574687A2E763162657461312E4D736745786563526573706F6E736512020A00",
  "raw_log": "[{\"msg_index\":0,\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"/cosmos.authz.v1beta1.MsgExec\"},{\"key\":\"sender\",\"value\":\"zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k\"},{\"key\":\"module\",\"value\":\"authz\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "/cosmos.authz.v1beta1.MsgExec"
            },
            {
              "key": "sender",
              "value": "zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k"
            },
            {
              "key": "module",
              "value": "authz"
            }
          ]
        }
      ]
    }
  ],
  "info": "",
  "gas_wanted": "200000",
  "gas_used": "104673",
  "tx": {
    "@type": "/cosmos.tx.v1beta1.Tx",
    "body": {
      "messages": [
        {
          "@type": "/cosmos.authz.v1beta1.MsgExec",
          "grantee": "zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k",
          "msgs": [
            {
              "@type": "/zetachain.zetacore.crosschain.MsgAddOutboundTracker",
              "creator": "zeta19jr7nl82lrktge35f52x9g5y5prmvchmk40zhg",
              "chain_id": "1",
              "nonce": "46275",
              "tx_hash": "0x878345cdd31740ce8c14c0638b66873911be39889afe654e3301dc47dcf1717b",
              "proof": null,
              "block_hash": "",
              "tx_index": "-1"
            }
          ]
        }
      ],
      "memo": "",
      "timeout_height": "0",
      "extension_options": [],
      "non_critical_extension_options": []
    },
    "auth_info": {
      "signer_infos": [
        {
          "public_key": {
            "@type": "/ethermint.crypto.v1.ethsecp256k1.PubKey",
            "key": "A7JcN5KwyoI7U+WkuklFZZE//e9GiWow5IuFRaMoTUlr"
          },
          "mode_info": {
            "single": {
              "mode": "SIGN_MODE_DIRECT"
            }
          },
          "sequence": "255890"
        }
      ],
      "fee": {
        "amount": [
          {
            "denom": "azeta",
            "amount": "30000000000000"
          }
        ],
        "gas_limit": "200000",
        "payer": "",
        "granter": ""
      },
      "tip": null
    },
    "signatures": [
      "qlf6++n0CyhLTULG358j1JEm7WCsRf0FRevDU5hwhEcpAZ+Z9occNa1ASGrBNVJvla30fqRc73LbjULTB43IggE="
    ]
  },
  "timestamp": "2024-12-07T14:56:47Z",
  "events": [
    {
      "type": "coin_spent",
      "attributes": [
        {
          "key": "spender",
          "value": "zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k",
          "index": true
        },
        {
          "key": "amount",
          "value": "30000000000000azeta",
          "index": true
        }
      ]
    },
    {
      "type": "coin_received",
      "attributes": [
        {
          "key": "receiver",
          "value": "zeta17xpfvakm2amg962yls6f84z3kell8c5lxad43d",
          "index": true
        },
        {
          "key": "amount",
          "value": "30000000000000azeta",
          "index": true
        }
      ]
    },
    {
      "type": "transfer",
      "attributes": [
        {
          "key": "recipient",
          "value": "zeta17xpfvakm2amg962yls6f84z3kell8c5lxad43d",
          "index": true
        },
        {
          "key": "sender",
          "value": "zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k",
          "index": true
        },
        {
          "key": "amount",
          "value": "30000000000000azeta",
          "index": true
        }
      ]
    },
    {
      "type": "message",
      "attributes": [
        {
          "key": "sender",
          "value": "zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k",
          "index": true
        }
      ]
    },
    {
      "type": "tx",
      "attributes": [
        {
          "key": "fee",
          "value": "30000000000000azeta",
          "index": true
        },
        {
          "key": "fee_payer",
          "value": "zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k",
          "index": true
        }
      ]
    },
    {
      "type": "tx",
      "attributes": [
        {
          "key": "acc_seq",
          "value": "zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k/255890",
          "index": true
        }
      ]
    },
    {
      "type": "tx",
      "attributes": [
        {
          "key": "signature",
          "value": "qlf6++n0CyhLTULG358j1JEm7WCsRf0FRevDU5hwhEcpAZ+Z9occNa1ASGrBNVJvla30fqRc73LbjULTB43IggE=",
          "index": true
        }
      ]
    },
    {
      "type": "message",
      "attributes": [
        {
          "key": "action",
          "value": "/cosmos.authz.v1beta1.MsgExec",
          "index": true
        },
        {
          "key": "sender",
          "value": "zeta15l7fehe8azkmj6979ln7e74dkvl0ypledqje7k",
          "index": true
        },
        {
          "key": "module",
          "value": "authz",
          "index": true
        }
      ]
    }
  ]
}

@kingpinXD
Copy link
Contributor

Thanks , verfied that the tx can be quired with the new binary , and also that the tx cannot be queried with the older one .

@swift1337 swift1337 enabled auto-merge December 16, 2024 14:26
@swift1337 swift1337 added this pull request to the merge queue Dec 16, 2024
Merged via the queue into develop with commit 15b5d42 Dec 16, 2024
45 of 46 checks passed
@swift1337 swift1337 deleted the fix/legacy-proto branch December 16, 2024 15:02
swift1337 added a commit that referenced this pull request Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:proto no-changelog Skip changelog CI check UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cosmos SDK HTTP API returns error when querying for a transaction hash
3 participants