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

The future of enigma-p2p #142

Open
Isan-Rivkin opened this issue Apr 14, 2019 · 0 comments
Open

The future of enigma-p2p #142

Isan-Rivkin opened this issue Apr 14, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Isan-Rivkin
Copy link
Contributor

Isan-Rivkin commented Apr 14, 2019

This is a small compilation of things that I see as features and improvements that should be done in this project.

Improvements:

  1. Split the project into a few npm packages. This is a best practice for sure since the main idea of npm modules is 1 responsibility.
    This will allow easier maintenance, make the project more testable and allow more parallel work.
    For example,

    • cli module
    • jsonrpc module
    • nodeController module
    • taskManager module
    • state sync module
    • enigmaNode module
    • core communication module
    • logger module
    • ethereum module
  2. Use retry npm module instead of StoppableTask for peer discovery, it works better and based on exponential backoff interval.
    Make sure to use the random feature (article explaining why)

3)content synchronization:

  • Better state negotiation with the provider peer. Instead of connecting to a provider that announced some contract address (CID) and start syncing immediately, consider verifying first how synced is the provider with a req/res type of message.

req:

contractAddress : [...]
deltaFrom :  // if 0 then byte code is also necessary  
deltaTo: 

res:

canProvide : true/false 
  • Better fault tolerance for content synchronization (Handling errors, on failure, keep from existing state, don't start from scratch) generally, with time improve the sync process depending on the bottlenecks and bugs that will appear.

  • more parallelism during sync, currently sequential (contract + all deltas) one after another.

  1. replace leveldb with something else for TaskManager (rocksdb for example) because it's moving towards EOL and queries like getAllStuff() are not built in.

  2. Convert all the project to being promise based and use await/async. Even all the Actions, turn the execute(params) method into Promise.

  3. Use cache to check GET_LOCAL_STATE and GET_LL_TIPS- cache already implemented as a stand-alone unit.

  4. Blacklisting for bad behavior and a local reputation score for peers.

New Features:

  1. Write new modules or easy-to-migrate code to Typescript for interface safety

  2. To improve performance at scale: turn the project into a multi-process one using Node Cluster functionality for each runtime. (Core,NodeController,JsonRpc etc)

  3. Use the libp2p modularity to build the project for peer discovery.
    For example, replace inside libp2p-bundle all the modules with enigma's implementation.
    instead of 'libp2p-bootstrap' replace with our own bootstrap etc.
    This will be more efficient and easier to maintain.

  4. Pretty/friendly/Decoupled CLI - Make a new project called enigma-cli and let it import the enigma-p2p package and create a proper cli.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants