trufflesuite / ganache

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
2.62k stars 683 forks source link

Support parity-like state-diffs for previously executed transactions #561

Open jparklev opened 4 years ago

jparklev commented 4 years ago

Parity clients have the traceReplayTransaction rpc method which can return state-diffs. But, because ganache implements the geth methods, it doesn't have traceReplayTransaction. So, my question is: what's the easiest way to recreate the parity-style trace with ganache today? It'd be very useful for eg forking mainnet and simulating an arbitrary transaction locally to see exactly what storage changes would result.

Here's an example response from the parity method

"0x35d1b3f3d7966a1dfe207aa4514c12a259a0492b": {
        "balance": "=",
        "code": "=",
        "nonce": "=",
        "storage": {
          "0x0000000000000000000000000000000000000000000000000000000000000007": {
            "*": {
              "from": "0x00000000000000000000d637c2bb678183d097cb05d470147f3f32bcab828de6",
              "to": "0x00000000000000000000d637c3fa3bf96985a1ae28ea4750aecbe6fc9f81da40"
            }
          },
          "0x099e89cca7ffe1d2fcd345b67a28e02e04474aa4d90f285fcc24596ad4e02166": {
            "*": {
              "from": "0x000000000000000000000010f47708aacb69e9c3c458b8942d41de02a9cac24a",
              "to": "0x000000000000000000000010f5b5dd22b11ef3a6e76e8fd05cce92429dca0ea4"
            }
          },
          "0xd292d01932453fd056c00af823b5e2e4f4761448ea8cd1ed92c5e29ee5efd4fe": {
            "*": {
              "from": "0x000000000000000000000000000000000000000003443c3fcb5f62e7cfd4441d",
              "to": "0x000000000000000000000000000000000000000003443df897441af74a87fc32"
            }
          }
        }
}
gnidan commented 3 years ago

This is not possible now. From personal experience, I would advise against using Geth-style traces to generate Parity-style ones if you need to keep up with mainnet. If you don't have such liveness requirements, this transformation should be possible, as Geth-style traces are comprehensive enough, but caveat emptor.

Regardless, I've renamed your issue to be a request for enhancement. We'll look into the work required here and update the issue here when/if there's been movement on that front.

Thank you!