Skip to content

refactor: improve cctx error message for out of gas errrors when creating outbound#3709

Merged
lumtis merged 4 commits intodevelopfrom
cctx-error-message
Mar 18, 2025
Merged

refactor: improve cctx error message for out of gas errrors when creating outbound#3709
lumtis merged 4 commits intodevelopfrom
cctx-error-message

Conversation

@kingpinXD
Copy link
Member

@kingpinXD kingpinXD commented Mar 13, 2025

Description

Closes : #3696

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • Refactor
    • Enhanced error messages for outbound transactions and gas payment issues, providing clearer details on the required versus available amounts and specifying the affected chain.
    • Improved the overall feedback clarity during transaction failures to aid in troubleshooting.

@kingpinXD kingpinXD requested a review from a team as a code owner March 13, 2025 18:26
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2025

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

This pull request introduces a new "Refactor" section in the changelog and updates error messages across multiple keeper methods within the cross-chain module. The modifications include simplifying error outputs in both outbound transaction observers and gas payment functions by removing redundant log identifiers while adding contextual information (such as outbound chain ID and fee amounts). The corresponding test expectations have been updated accordingly, and an old logging method from the cross-chain transaction struct has been removed.

Changes

File(s) Change Summary
changelog.md Added a new "Refactor" section with an entry (PR 3709) for improving error messages related to outbound transactions.
x/crosschain/keeper/{cctx_utils.go, gas_payment.go, gas_payment_test.go} Updated error messages in SetObserverOutboundInfo and gas payment methods to include specific outbound chain ID and fee details; updated related test to expect types.ErrNotEnoughGas instead of types.ErrNotEnoughZetaBurnt.
x/crosschain/types/keys.go Removed the LogIdentifierForCCTX method from the CrossChainTx struct, eliminating unnecessary log identifier generation.

Suggested labels

bug, no-changelog, chain:evm, CONSENSUS_BREAKING_ACK

Suggested reviewers

  • swift1337
  • ws4charlie
  • skosito
  • gartnera

🪧 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.
  • @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.

@kingpinXD kingpinXD changed the title refactor: improve log messages for out of gas errors refactor: improve cctx error message for out of gas errrors when creating outbound Mar 13, 2025
@codecov
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.58%. Comparing base (dac4c89) to head (fe7d9ef).
Report is 7 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3709   +/-   ##
========================================
  Coverage    64.58%   64.58%           
========================================
  Files          469      469           
  Lines        32918    32924    +6     
========================================
+ Hits         21259    21265    +6     
  Misses       10694    10694           
  Partials       965      965           
Files with missing lines Coverage Δ
x/crosschain/keeper/cctx_utils.go 96.62% <100.00%> (ø)
x/crosschain/keeper/gas_payment.go 77.74% <100.00%> (+0.41%) ⬆️
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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: 0

🧹 Nitpick comments (1)
changelog.md (1)

9-9: Fix spelling error in changelog entry.

There's a typo in the word "errrors" which should be "errors".

-* [3709](https://github.com/zeta-chain/node/pull/3709) - improve cctx error message for out of gas errrors when creating outbound
+* [3709](https://github.com/zeta-chain/node/pull/3709) - improve cctx error message for out of gas errors when creating outbound
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 24290d1 and 1c8ecbe.

📒 Files selected for processing (5)
  • changelog.md (1 hunks)
  • x/crosschain/keeper/cctx_utils.go (2 hunks)
  • x/crosschain/keeper/gas_payment.go (4 hunks)
  • x/crosschain/keeper/gas_payment_test.go (1 hunks)
  • x/crosschain/types/keys.go (0 hunks)
💤 Files with no reviewable changes (1)
  • x/crosschain/types/keys.go
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.go`: Review the Go code, point out issues relative to ...

**/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

  • x/crosschain/keeper/cctx_utils.go
  • x/crosschain/keeper/gas_payment_test.go
  • x/crosschain/keeper/gas_payment.go
🔇 Additional comments (7)
x/crosschain/keeper/cctx_utils.go (2)

28-32: Improved error message clarity.

The simplified error message provides clearer, more focused information by including only the chain name rather than verbose identifiers.


37-40: Well-structured error message simplification.

This refactored error message follows the same pattern as the previous change, providing consistent error formatting throughout the codebase.

x/crosschain/keeper/gas_payment_test.go (1)

645-645: Updated test to match implementation's error type standardization.

The test now correctly expects types.ErrNotEnoughGas error, which aligns with the implementation changes that standardize error types across different gas payment methods.

x/crosschain/keeper/gas_payment.go (4)

137-142: Enhanced error context with specific transaction details.

The error message now provides comprehensive information about the failed transaction, including outbound chain ID and the specific amounts required vs. available. This significantly improves troubleshooting capabilities.


228-233: Improved error message specificity for ZRC20 transactions.

This enhanced error format follows the same pattern as other gas payment methods, providing consistent detailed information about the transaction failure context, particularly for ZRC20 tokens.


354-356: Simplified error message for GetMedianGasValues failures.

The error message is appropriately simplified while still retaining the essential chain ID information.


387-393: Standardized error message format for Zeta token gas payments.

Error now follows the same detailed format as other payment methods, creating a consistent error reporting pattern throughout the codebase. This change also properly consolidates errors under the more generic ErrNotEnoughGas type.

@kingpinXD kingpinXD added this pull request to the merge queue Mar 14, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 14, 2025
@github-actions github-actions bot added the MERGE_FAILED Merge Queue CI failed label Mar 14, 2025
@lumtis lumtis added this pull request to the merge queue Mar 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 17, 2025
@kingpinXD kingpinXD added this pull request to the merge queue Mar 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 18, 2025
@lumtis lumtis added the CONSENSUS_BREAKING_ACK Acknowledge a consensus breaking change label Mar 18, 2025
@lumtis lumtis added this pull request to the merge queue Mar 18, 2025
Merged via the queue into develop with commit c8648b5 Mar 18, 2025
53 checks passed
@lumtis lumtis deleted the cctx-error-message branch March 18, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CONSENSUS_BREAKING_ACK Acknowledge a consensus breaking change MERGE_FAILED Merge Queue CI failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cleaner cctx error message when not enough funds to pay for revert tx

3 participants