question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve implementation - perhaps with debug_traceTransaction

See original GitHub issue

Given that Truffle 4 is now in beta, and comes with a snazzy debugger that we can (in theory) crib notes from, it seems like a good moment to start a discussion along these lines.

On the surface, it seems like doing no instrumentation at all and using debug_traceTransaction alongside the demonstrated methodology in the truffle debugger would save a lot of headaches that instrumentation can otherwise cause.

The obvious downside to this approach would be that we would no longer be able to trace lines of code executed with an eth_call, which would limit the maximum coverage we could display to a number below 100%. We could, however, exclude functions labelled with pure and view (formerly known as constant), though they can still obviously be called by transactions that change blockchain state, and so not showing them as covered might be confusing.

I’m considering this a blue-skies issue for now, so I’m open to suggestions, however far-fetched they might seem. I’ll kick it off:

  • Create our own fork of solidity and etheruemjs-vm, and introduce another opcode for our coverage events that cost no gas.
  • Integrate something like the solidity debugger with sourcemaps etc. into the ethereumjs-vm, so that it ‘knows’ what code it is executing and keeps track of it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:23 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
onbjergcommented, Sep 24, 2017

Yep, you can just use the step event instead. That approach is actually a bit cleaner.

You don’t need to use testrpc, you can use ganache-core directly by using it’s provider method and passing that to the truffle config instead. This method also accepts options, one of which is actually the VM, if you want to roll your own. It shouldn’t be needed though, since this hook works if you’re using ganache-core directly (which is what testrpc is using).

1reaction
onbjergcommented, Sep 27, 2017

Great, thanks! I’ll look at it this weekend if I have time, I’m in the process of moving 🚚

Read more comments on GitHub >

github_iconTop Results From Across the Web

debug_traceTransaction - Alchemy Docs
Attempts to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that...
Read more >
ethereum/go-ethereum - Gitter
I can successfully attach to the console, but when I run "debug.traceTransaction("0xd602527e2292923a40092263fa22a055aa16e1d8763c65f0a83a
Read more >
Debugging with Truffle - Ethereum Blockchain Developer
In this lab I want to show you two things: Debugging Smart Contracts while you develop; Debugging Smart Contract after they are deployed....
Read more >
Hardhat Network | Ethereum development environment for ...
It's backed by the @ethereumjs/vm EVM implementation, the same one ... so there are probably bots monitoring these addresses on mainnet, ...
Read more >
debug_traceTransaction RPC method - QuickNode
Result - Transaction Trace Object, which has the following fields: Failed - Boolean. Gas - Quantity. ReturnValue - Data. StructLogs - ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found