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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
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 🫡

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.

None yet

3 participants