哪些EVM操作码在GoEthereum上产生痕迹



我正在阅读Geth文档,注意到它提到了跟踪。它涵盖了跟踪发生的时间,并提到只要有跟踪就会创建日志。

The simplest type of transaction trace that Geth can generate are raw EVM opcode traces.
For every VM instruction the transaction executes, a structured log entry is emitted,
containing all contextual metadata deemed useful. This includes the program counter, 
opcode name, opcode cost, remaining gas, execution depth and any occurred error. 

这些日志与LOG操作码发出的事件日志不同吗?哪些操作码导致跟踪?谁能提供一些关于操作码和LOG操作码创建的日志的清晰度?

所指的结构化日志与log操作码发出的结构化日志不同。文本是指在执行过程中显示EVM内部的分析信息。使用Geth提供的命令行evm工具,您可以很容易地看到这一点。例如,这样的命令:

evm --code="0x60006000f3" --json run

这会产生以下跟踪信息:

{"pc":0,"op":96,"gas":"0x2540be400","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":2,"op":96,"gas":"0x2540be3fd","gasCost":"0x3","memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"PUSH1"}
{"pc":4,"op":243,"gas":"0x2540be3fa","gasCost":"0x0","memSize":0,"stack":["0x0","0x0"],"depth":1,"refund":0,"opName":"RETURN"}
{"output":"","gasUsed":"0x6","time":76459}

在这里,您可以看到EVM在执行字节码程序时的状态信息,例如当前的pc值、stack内容等。使用evm工具,您还可以使用命令--nomemory=false查看其他信息,例如内存等。

最新更新