question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Returned error: Cannot get state root with uncommitted checkpoints

See original GitHub issue
  • I’ve asked for help in the Truffle Gitter before filing this issue.

Issue


{
 Error: Returned error: Cannot get state root with uncommitted checkpoints    at PromiEvent (/home/test/.npm-global/lib/node_modules/truffle/build/webpack:/packages/contract/lib/promievent.js:9:1)
    at TruffleContract.getETH (/home/test/.npm-global/lib/node_modules/truffle/build/webpack:/packages/contract/lib/execute.js:169:1)
    at Context.<anonymous> (/home/test/IdeaProjects/carbon-token/test/DECA.js:293:33)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
  hijackedStack: 'Error: Returned error: Cannot get state root with uncommitted checkpoints\n    at Object.ErrorResponse (/home/test/.npm-global/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-helpers/src/errors.js:29:1)\n    at /home/test/.npm-global/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-requestmanager/src/index.js:140:1\n    at /home/test/.npm-global/lib/node_modules/truffle/build/webpack:/packages/provider/wrapper.js:112:1\n    at XMLHttpRequest.request.onreadystatechange (/home/test/.npm-global/lib/node_modules/truffle/build/webpack:/node_modules/web3-providers-http/src/index.js:96:1)\n    at XMLHttpRequestEventTarget.dispatchEvent (/home/test/.npm-global/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:1)\n    at XMLHttpRequest._setReadyState (/home/test/.npm-global/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:208:1)\n    at XMLHttpRequest._onHttpResponseEnd (/home/test/.npm-global/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:318:1)\n    at IncomingMessage.<anonymous> (/home/test/.npm-global/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:289:47)\n    at emitNone (events.js:111:20)\n    at IncomingMessage.emit (events.js:208:7)\n    at endReadableNT (_stream_readable.js:1064:12)\n    at _combinedTickCallback (internal/process/next_tick.js:139:11)\n    at process._tickCallback (internal/process/next_tick.js:181:9)' }

Steps to Reproduce

Take this contract :


pragma solidity 0.5.16;

contract DECA {
    address payable private _owner;

    constructor () public {
        _owner = msg.sender;
    }

    function() external payable {

    }

    function getETH() public {     
        _owner.transfer(address(this).balance);
    }

}

And execute this test :

async function getHighBalance() {
    var accounts = await web3.eth.getAccounts();
    var acc = accounts[0];
    console.dir(acc)
    var b = await web3.eth.getBalance(acc);

    console.dir(b)
    let high = {
        "address": acc,
        "balance": b
    }

    return high;
}
 describe('reproducer', async function () {
        it('check getETH', async function () {
            this.creator = await getHighBalance();

            this.deca = await DECA.new({
                from: this.creator.address,
                gas: 6712390
            })

            let decaBalance = await web3.eth.getBalance(this.deca.address);
            assert.equal(decaBalance.toString(10), '0', " wrong contract balance")
            var sender = await getHighBalance();
            await web3.eth.sendTransaction({
                from: sender.address,
                to: this.deca.address,
                value: 1000,
                gas: 6712390
            });
            decaBalance = await web3.eth.getBalance(this.deca.address);
            assert.equal(decaBalance.toString(10), '1000', " wrong contract balance")
            let wasErr = false;
            try {
                await this.deca.getETH({from: this.creator.address, gas: 6712390})
            } catch (err) {
                console.dir(err)
                wasErr = true;
            }
            assert.equal(false, wasErr, "getETH not possible to test because of bug in truffle")
            decaBalance = await web3.eth.getBalance(this.deca.address);
            assert.equal(decaBalance.toString(10), '0', " balance of the DECA expected to be empty")
        })
    })

Expected Behavior

pass test

Actual Results

failed because of exception

Environment

  • Operating System: arch linux Truffle v5.1.11 (core: 5.1.11) Solidity v0.5.16 (solc-js) Node v8.16.2 Web3.js v1.2.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
vitaliy-kuzmichcommented, Feb 29, 2020

@davidmurdoch thanks for debug tips!

0reactions
gnidancommented, Aug 26, 2020

Closing this for issue maintenance.

Let us know if there’s more that’s actionable for Truffle here and we can reopen. Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ConsenSys/truffle - Gitter
If you have a slow internet connection, try configuring a longer timeout in ... Hi, does anyone meet this : "Error: Returned error:...
Read more >
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
Error: Returned error: sender doesn't have enough funds to ...
I'm trying to run a huge test suite(around 50 test cases) using Truffle and after around 18-20 test cases pass I'm getting this...
Read more >
Error Messages and SNMP Traps - Oracle Help Center
User Action: If you receive this error for both checkpoint files, restore your ... Cannot start a transaction because the database is in...
Read more >
Lecture 21: Logging Schemes - CMU 15-445/645
(a) Logical Errors: A transaction cannot complete due to some internal error condition (e.g., in- tegrity, constraint violation). (b) Internal State Errors: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found