1

So I'm a student working on a smart contract in Solidity as part of my coursework, and I'm a bit of a blockchain newbie. I've got my contract working now, but there is one function that's causing me problems. It seems to be working fine, except that Remix sometimes tells me that the execution failed (with the above message). I haven't quite pinned down the conditions that cause this yet, because I'm not sure how to go about debugging it.

I've used the IDE debugger to step through the transaction, but it just seems to execute the whole thing and exit. Putting, eg, require(false, "Made it to the end"); at the end of the function also seems to indicate that it completes (as the error does get thrown). There are also two ETH transfers taking place towards the end of the function (one to the address calling the function, and one to another address that is stored in the contract's state) and these seem to be consistently getting through.

So, to summarise the question: what method am I best off using to figure out the problem? Not really interested in specific solutions to my problem as my code is part of my coursework and I feel like I should know how to solve these problems more generally.

Thanks in advance!

1
  • Bisection should work, comment and uncomment lines until you get the failing line number.
    – Ismael
    Dec 30, 2021 at 5:36

1 Answer 1

0

Answering in case anyone else comes across this:

The thing that solved it was the first thing I should have tried - I refreshed the page and had no further problems. I'm assuming my session in Remix was a bit bugged or something. I've been resetting the JavaScript VM environment regularly in order to get a 'clean slate', so I think it must be something in the frontend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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