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

Display contract names in UI #1181

Merged
merged 1 commit into from Jan 26, 2024
Merged

Display contract names in UI #1181

merged 1 commit into from Jan 26, 2024

Conversation

arcz
Copy link
Member

@arcz arcz commented Jan 25, 2024

Closes #415, #783, #567.

Summary by CodeRabbit

  • New Features
    • Enhanced campaign printing logic with additional virtual machine context.
    • Improved reporting capabilities with contract name retrieval based on address.
  • Refactor
    • Updated function signatures across UI components to support an additional parameter for virtual machine context, enhancing the application's internal logic and user interface responsiveness.

Copy link

coderabbitai bot commented Jan 26, 2024

Walkthrough

The recent updates to the Echidna tool, a security tool for Ethereum smart contracts, focus on enhancing its UI and reporting features to accommodate the analysis of multiple contracts. By introducing additional parameters to function signatures across several modules, the changes aim to improve the visibility of contract names in both the UI and JSON reports, directly addressing user feedback for clearer identification of contract interactions.

Changes

File(s) Summary of Changes
lib/Echidna/UI.hs Modified ui to include vm argument in ppCampaign calls.
lib/Echidna/UI/Report.hs Added imports, modified functions to accept VM RealWorld, added contractNameForAddr.
lib/Echidna/UI/Widgets.hs Modified failWidget and maxWidget to pass VM RealWorld to seqWidget.

Assessment against linked issues

Objective Addressed Explanation
Add contract names to UI and JSON (#415)

Poem

In the realm of code, where contracts intertwine,
A rabbit hopped, making the UI shine.
With names displayed, clarity we find,
Echidna evolves, leaving confusion behind. 🐇💻✨

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 09b8644 and 01c7227.
Files selected for processing (3)
  • lib/Echidna/UI.hs (2 hunks)
  • lib/Echidna/UI/Report.hs (7 hunks)
  • lib/Echidna/UI/Widgets.hs (3 hunks)
Additional comments: 15
lib/Echidna/UI/Report.hs (10)
  • 14-14: The addition of the Optics import is necessary for the new functionality to work with optics in Haskell, which is a common pattern for dealing with nested data structures.
  • 18-18: The addition of the Echidna.SourceMapping module import is required for the new functionality that involves source mapping, specifically for fetching contract names based on addresses.
  • 38-38: The modification of the ppCampaign function signature to include an additional VM RealWorld parameter is crucial for accessing the VM state, which is necessary for retrieving contract names based on addresses.
  • 56-56: The modification of the ppTx function signature to accept an additional VM RealWorld parameter is necessary for the function to access the VM state, enabling it to retrieve contract names for transactions.
  • 73-82: The addition of the contractNameForAddr function is a key enhancement. It retrieves the contract name for a given address, which is central to the PR's objective of displaying contract names in the UI. This function correctly handles the possibility of not finding a contract name by falling back to displaying the address itself, which is a good practice for maintaining usability in case of missing data.
  • 104-104: The modification of the ppGasInfo function signature to include an additional VM RealWorld parameter is necessary for the function to access the VM state, which might be required for future enhancements related to gas information display that involves contract names.
  • 111-111: The modification of the ppGasOne function signature to include an additional VM RealWorld parameter is consistent with the changes made to other functions in this file, allowing it to potentially access VM state for enhanced display information.
  • 125-125: The modification of the ppFail function signature to include an additional VM RealWorld parameter aligns with the overall goal of enhancing the UI to display contract names, allowing this function to access VM state if needed for failure analysis.
  • 142-142: The modification of the ppFailWithTraces function signature to include an additional VM RealWorld parameter is necessary for accessing VM state during the display of failure traces, which may include contract names for a more informative output.
  • 176-176: The modification of the ppOptimized function signature to include an additional VM RealWorld parameter is consistent with the changes made to other functions, allowing it to access VM state for potentially enhanced display information related to optimized tests.
lib/Echidna/UI.hs (2)
  • 152-152: The update to the ppCampaign function call to include the vm argument is necessary for passing the VM state to the function. This change is crucial for enabling the display of contract names in the UI, aligning with the PR's objectives.
  • 206-206: The update to the ppCampaign function call to include the vm argument in the non-interactive output format case is consistent with the changes made for the interactive UI. This ensures that contract names can be displayed in all output formats, enhancing usability.
lib/Echidna/UI/Widgets.hs (3)
  • 315-315: The update to the seqWidget function call within the failWidget function to pass the vm parameter is necessary for the function to access the VM state. This change enables the display of contract names in the failure widget, improving the information provided to the user.
  • 352-352: The update to the seqWidget function call within the maxWidget function to pass the vm parameter is consistent with the changes made in the failWidget function. This ensures that the VM state is accessible for displaying contract names in the optimization widget, enhancing clarity for the user.
  • 365-368: The modification of the seqWidget function to include an additional VM RealWorld parameter is crucial for the function to access the VM state. This change allows for the potential display of contract names within the sequence widget, aligning with the PR's objectives to enhance UI clarity by displaying contract names.

@arcz arcz merged commit 1d0c937 into master Jan 26, 2024
18 checks passed
@arcz arcz deleted the display-contract-names branch January 26, 2024 18:22
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.

Add contract names to UI and JSON
1 participant