2

I was reading through the Geth docs and noticed it mentioning traces. It covered when traces occur and mentioned that logs are created anytime there are traces.

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. 

Are these logs different than the event logs emitted from the LOG opcode? Which opcodes result in traces? Can anyone provide some clarity on the logs created from opcodes and the LOG opcode?

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
0xKitsune
  • 131
  • 6
  • I think this is something you should check from GoEthereum codebase yourself, as it is implementation and version specific. – Mikko Ohtamaa Jul 19 '22 at 06:24

1 Answers1

0

The structured logs it is referring to are different from those emitted by the log opcode. The text is refers to profiling information which shows internals of the EVM during executing. Using the command-line evm tool provide with Geth you can see this quite easily. For example, a command like this:

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

This produces the following trace information:

{"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}

Here you can see information about the state of the EVM as it executes the bytecode program, such as its currently pc value, stack contents, etc. With the evm tool you can also see other information such as memory with the command --nomemory=false, etc.

redjamjar
  • 535
  • 2
  • 11