trufflesuite / ganache-ui

Personal blockchain for Ethereum development
https://www.trufflesuite.com/ganache
MIT License
4.65k stars 795 forks source link

System Error when running Ganache 2.3.0-beta.2 on win32 ('pop' of undefined) #1639

Open eliomattia opened 4 years ago

eliomattia commented 4 years ago

Noticed the contracts in my workspace were not visible under Contracts, tried to redeploy using "truffle migrate", the error stack below was raised.

truffle-config.js

module.exports = {
    networks: {
        development: {
            host: "127.0.0.1",
            port: 7545,
            network_id: "*" // will match any network id
        }
    },
    solc: {
        optimizer: {
            enabled: true,
            runs: 200
        }
    }
}

1_initial_migration.js

const Migrations = artifacts.require("Migrations");

module.exports = deployer => {
  deployer.deploy(Migrations);
};

2_deploy_contracts.js: similar to 1_initial_migration.js, but with my main contract

Migrations.sol

pragma solidity >=0.4.21 <0.6.0;

contract Migrations {
  address public owner;
  uint public last_completed_migration;

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

  modifier restricted() {
    if (msg.sender == owner) _;
  }

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
  }

  function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);
    upgraded.setCompleted(last_completed_migration);
  }
}

My main contract was perfectly migrating with the previous suite version (I think 2.0.x or 2.1.x).

PLATFORM: win32 GANACHE VERSION: 2.3.0-beta.2

EXCEPTION:

TypeError: Cannot read property 'pop' of undefined
    at CheckpointTrie.Trie._updateNode (C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:360:24)
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:107:16
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:461:14
    at processNode (C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:471:23)
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:516:13
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:180:7
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\util.js:75:7
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\node_modules\async\lib\async.js:52:16
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\node_modules\async\lib\async.js:269:32
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\node_modules\async\lib\async.js:44:16
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\util.js:71:7
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:157:9
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\lib\database\levelupobjectadapter.js:41:16
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\level-sublevel\shell.js:101:15
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\level-sublevel\nut.js:121:19
    at C:\Program Files\Ganache\resources\static\node\node_modules\ganache-core\node_modules\encoding-down\index.js:55:14
eliomattia commented 4 years ago

If this could help you, adding the following on line 360 of baseTrie.js removed the issue (this is non-reproducible, however, sometimes it still crashes). One possibility is that it could be a concurrency problem, then.

console.warn(key, value, keyRemainder, stack, cb);