I am using this - https://github.com/ericxtang/browser-solc

The code works when I select a new compiler version but I continually get a stack error when I try and run the same version. Does anyone have any ideas how to solve this?

I have this code -

document.getElementById("compile-output").value = "";
    var result = compiler.compile(getSourceCode(), optimize);
    var stringResult = JSON.stringify(result);
    document.getElementById("compile-output").value = stringResult;

    var bytecode = result.contracts.greeter.bytecode;
    var abi = result.contracts.greeter.interface;

    web3 = new Web3(web3.currentProvider);

    // Our future code here..
     web3.eth.defaultAccount = web3.eth.accounts[0];

Uncaught RangeError: Maximum call stack size exceeded
    at Object.pgb [as dynCall_viiiiii] (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:12)
    at invoke_viiiiii (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:1)
    at Array.hwa (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:13)
    at Object.acb [as dynCall_vi] (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:12)
    at invoke_vi (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:1)
    at Array.pua (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:10)
    at Object.Thb [as dynCall_iii] (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:12)
    at invoke_iii (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:1)
    at Array.nua (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:10)
    at Object.mib [as dynCall_iiiiii] (VM380 soljson-v0.4.25-nightly.2018.8.16+commit.a9e7ae29.js:12)

There is only one way to solve it - lowering the complexity of your contract. EVM max stack is 1024 so if your contract is too complex it will exceed that during deployment and execution will halt.

If you absolutely cannot take some variables out, consider splitting your contract into multiple contracts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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