What would be the process to map failed transactions (require, throw, etc.) back to the source code line where they occurred?
Any examples of such yet?
What would be the process to map failed transactions (require, throw, etc.) back to the source code line where they occurred?
Any examples of such yet?
Something you are looking for is here How to map EVM trace to contract source?. As for me for development purposes I use requireDebugModifier from code below, for production I change requireDebugModifier to requireModifier.
contract DebugEvents
{
event Debug(string message);
modifier requireDebugModifier(bool arg, string message)
{
if (!arg)
{
Debug(message);
return;
}
_;
}
modifier requireModifier(bool arg)
{
require(arg);
_;
}
}
contract Test is DebugEvents
{
function Test() public payable
{
}
function fooDevel(uint i)
requireDebugModifier(i<10, "I must be less then 10")
public
returns (uint)
{
return i;
}
function fooProduction(uint i)
requireModifier(i<10)
public
returns (uint)
{
return i;
}
}