So, I must admit upfront that this feature request isn't really just intended for turbo-geth. :) Basically @gnidan and I at Truffle were talking about a new debug RPC method we'd like to see... mostly for our own use in Ganache, but we don't like to go just making up new debug RPC methods and putting them in Ganache because, well, we want Ganache to be a good reflection of what one might find on (at least certain) actual Ethereum nodes! If we write a new Truffle feature, and it relies on an RPC method that only Ganache supports, then it won't work when using Truffle with anything other than Ganache, and we don't want that. So, that's why we're talking to you rather than just putting it in Ganache and announcing it. :) Really we should include (non-turbo-)Geth and Besu as well, since they also support debug RPC methods (and it looks like most of them started with Geth, although some seem to have started with Besu), since the idea is that hopefully we'd get everybody to support this -- not sure what the best way to include them here is -- but we saw your announcement of debug_traceCall and thought this might be a good place to open the discussion. :)
Anyway, sorry, enough preamble. The new method we'd like to see -- I'll call it debug_accountAt, to give it a name -- is similar to Besu's debug_storageRangeAt method, which I believe Geth and Turbo-Geth both already support (even though it doesn't seem to be in the docs), and which we're currently adding to Ganache. That method takes a block hash, a transaction index, a contract address, and a storage slot address, and returns the storage in that slot at that transaction index.
What I'd like to see, that I think would be really useful in combination with debug_storageRangeAt, would be a method that just takes a block hash, transaction index, and contract address, and returns the account info at that transaction index. That is to say, it would return a result that includes the account's code, balance, and nonce. The exact form of the return value is not too important, so long as all the essential information is there.
Basically, a lot of the usefulness of storageRangeAt for debugging is that it covers information that's relevant to a transaction but is absent from debug_traceTransaction. So the idea is that debug_accountAt, or whatever it ends up being called, would pretty much cover the rest. Just as we're planning to start having Truffle Debugger start making use of debug_storageRangeAt so that it doesn't have to show zeroes for storage that hasn't been touched in the specific transaction, if it had debug_accountAt it (and other debuggers) could better handle debugging contracts that had since self-destructed (by getting their code at the relevant transaction index), or CREATEs (not CREATE2s) that failed (for which determining the address that would have been created requires knowledge of nonces). Balance isn't particularly essential for anything that any debuggers I know of do at the moment, but tracking balances throughout a transaction is certainly something a debugger might want to do in the future -- it's certainly something we've thought about for Truffle Debugger -- and if we're getting the account information, we may as well get all of it, right? (I mean, aside from the storage, but that's already its own method! :) )
Anyway, yes, as mentioned above, we were hoping this would make it not only into Turbo-Geth but also Geth and Besu, and of course the idea is we'd add it into Ganache as well, but figured we'd start here. :) So, hopefully this is something that you agree would be a good addition. Thank you!
So, I must admit upfront that this feature request isn't really just intended for turbo-geth. :) Basically @gnidan and I at Truffle were talking about a new debug RPC method we'd like to see... mostly for our own use in Ganache, but we don't like to go just making up new debug RPC methods and putting them in Ganache because, well, we want Ganache to be a good reflection of what one might find on (at least certain) actual Ethereum nodes! If we write a new Truffle feature, and it relies on an RPC method that only Ganache supports, then it won't work when using Truffle with anything other than Ganache, and we don't want that. So, that's why we're talking to you rather than just putting it in Ganache and announcing it. :) Really we should include (non-turbo-)Geth and Besu as well, since they also support debug RPC methods (and it looks like most of them started with Geth, although some seem to have started with Besu), since the idea is that hopefully we'd get everybody to support this -- not sure what the best way to include them here is -- but we saw your announcement of
debug_traceCalland thought this might be a good place to open the discussion. :)Anyway, sorry, enough preamble. The new method we'd like to see -- I'll call it
debug_accountAt, to give it a name -- is similar to Besu'sdebug_storageRangeAtmethod, which I believe Geth and Turbo-Geth both already support (even though it doesn't seem to be in the docs), and which we're currently adding to Ganache. That method takes a block hash, a transaction index, a contract address, and a storage slot address, and returns the storage in that slot at that transaction index.What I'd like to see, that I think would be really useful in combination with
debug_storageRangeAt, would be a method that just takes a block hash, transaction index, and contract address, and returns the account info at that transaction index. That is to say, it would return a result that includes the account's code, balance, and nonce. The exact form of the return value is not too important, so long as all the essential information is there.Basically, a lot of the usefulness of
storageRangeAtfor debugging is that it covers information that's relevant to a transaction but is absent fromdebug_traceTransaction. So the idea is thatdebug_accountAt, or whatever it ends up being called, would pretty much cover the rest. Just as we're planning to start having Truffle Debugger start making use ofdebug_storageRangeAtso that it doesn't have to show zeroes for storage that hasn't been touched in the specific transaction, if it haddebug_accountAtit (and other debuggers) could better handle debugging contracts that had since self-destructed (by getting their code at the relevant transaction index), orCREATEs (notCREATE2s) that failed (for which determining the address that would have been created requires knowledge of nonces). Balance isn't particularly essential for anything that any debuggers I know of do at the moment, but tracking balances throughout a transaction is certainly something a debugger might want to do in the future -- it's certainly something we've thought about for Truffle Debugger -- and if we're getting the account information, we may as well get all of it, right? (I mean, aside from the storage, but that's already its own method! :) )Anyway, yes, as mentioned above, we were hoping this would make it not only into Turbo-Geth but also Geth and Besu, and of course the idea is we'd add it into Ganache as well, but figured we'd start here. :) So, hopefully this is something that you agree would be a good addition. Thank you!