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(cast): trace and debug on local contracts #6887

Closed
wants to merge 1 commit into from

Conversation

fnerdman
Copy link

Motivation

Using cast run and cast call to trace and debug can currently only fetch abi and source from explorers such as etherscan. In situations where no explorer is available, it would be intuitive to use the abi and source provided by the local files.

Solution

As with forge debug - using local files is preferred over fetching data from remote explorer. Only if etherscan_api_key is defined, will we fetch abi and source from the explorer.
Without explorer it will now compile solidity files and fetch contract bytecode from build output. To identify contract addresses it fetches on chain bytecode via RPC call. Most of the required code change happens in handle_traces, where the decoder and debugger is fed with the required data fetched from local files (and RPC).

Unresolved issues

  • Debugging on inherited contracts does not resolve to the respective source code.
  • Can we use existing build artifacts instead of running the builder each time? This also solves the problem where the building source requires additional parameters.

@Ruteri
Copy link

Ruteri commented Jan 23, 2024

Related issues: #5435, #5410, #4440, #3498

@emo-eth
Copy link
Contributor

emo-eth commented Feb 9, 2024

#7058 should fix inherited sourcemaps 🫡

@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 31, 2024
@zerosnacks zerosnacks added C-cast Command: cast A-tracing Area: tracing T-feature Type: feature labels Jul 31, 2024
@zerosnacks
Copy link
Member

Hi @fnerdman thanks for your PR! Are there any blockers currently preventing this from marking it ready for review? Would be great to get this in.

@fnerdman
Copy link
Author

fnerdman commented Aug 1, 2024

@zerosnacks while it definitely would be nice to have this, my focus has moved on and I don't have the time to get this cleaned up. Happy though if someone else pulls the changes and takes the lead.

@zerosnacks
Copy link
Member

No problem! Thanks for your contribution. I've opened a ticket here: #8581 matching the description and goal of the PR so it can be picked up in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tracing Area: tracing C-cast Command: cast T-feature Type: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants