“Nothing is certain except for death and taxes”. Also, bugs Benjamin… Also, bugs…
The next step for the Tenderly Visual Debugger (pun very much intended)
Today we are launching our brand new Debugger which greatly simplifies debugging Ethereum transactions.
At a glance, you can see the current step in your code for a given transaction and all input and output variable values at that point in time: no more log statements, no more code simulation in your head, no more frustration.
First things first: why is this needed so much in the Ethereum ecosystem? We all know bugs are inevitable. Heck, even Thomas Edison wrote about them to his associate Puskas in 1878.
It has been just so in all of my inventions. The first step is an intuition, and comes with a burst, then difficulties arise — this thing gives out and it is then that “Bugs” — as such little faults and difficulties are called — show themselves and months of intense watching, study and labor are requisite before commercial success or failure is certainly reached
If bugs cannot be removed entirely, the only logical step is to make tools that help us reduce the time spent debugging, so we can focus on the important stuff.
Let’s step into an example (no more puns, I promise)
By the end of this example, I hope you will see the value and speed this Visual Debugger brings to the table.
To showcase the debugger we will create a simple smart contract that is used to track the score of a tennis match.
We call the addPoints function to add points for a player. This means that we expect player A to win the first game if we call the addPoints(0) 4 times. Let’s try it out:
That’s odd: contract.playerAGamesWon() should’ve returned 1 not 0. Let’s open up the debugger and see what happened. I’ve verified this contract so you can follow along at the contracts public listing. Click on the debugger tab and then on the ↓ icon: this will make the debugger jump to the next step in the execution. Instantly we can see that newScore variable is 60 instead of 50.
The fix is easy: instead of incrementing the score by 15 every time a player wins a point, we check if the current score is greater than or equal to 30. You can find the changed source code here (the fix is at line 28 and 31). Let’s try out our Smart Contract with the newly deployed code:
It works! You can check for yourself that the newScore variable does indeed hold the value 50.
In this example, we saw how the Visual Debugger significantly increased and simplified our debugging speed. Another crucial thing to note is that the transaction was successful, but the logic was faulty. Catching an error like that isn’t easy without a tool like the Visual Debugger.
The Tenderly Debugger supercharges your development workflow with a super-easy debugging experience. You can quickly see input and output variables and exactly how your code is behaving. Together with the existing Execution Overview and Stack Trace features, no bug is hard to find and no transaction hard to understand.
So remember, whether you are Powell or Donovan debugging Dave or a Solidity developer finding out what is happening to your transactions in the middle of the night we built this Debugger with you in mind.
And what’s next?
Now we have a way to reason about our transactions better than ever: the Execution Overview gives us a birds-eye view of our transaction so we can dive in quickly into the important bits, the Stack Trace shows us the exact code path that led to an error, and now the Debugger helps us see, step by step, the exact way our code behaves. All this completes the tooling needed to introspect and debug any transaction, no matter how complex or simple.
The next step is to get alerted when something important happens to your Smart Contracts? What do I mean by important? I don’t know, but you do! Soon we are releasing a customizable Alerting feature which gives you the power to set up rules and get alerted about transactions that you know are important!