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

feat: improve evm verify error status #1252

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

evilpeach
Copy link
Collaborator

@evilpeach evilpeach commented Feb 26, 2025

Test cases

  • Small ⇒ 0x6cba246d41d76d74Bbe55Ce945c09E983aE8cC4f
  • Constructor mistmatch + Large bytecode ⇒ 0x4d2eB6950ed3D3F822c48f4E4F57D08398183a04
  • Compiler error ⇒ 0x43BC98e07e5d1C97a90d8326eEE749a35141643E

Summary by CodeRabbit

  • Documentation

    • Updated changelog to document enhanced error details.
  • New Features

    • Introduced a configurable display for text content, allowing adjustable visible lines.
    • Rolled out an improved error display for verification issues, providing a clear breakdown of messages and associated details.
  • Refactor

    • Streamlined error handling logic for clearer differentiation between error and non-error states.
  • Style

    • Refined alert spacing for a cleaner, more consistent presentation.

Copy link

vercel bot commented Feb 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
celatone-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2025 3:55am
initia-celatone-rehearsal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2025 3:55am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
celatone-frontend-main ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 3:55am
initia-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 3:55am
neutron-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 3:55am
osmosis-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 3:55am
sei-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 3:55am
terra-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 3:55am

Copy link

coderabbitai bot commented Feb 26, 2025

Walkthrough

This pull request introduces multiple updates across the project. The documentation is updated with a new changelog entry referencing improved EVM error details. In the UI layer, the TextReadOnly component now supports a showLines property for dynamic line display adjustments. Changes in the EVM verification modal components refine error handling by replacing the old EvmVerifyAlert with a new EvmVerifyFailed component and adjusting the error message retrieval logic. Additionally, new types and constants are added to better structure and validate EVM verification errors.

Changes

File(s) Change Summary
CHANGELOG.md Added a new entry in the "Improvements" section referencing PR #1252 to document enhanced error details for EVM verification.
src/lib/components/json/TextReadOnly.tsx Introduced a new optional prop showLines in the TextReadOnlyProps interface; updated the component to use showLines for setting AceEditor's maxLines (with fallback to Infinity) and added minLines using the same value.
src/lib/components/modal/evm-verify-status/... Removed the mb prop from EvmVerifyAlert; added a new EvmVerifyFailed component to render dynamic error details; modified EvmVerifyStatusModal to check for an error in evmVerifyInfo and render either EvmVerifyFailed or the process component; updated getProcessSteps in utils to use optional chaining.
src/lib/types/evm.ts Added new constants zCompiledResults and zEvmVerifyError to define structured error types; updated the error_message field in zEvmVerifyInfo to use the new structured type and added a transformation step to extract an error field.

Possibly related PRs

Suggested reviewers

  • songwongtp

Poem

I’m a little rabbit, hopping through the code,
Nibbling at changes in each humble node,
With EVM errors now neatly in sight,
I hop and I skip in coding delight,
Carrots and code, a joyful mix we share!
🐰✨
Happy hops and happy commits, everywhere!

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/lib/components/modal/evm-verify-status/EvmVerifyFailed.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-import".

(The package "eslint-plugin-import" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-import@latest --save-dev

The plugin "eslint-plugin-import" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3107a83 and de3a92c.

📒 Files selected for processing (1)
  • src/lib/components/modal/evm-verify-status/EvmVerifyFailed.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/components/modal/evm-verify-status/EvmVerifyFailed.tsx

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link

@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)
src/lib/components/modal/evm-verify-status/EvmVerifyFailed.tsx (1)

21-46: Detailed bytecode comparison for verification failures.

This implementation effectively compares expected vs. submitted bytecode when the verification fails, making it easier for developers to troubleshoot issues. The showLines parameter is appropriately used to control the display height for each section.

One improvement would be to consider highlighting the differences between expected and submitted bytecode for easier identification.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 138ff1d and 3107a83.

📒 Files selected for processing (7)
  • CHANGELOG.md (1 hunks)
  • src/lib/components/json/TextReadOnly.tsx (2 hunks)
  • src/lib/components/modal/evm-verify-status/EvmVerifyAlert.tsx (1 hunks)
  • src/lib/components/modal/evm-verify-status/EvmVerifyFailed.tsx (1 hunks)
  • src/lib/components/modal/evm-verify-status/index.tsx (2 hunks)
  • src/lib/components/modal/evm-verify-status/utils.ts (1 hunks)
  • src/lib/types/evm.ts (3 hunks)
✅ Files skipped from review due to trivial changes (2)
  • CHANGELOG.md
  • src/lib/components/modal/evm-verify-status/EvmVerifyAlert.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (12)
src/lib/components/modal/evm-verify-status/utils.ts (2)

54-56: Good update to error handling pattern.

The change from directly accessing errorMessage to using optional chaining with error?.message is a more robust approach to handling potential undefined values. This matches the updated error structure introduced elsewhere in the PR.


61-63: Consistent error handling pattern applied correctly.

Using the same optional chaining pattern here ensures consistent error handling throughout the function. This approach safely accesses the error message property, avoiding potential runtime errors.

src/lib/components/json/TextReadOnly.tsx (3)

13-17: Enhanced component flexibility with showLines parameter.

Adding the optional showLines parameter improves the component's reusability by allowing consumers to control the display height.


19-23: Correct function signature update.

The component's function signature has been properly updated to include the new showLines prop.


62-64: Properly implemented height control with null coalescing.

The implementation correctly uses the null coalescing operator to provide a default value of Infinity when showLines is not specified. Setting both maxLines and minLines ensures consistent height control.

src/lib/components/modal/evm-verify-status/EvmVerifyFailed.tsx (2)

1-9: Good component structure with proper typing.

The imports and interface definition are clean and well-organized. The EvmVerifyFailedProps interface clearly defines the expected props with correct typing.


11-21: Well-implemented error display for compiler warnings.

The component correctly handles the case where error details are provided as a string, displaying them as compiler warnings with an appropriate label. The showLines={10} parameter helps control the display height for better user experience.

src/lib/components/modal/evm-verify-status/index.tsx (2)

16-17: Correct import update for new error handling approach.

The import statement has been properly updated to use the new EvmVerifyFailed component instead of the old EvmVerifyAlert.


58-67: Improved conditional rendering logic for error states.

The updated conditional rendering pattern:

  1. First checks if evmVerifyInfo exists
  2. Then checks if an error is present within evmVerifyInfo
  3. Renders appropriate UI based on these conditions

This approach is more explicit and readable than the previous implementation, making the error handling flow clearer.

src/lib/types/evm.ts (3)

264-266: Well-structured schema for compiled results.

The new zCompiledResults schema provides a clear and consistent structure for representing EVM compilation results, which will be useful for error handling.


268-287: Good improvement to error handling structure.

The introduction of the zEvmVerifyError type significantly enhances error handling by providing a structured format with code, message, and detailed information. This will make it easier to display meaningful error messages to users when EVM verification fails.

The JSON preprocessing and union type for the details field offers flexibility while maintaining type safety.


307-307: Successful integration of the new error structure.

Updating the error_message field to use the new zEvmVerifyError type and adding the error field to the transformation result creates a consistent approach to error handling throughout the application. This change aligns well with the PR objective to improve EVM verification error status reporting.

Also applies to: 318-318

@songwongtp songwongtp merged commit 815af3a into develop Feb 27, 2025
14 checks passed
@songwongtp songwongtp deleted the feat/improve-evm-verify-error branch February 27, 2025 04:45
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.

3 participants