Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Parity Ethereum bundling#458

Merged
Tbaut merged 14 commits intomasterfrom
ac-parity-bbundling
Mar 21, 2019
Merged

Parity Ethereum bundling#458
Tbaut merged 14 commits intomasterfrom
ac-parity-bbundling

Conversation

@axelchalon
Copy link
Contributor

@axelchalon axelchalon commented Mar 5, 2019

Needs openethereum/js-libs#205 to be merged (need to update js-libs dep after this). closes #204 closes #175

  • Download parity from the vanity service on postinstall
  • Check in fether-react if the running version of Parity (which might not be the bundled version) is compatible

Copy link
Collaborator

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! Could you update @parity/light.js, I'd like to test this

});
}

function downloadParity () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use @parity/electron here? Or is it too Electron-focused?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's what I was intending to do, but somehow the postinstall script of @parity/electron isn't run when running yarn in the workspace root

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axelchalon
Copy link
Contributor Author

axelchalon commented Mar 13, 2019

(Parity v2.4.1 isn't released yet, so for now Fether won't accept to run on the downloaded bundled binary; however you can test by running a separate instance of master Parity Ethereum)

@axelchalon
Copy link
Contributor Author

I don't think sending transactions will work on this PR; the changes from the other PR #394 are needed. I think I'll merge the other PR into this one

@ltfschoen
Copy link
Contributor

ltfschoen commented Mar 13, 2019

I just tried running this branch on macOS in development with yarn; yarn start.

