foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Display checksummed addresses in traces

Open tynes opened this issue 3 years ago • 3 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (64fe4ac 2022-08-05T17:02:41.636625562Z)

What command(s) is the bug in?

forge test -vvvv

Operating System

Linux

Describe the bug

It would be ideal if the addresses displayed in the traces were checksummed. A common workflow that I have is to fuzz something and if it fails and I need to debug, I will copy the arguments from the trace and use them directly in the test itself, commenting out the arguments to the fuzz test so that it becomes a normal test. Any time that I do this with an address, I need to checksum the address myself so that the solidity will compile.

An additional nice to have would be formatting the input arguments that caused the failure in a nice way so that its easier to observe them and copy them out of the trace.

tynes avatar Aug 09 '22 15:08 tynes

  1. SGTM re: Checksumming. You may also be interested in forge fmt which will auto-checksum everything for you.
  2. RE: Formatting of traces, any ideas on what could be the ideal format?

gakonst avatar Aug 09 '22 16:08 gakonst

Afaik there is a mode that displays traces with checksum addresses that was implemented in a PR, we just don't use it for tests.

Ah, it's not checksummed, it's just the full address: https://github.com/foundry-rs/foundry/pull/2064

Should be fairly simple to implement on top of that PR though

onbjerg avatar Aug 09 '22 19:08 onbjerg

SGTM re: Checksumming. You may also be interested in forge fmt which will auto-checksum everything for you.

Would like to try out forge fmt but we currently use prettier and we need to go through process at this point to adopt new things

RE: Formatting of traces, any ideas on what could be the ideal format?

Perhaps a simple table that clearly displays the type, its name and the value that caused the failure. If I could easily copy/paste that table into solidity code and press a minimal number of buttons to be able to run the test with the values that caused the failure, it would be ideal :)

tynes avatar Aug 09 '22 22:08 tynes

closed https://github.com/foundry-rs/foundry/pull/3108

gakonst avatar Sep 19 '22 21:09 gakonst