Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Get the light client to compile for wasm #7915

Closed
tomaka opened this issue Feb 16, 2018 · 9 comments
Closed

Get the light client to compile for wasm #7915

tomaka opened this issue Feb 16, 2018 · 9 comments
Assignees
Labels
F5-task 🎬 Generic label for things that just have to get done but are no issues in first place. M4-core ⛓ Core client code / Rust. P7-nicetohave 🐕 Issue is worth doing eventually. Q7-involved 💪 Can be fixed by a team of developers and probably takes some time.
Milestone

Comments

@tomaka
Copy link
Contributor

tomaka commented Feb 16, 2018

cc @rphmeier

In order to be able to run the light client inside of a browser extension.

Problematic libraries include mio (doesn't support emscripten), ring (uses raw assembly), rocksdb and openssl (both will be hard to compile).

@tomaka tomaka added P7-nicetohave 🐕 Issue is worth doing eventually. Q7-involved 💪 Can be fixed by a team of developers and probably takes some time. labels Feb 16, 2018
@5chdn 5chdn modified the milestones: 1.10, 1.11 Feb 18, 2018
@kirushik
Copy link
Collaborator

openssl will likely be replaced with rustls as a part of #7829, so it's eventually will be the ring issue again.

@tomaka
Copy link
Contributor Author

tomaka commented Feb 20, 2018

A good first step for this issue is either #7954 or #7955.

@rphmeier
Copy link
Contributor

rphmeier commented Feb 21, 2018

I would break up the tasks for this like so:

  • Take ethcore-io stuff out of ethcore to cut out the mio dependency.
  • Break out any explicit dependency on ethcore-network from ethcore-light, instead doing everything through traits
  • Break out any explicit dependency on rocksdb from ethcore-light (this may already not exist as everything is done through the KeyValueDb trait).
  • Separate the light client sync algorithm from the ethsync module to get rid of ethcore-network dependency.
  • Compile ethcore-light, parity-rpc, and new ethcore-light-sync crate for WASM.
  • Write a Rust wrapper which expects extern functions that can provide network and DB context somehow and also exports a function for making RPC calls.
  • Write JS code that uses libp2p and local storage to fulfill the requirements of the Rust wrapper and can use its RPC function to answer its queries

Ring will definitely pose an issue because signing libraries are depended on by parity-rpc transitively through the ethkey dependency. We might need to further generalize or split up this crate to avoid that and provide the crypto stuff on the JS side or through some other library :\

@tomaka
Copy link
Contributor Author

tomaka commented Mar 2, 2018

Should the network code be hard-coded to libp2p/devp2p (eg. pass an instance of libp2p::Transport), or should it be more generic?

I'd go for the first option, because Parity may depend on some very specific networking behaviours. If we go for the second option, not only would the API be very complex, but every single corner case would need to be documented.

@rphmeier
Copy link
Contributor

rphmeier commented Mar 2, 2018

Keeping it generic seems the best way to make it testable. Right now the light client network code is fairly network-independent and exposes a few hooks that can be called by devp2p or libp2p or an in-memory test network.

In general, how are you supposed to unit test libp2p-based code?

@tomaka
Copy link
Contributor Author

tomaka commented Mar 2, 2018

In general, how are you supposed to unit test libp2p-based code?

You can fairly easily create an implementation of the Transport trait that reads/write to/from memory, or that calls a custom handler.

@tomaka tomaka mentioned this issue Mar 4, 2018
@tomaka
Copy link
Contributor Author

tomaka commented Mar 7, 2018

Take ethcore-io stuff out of ethcore to cut out the mio dependency.

This is really difficult, so instead I suggest adding an optional mio feature to ethcore-io.
Only network-devp2p would require that mio feature.

EDIT: Although I'm not sure ; removing ethcore-io would definitely be a much cleaner solution.

@tomaka
Copy link
Contributor Author

tomaka commented Jul 13, 2018

@5chdn 5chdn modified the milestones: 2.1, 2.2 Jul 17, 2018
@5chdn 5chdn added this to the 2.3 milestone Sep 25, 2018
@5chdn 5chdn added M4-core ⛓ Core client code / Rust. F5-task 🎬 Generic label for things that just have to get done but are no issues in first place. labels Sep 25, 2018
@5chdn 5chdn modified the milestones: 2.3, 2.4 Oct 29, 2018
@5chdn 5chdn modified the milestones: 2.4, 2.5 Jan 10, 2019
@5chdn 5chdn modified the milestones: 2.5, 2.6 Feb 21, 2019
@soc1c soc1c modified the milestones: 2.6, 2.7 Apr 2, 2019
@adria0
Copy link

adria0 commented Jul 27, 2020

Closing issue due to its stale state.

@adria0 adria0 closed this as completed Jul 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F5-task 🎬 Generic label for things that just have to get done but are no issues in first place. M4-core ⛓ Core client code / Rust. P7-nicetohave 🐕 Issue is worth doing eventually. Q7-involved 💪 Can be fixed by a team of developers and probably takes some time.
Projects
None yet
Development

No branches or pull requests

6 participants