Initially it indicated that there was an issue with my network connection (when I don't think there was), and then after a while it decided to compile successfully, but in the Chrome Inspector > Console it showed the following error, and the Fether window was blank, even after refreshing it.

Details

~/code/src/paritytech/fether - [ac-parity-bbundling] $ yarn; yarn start
yarn install v1.10.1
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@parity/abi/-/abi-5.1.1.tgz: ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Users/scon/code/src/paritytech/fether/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
yarn run v1.10.1
$ npm-run-all -l -p start-*
[start-react   ] $ cd packages/fether-react && yarn start
[start-electron] $ cd packages/fether-electron && yarn start
[start-ui      ] $ cd packages/fether-ui && yarn start
[start-ui      ] $ yarn build --watch
[start-react   ] $ npm-run-all -p start-*
[start-electron] $ cross-env ELECTRON_START_URL=http://localhost:3000 electron-webpack dev --ws-origins all
[start-ui      ] $ rimraf lib
[start-ui      ] $ babel src --out-dir lib --watch
[start-react   ] $ cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none craco start --react-scripts ../../node_modules/react-scripts
[start-react   ] $ npm run build-css -- --watch --recursive
[start-react   ] 
[start-react   ] > fether-react@0.3.0 build-css /Users/scon/code/src/paritytech/fether/packages/fether-react
[start-react   ] > node-sass-chokidar src/ -o src/ "--watch" "--recursive"
[start-react   ] 
[start-react   ] => changed: /Users/scon/code/src/paritytech/fether/packages/fether-react/src/index.sass
[start-react   ] Rendering Complete, saving .css file...
[start-react   ] Wrote CSS to /Users/scon/code/src/paritytech/fether/packages/fether-react/src/index.css
[start-ui      ] Successfully compiled 43 files with Babel.

Screen Shot 2019-03-13 at 10 27 29 pm

The second time I ran it with yarn; yarn start, it displayed the following, and eventually compiled successfully. Note how this time it displayed Downloading Parity Ethereum... in the terminal logs (whereas the first time it didn't).
But again in the Chrome Inspector > Console it showed an error, but a different one.
And this time the Fether window displayed "Unsupported version \n You are running Parity Ethereum <2.4.1, which is unsupported. Please upgrade to Parity Ethereum ^2.4.1"

Details

~/code/src/paritytech/fether - [ac-parity-bbundling] $ yarn; yarn start
yarn install v1.10.1
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
[4/5] 🔗  Linking dependencies...
warning " > babel-eslint@10.0.1" has unmet peer dependency "eslint@>= 4.12.1".
warning "workspace-aggregator-2cba0802-420a-4be4-8622-cdc4bc946181 > fether-ui@0.3.0" 
...
...
[5/5] 📃  Building fresh packages...
$ cd scripts && node ./fetch-latest-parity.js
Downloading Parity Ethereum... (https://releases.parity.io/ethereum/beta/x86_64-apple-darwin/parity)
Success: bundled Parity Ethereum v2.4.0
✨  Done in 239.35s.
yarn run v1.10.1
$ npm-run-all -l -p start-*
[start-electron] $ cd packages/fether-electron && yarn start
[start-react   ] $ cd packages/fether-react && yarn start
[start-ui      ] $ cd packages/fether-ui && yarn start
[start-ui      ] $ yarn build --watch
[start-react   ] $ npm-run-all -p start-*
[start-electron] $ cross-env ELECTRON_START_URL=http://localhost:3000 electron-webpack dev --ws-origins all
[start-ui      ] $ rimraf lib
[start-ui      ] $ babel src --out-dir lib --watch
[start-react   ] $ npm run build-css -- --watch --recursive
[start-react   ] $ cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none craco start --react-scripts ../../node_modules/react-scripts
[start-react   ] 
[start-react   ] > fether-react@0.3.0 build-css /Users/scon/code/src/paritytech/fether/packages/fether-react
[start-react   ] > node-sass-chokidar src/ -o src/ "--watch" "--recursive"
[start-react   ] 
[start-react   ] => changed: /Users/scon/code/src/paritytech/fether/packages/fether-react/src/index.sass
[start-react   ] Rendering Complete, saving .css file...
[start-react   ] Wrote CSS to /Users/scon/code/src/paritytech/fether/packages/fether-react/src/index.css
[start-ui      ] Successfully compiled 43 files with Babel.

Screen Shot 2019-03-13 at 10 41 23 pm

The third time I ran it it showed the following in the terminal and successfully compiled. It showed the same notification in the Fether window and the Chrome Inspector Console.

Details

~/code/src/paritytech/fether - [ac-parity-bbundling] $ yarn; yarn start
yarn install v1.10.1
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
success Already up-to-date.
$ cd scripts && node ./fetch-latest-parity.js
Bundled Parity Ethereum v2.4.0 is older than required version ^2.4.1
Downloading Parity Ethereum... (https://releases.parity.io/ethereum/beta/x86_64-apple-darwin/parity)
Success: bundled Parity Ethereum v2.4.0
✨  Done in 12.03s.

@ltfschoen
Copy link
Contributor

I just tried downloading and running the latest "stable" Parity Ethereum Parity-Ethereum/v2.3.5-stable-ebd0fd011-20190227/x86_64-macos/rustc1.33.0 separately before starting Fether with yarn; yarn start.

It incorrectly says v2.4.0 in the terminal as shown below:

...
Bundled Parity Ethereum v2.4.0 is older than required version ^2.4.1
Downloading Parity Ethereum... (https://releases.parity.io/ethereum/beta/x86_64-apple-darwin/parity)
...

There are no errors in the Chrome Inspector > Console.

It correctly shows the version number in Fether window as Unsupported version You are running Parity Ethereum 2.3.5, ....

@axelchalon
Copy link
Contributor Author

axelchalon commented Mar 14, 2019

It incorrectly says v2.4.0 in the terminal as shown below:

There are two version numbers:

  • The one from the bundled Parity Ethereum (downloaded in packages/fether-electron/static), shown in the terminal, checked in the postinstall script
  • The one from the running instance of Parity Ethereum, checked in fether-react

v2.4.0 is the version of the bundled Parity Ethereum in packages/fether-electron/static. The postinstall script will download the latest beta version of Parity Ethereum inside static/ if there is no binary in that folder, or if the binary is an older version than the version required (this way, if somebody updates the version requirement, the rest of the developers will automatically download a more recent, compatible version of Parity Ethereum on postinstall). The postinstall script doesn't check if there's a running instance of Parity Ethereum, or the version thereof; it only takes care of the bundled Parity Ethereum.

fether-react additionally checks if the running instance of Parity Ethereum (bundled or run separately) matches the version requirement

@axelchalon axelchalon force-pushed the ac-parity-bbundling branch from 171c887 to 77b9d8d Compare March 14, 2019 14:28
Copy link
Collaborator

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good!

The error cases (1/ running fether with <2.4.1 and 2/ no matches for downloading parity-ethereum) work good.

I think, just to be safe, we should wait for 2.4.1 (openethereum/parity-ethereum#10471) before merging this PR, should take a couple of days max. Putting on-ice in the meantime.

Copy link
Collaborator

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this message:

[start-electron]   [2019-03-19T18:59:02.486Z] INFO (@parity/electron:main/44589 on Amaurys-MacBook-Pro.local): Parity found on machine, can be run with "/Users/amaurymartiny/Library/Application Support/Electron/parity".
[start-electron]   [2019-03-19T18:59:02.495Z] INFO (@parity/electron:main/44589 on Amaurys-MacBook-Pro.local): Running "/Users/amaurymartiny/Library/Application\ Support/Electron/parity --ws-origins all --light --chain kovan --ws-interface 127.0.0.1 --ws-port 8546".

I think you need to update @parity/electron to ^5 for it to take parityPath into account

// Parity Ethereum isn't running: run the bundled binary
await this.run();
pino.info('Running Parity Ethereum');
return true;
Copy link
Collaborator

@amaury1093 amaury1093 Mar 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to run fether-react past the "Launching node" screen, unless we put resolve(true) here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

Copy link
Collaborator

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Tried yarn start|electron|package, everything works 💯

@amaury1093
Copy link
Collaborator

@Tbaut Would you like to give a last try before merging?

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit: nevermind, old commit

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay thank you so much, it works well on Linux and Windows from my tests!
Just nit pick.

Tbaut and others added 2 commits March 21, 2019 17:15
Co-Authored-By: axelchalon <xaxel@protonmail.com>
@Tbaut Tbaut merged commit 674e3bf into master Mar 21, 2019
@Tbaut Tbaut deleted the ac-parity-bbundling branch March 21, 2019 17:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundle Parity Ethereum in Fether's binary Fether shouldn't download Parity if Parity was not found on the machine but is still running

4 participants