-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(forge): label addresses in traces #553
Comments
I am cautious to throw "unneeded" http calls to maintain speed. That being said, I'm all for labels, that's a great idea. Should be easy to implement - adding a tag field to a CallTraceNode, then in the pretty_print or update_identified function, build a mapping and populate all nodes tag field that have the tagged address. Should the tag take precedence over contract name, I assume? |
Love the idea, and agree tag should take precedence over contract name Also relevant is that TrueBlocks has a large address book of mainnet addresses we could pull from, more info here: gakonst/ethers-rs#769 (comment). Could either include a copy with the binary, or it's just one extra HTTP call for that full list |
Oh interesting - should tagging be cached to disk or only be dynamic? I can see cases for both |
Hmm, my current thinking is that |
Good point about the test performance. What about an optional test flag that pulls in these addresses when set and otherwise uses them from a cached database, possibly a plain file similar to .gas-snapshot? It could then even use TrueBlock as a fallback for ENS (or vica versa). Agreed about the persistence though: Ordered with increasing priority (higher overrides lower):
It should be possible to manually add custom records to Might be a good idea to start with just a manually maintained registry and consider TrueBlocks, etc. separately. We could provide an option to extract all unlabeled addresses at the end of a test run into the |
Supportive. I'd recommend we go the MVP path here and add the cheatcode for labelling, and if manual labelling becomes too much of an issue we start adding more configs on forge. We could also have a bunch of pre-configured labels in forge-std that one could import in their tests instead. |
Agreed. I assume by that you also mean automatically derived labels for instances of local contracts in addition to the cheatcode, right? |
If automatic derivation is easy, then yeah |
I believe it would further improve readability of the traces output (
forge test -vvvv
) if addresses were labeled with the name of the contract at the address or a custom label for EOAs. For EOAs (and also assigning custom labels for contracts e.g. to differentiate between different instances of the same contract), it might be cool to add a cheatcode to manually assign custom labels.E.g.
For fork tests, it might also be nice to try and do a reverse ENS lookup?
The text was updated successfully, but these errors were encountered: