I have the function resolveProject() in my contract, which iterates over a list of Task, let's say 2, both with status 3.

function resolveProject() {
    // ...

    uint closedTask;
    uint totalPayout;

    for(uint i=0; i<taskIds.length; i++){
        if(tasks[taskIds[i]].status == 3) {
            // Issue here
            closedTask = closedTask + 1;
            totalPayout += tasks[taskIds[i]].compensationOracle;
    // ...

After one iteration, the line closedTask = closedTask + 1 assign 1000000000000000000 to the variable, where my intention would be to set it to 1. I tried also using closedTask++ with the same result.

1000000000000000000 gwei is 1 eth, is this some sort of implicit conversion happening? I get this when running on Remix JavaScript VM.

Edit 1

The Solidity code works actually fine, but I think there might be a bug in the debug panel of Remix

Wrong variable value in Remix debug console

at line 146 there is a comparison between closedTask and taskIds.length. The latter has 3 items, as you can see on the right, but closedTask in debug panel shows 3000000000000000000. Still that comparison returns true when runs, I can confirm the projectStatus set to 2.

Edit 2 I created a bug in remix-ide' github, it has been tagged as bug so I assume this confirms there is a minor bug with Remix debug console.


1 Answer 1


It should only be adding 1. The problem is almost definitely in the method you're using to read the variable, which we can't see.

Write some tests, and if your tests fail, post the failing test.

  • I see the assigned value in the debug console of Remix, and I start to think that this might be an issue with Remix, because the other local variable totalPayout does not even appear in the Solidity Local part of debugging panel. I will try to check manually with geth and come back, good to know that you share my expected behavior for the increment.
    – Zeta
    Commented Nov 11, 2018 at 13:28
  • The Solidity code works actually fine, I think this is an issue with the Remix debug console, I will update the question with more details
    – Zeta
    Commented Nov 11, 2018 at 19:51

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.