feat(`cast`): add option to use local source code for `--debug` and `--decode-internal`
Component
Cast
Describe the feature you would like
If I'm not mistaken, cast currently only uses Etherscan sources when using cast run with the --debug or --decode-internal arguments. It would be great to be able to pass the path of a local foundry project to use its sources.
Additional context
No response
Somehow linked to this: would be great to have --flamechart for cast run as well
Also looking for this support in some way. We are dealing with private contracts with non-published sources that emit custom errors and make calls to other private library functions. We would like to be able to see the decoded data where possible when using cast run.
As there is not a clear relationship between a contract and its source for contract addresses without a published source, would it be possible to add a flag to provide a mapping from contract address to a local contract name, similar to the current --label syntax, and potentially look in the broadcasts directory to pre-populate these entries? Worst case scenario the contract has changed name or ABI, in this case a matching signature cannot be found, and that call/error is not decoded.
I understand the above might not be as easy to validate for the --debug case as you need to be sure the contract has not changed since deployment and that you are aware of the constructor arguments, but it should solve the decoding issues for traces with/without the --decode-internal flag as these only need to match in the ABI signatures?