zemse / hardhat-tracer

🕵️ allows you to see internal calls, events and storage operations in the console
MIT License
355 stars 36 forks source link

Display source line for items #42

Open zemse opened 1 year ago

zemse commented 1 year ago

https://github.com/zemse/hardhat-tracer/issues/15#issuecomment-1522777187

HarryR commented 1 year ago

Was thinking of including storage I/O profiling too, so e.g. via hre.tracer.storageProfile(true) (argument true resets collection to zero).

I agree with your comment on the other issue, it already prints a fair amount, and it would probably have to take into account multiple contracts so output could get complicated / verbose fairly quickly, but this kind of thing is super useful and I can't find it as easy to use in any other tool.

I will have a look into how to get the line numbers etc. and see if I can get around to adding some notes or hacking on some code.

   [SLOAD]  0xe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e2 → 0x142115100b
      - gas=2100 file=project/Blah.sol:35
   [SLOAD]  0xe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e3 → 0x4
      - gas=2100 file=project/Blah.sol:35
   [SSTORE] 0x3f5659f257210b7b89da6db5c873016a4ad9edc95c7b72eda1719e366516c15 ← 0x160d000840003c44cdddb6a900fa2b585dd299e03d12fa4293bc
      - gas=2100 file=project/Blah.sol:35
   [SLOAD]  0x961ec03a078fec1e350bb1ca3bff1afa4bae5fb83d9d8382550c2fd26a7d7527 → 0x3e2
      - gas=2100 file=project/Blah.sol:35

Storage summary:
0xe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e2
 - new gas:21200 reads=1 hotreads=2 writes=2
 - project/Blah.sol:30 writes=2
 - project/Blah.sol:35 hotreads=3
 - project/Blah.sol:38 writes=1 reads=1