...by Daniel Szego
"Simplicity is the ultimate sophistication."
Leonardo da Vinci

Wednesday, April 4, 2018

Solidity Tips and Tricks - debug mode with blocknumber

As we have seen in our previous blog, designing smart contract structure with debug features might be a pretty good idea. One possibility is to realize it with an explicit switch that can be manually switched on or off, however it might happen automatically as well, like based on the actual blocknumber. The following code demonstrates the idea: 

contract TestDebugMode2 
   uint public targetDebugNumber = 1111111111; 
   modifier isInDebug() {       
       require(block.number < targetDebugNumber);

  function onlyInDebug() isInDebug {