Near-One / rainbow-bridge

🌈🌈🌈 NEAR <> Ethereum Decentralized Bridge
GNU General Public License v3.0
327 stars 100 forks source link

Cannot install ganache-core with web3 together anymore #96

Closed MaksymZavershynskyi closed 4 years ago

MaksymZavershynskyi commented 4 years ago

Currently, when I get the most recent repo and try running yarn in environment I am getting the error message described here: https://github.com/ethereum/web3.js/issues/3473

Unfortunately, neither upgrading to the most recent versions of ganache-core and web3 nor downgrading node to 13.4 helps. I have to temporarily remove ganache-core from the dependencies, together with start ganache command and start it manually using:

ganache-cli --port 9545 --blockTime 12 --gasLimit 10000000 --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,1000000000000000000000000"

Using globally installed ganache-cli.

chefsale commented 4 years ago

This is interesting, tried locally on my machine.

Works on both 10.19.0 and 13.14.0 and 14.4.0

sandi@sandi-ThinkPad-X1-Carbon-7th ~/w/n/b/environment (dockerization)> nodejs --version
v10.19.0
sandi@sandi-ThinkPad-X1-Carbon-7th ~/w/n/b/environment (dockerization)> node --version
v13.14.0
sandi@sandi-ThinkPad-X1-Carbon-7th ~/w/n/b/environment (dockerization)> node --version
v14.4.0

Version of yarn I'm using:

sandi@sandi-ThinkPad-X1-Carbon-7th ~/w/n/b/environment (dockerization)> yarn --version
1.22.4

Not sure why this is happening, have you tried maybe deleting the current node modules, package-lock.json (if exists by any weird case) and yarn.lock.

chefsale commented 4 years ago

I think I got a reproduce:

/home/sandi/.cache/node-gyp/14.4.0/include/node/v8.h:3639:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
 3639 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
      |                                     ^~~
/home/sandi/.cache/node-gyp/14.4.0/include/node/v8.h:3639:37: note:   candidate expects 3 arguments, 2 provided
/home/sandi/.cache/node-gyp/14.4.0/include/node/v8.h:3642:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
 3642 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
/home/sandi/.cache/node-gyp/14.4.0/include/node/v8.h:3642:37: note:   candidate expects 3 arguments, 2 provided
../src/node-boilerplate/scrypt_params_async.cc:25:64: error: no matching function for call to β€˜v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’
   25 |   obj->Set(Nan::New(\"p\").ToLocalChecked(), Nan::New<Integer>(p));
      |                                                                ^
In file included from /home/sandi/.cache/node-gyp/14.4.0/include/node/node.h:67,
                 from ../../nan/nan.h:56,
                 from ../src/node-boilerplate/scrypt_params_async.cc:1:
/home/sandi/.cache/node-gyp/14.4.0/include/node/v8.h:3639:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
 3639 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
      |                                     ^~~
/home/sandi/.cache/node-gyp/14.4.0/include/node/v8.h:3639:37: note:   candidate expects 3 arguments, 2 provided
/home/sandi/.cache/node-gyp/14.4.0/include/node/v8.h:3642:37: note: candidate: β€˜v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
 3642 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
/home/sandi/.cache/node-gyp/14.4.0/include/node/v8.h:3642:37: note:   candidate expects 3 arguments, 2 provided
../src/node-boilerplate/scrypt_params_async.cc:32:25: warning: β€˜v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
   32 |   callback->Call(2, argv);
      |                         ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:1:
../../nan/nan.h:1742:3: note: declared here
 1742 |   Call(int argc, v8::Local<v8::Value> argv[]) const {
      |   ^~~~
make: *** [scrypt.target.mk:131: Release/obj.target/scrypt/src/node-boilerplate/scrypt_params_async.o] Error 1
make: Leaving directory '/home/sandi/workspace/near/bridge/environment/node_modules/scrypt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.6.6-050606-generic
gyp ERR! command \"/usr/bin/node\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
gyp ERR! cwd /home/sandi/workspace/near/bridge/environment/node_modules/scrypt

That's a start :)

chefsale commented 4 years ago

So, more information I have found:

  1. Ganache cli is not working on versions of node > 12, example with 14
    0000000000000000000"
    Ganache CLI v6.9.1 (ganache-core: 2.10.2)
    Error: Callback was already called.
    at /usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:17:276
    at s.<anonymous> (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:17:2238)
    at s.emit (events.js:315:20)
    at s.destroy (/usr/local/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:37:712589)
    at finish (_stream_writable.js:658:14)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
    sandi@sandi-ThinkPad-X1-Carbon-7th ~/w/n/bridge (dockerization) [1]> python3 /nearup localnet --num-nodes 1 --binary-path ~/.rainbowup/core/target/debug^C
    sandi@sandi-ThinkPad-X1-Carbon-7th ~/w/n/bridge (dockerization) [1]> node --version
    v14.4.0

    but it works on version 12 of node:

    
    sandi@sandi-ThinkPad-X1-Carbon-7th ~/w/n/bridge (dockerization)> ganache-cli --port 9545 --blockTime 12 --gasLimit 10000000 --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,10000000000000000000000000000"
    Ganache CLI v6.9.1 (ganache-core: 2.10.2)

Available Accounts

(0) 0xDf08F82De32B8d460adbE8D72043E3a7e25A3B39 (10000000000 ETH)

Private Keys

(0) 0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200

Gas Price

20000000000

Gas Limit

10000000

Call Gas Limit

9007199254740991

Listening on 127.0.0.1:9545


Will be baking that into the docker image.

2. Ganache-core npm package is not very well maintained and we should be probably using the cli tool for now.
chefsale commented 4 years ago

cc: @nearmax take a look at the comments in this PR: https://github.com/near/rainbow-bridge/pull/106 This looks to be an issue with node versions above 10.

The solutions here are:

  1. to enforce user to either use node 10
  2. to just remove the start ganache command and use the workaround until ganache-core supports higher node versions.
MaksymZavershynskyi commented 4 years ago

@chefsale I suggest we go with (2) using the following modification: we start ganache-cli using pm2 for easy management.

MaksymZavershynskyi commented 4 years ago

Actually it looks like I cannot even install ganache-cli with 14 node version, only with 10. I am using a completely clean Mac OS. So we should just enforce node version 10 and return ganache-core.

chefsale commented 4 years ago

In that case we should probably land: https://github.com/near/rainbow-bridge/pull/106.

ailisp commented 4 years ago

@nearmax fixed, it only happen when the ci instance is happened to be reused (buildkite isn't able to reliably always shutdown instance and recreate instance)

ailisp commented 4 years ago

@chefsale I still don't think it's a good idea to just downgrade to 10 for ganache-cli, using start_ganache.sh plus npm i -g ganache-cli then start manually with ganache-cli works with 12

chefsale commented 4 years ago

Created this PR for cases where machine gets reused: https://github.com/near/rainbow-bridge/pull/122