0

I'm trying to instrument the GETH virtual machine, and in order to do so I'm studying the geth code running it on debug. I expected that, during syncing, EVM is used to compute state of each single contract, and I put a breakpoint in the function NewEVM in /vm/eth.go. I expect some time this to be hit when GETH create an instance of the vm, but it never happen, so I'm surely getting wrong somewhere, can anybody help? I'm using VSCode and Delve debugger.

2

Golang debuggers aren't very good at breaking, sometimes they miss the breakpoint. What are you using? Try gdb.

There is no way you can skip NewEVM() function it is being called on every transaction inside ApplyTransaction() function in core/state_processor.go. Make sure your node is actually processing blocks, you could be disconnected from peers.

You can debug by adding this line to any ethereum source file, between the lines you need to debug.

log.Info(fmt.Sprintf("statedb object=%v,statedb))

just, don't forget to import the log package

"github.com/ethereum/go-ethereum/log"
  • Yes you are right, I debugged old school ( by tracing with log ) and apparently works. I'm bake in the Eighteen :D – Felice Pollano Oct 4 '18 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.