Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LES package refactor #20490

Closed
1 of 5 tasks
rjl493456442 opened this issue Dec 30, 2019 · 3 comments
Closed
1 of 5 tasks

LES package refactor #20490

rjl493456442 opened this issue Dec 30, 2019 · 3 comments
Assignees

Comments

@rjl493456442
Copy link
Member

rjl493456442 commented Dec 30, 2019

LES Protocol(light ethereum sub-protocol) contains two parts specs and relative implementations: LES server and LES client.

Usually LES server refers to a full ethereum node that can offer additional data services for free or not. Basically both server and client share the same protocol definition like protocol message, auxiliary structure definitions and etc. However most of the internal logic of these two parts are totally different.

For LES client, most logic defined is:

  • how to retrieve the specified piece of chain data or state data as well as the corresponding proof.
  • how to manage all connected servers and payment strategy

For LES server, most logic defined is:

  • how to serve requests from clients.
  • how to limit requests from clients
  • how to manage all connected clients and charge strategy

But now in the current implementation, we mix all these parts logic into the same package. It means it's very hard to maintain the code correctly in the long term. So this is a proposal for LES package clean up and refactor.

The approximate structure of les codebase looks like:

les
├── checkpointoracle
│   └── oracle.go
├── flowcontrol
│   ├── control.go
│   ├── logger.go
│   ├── manager.go
│   └── manager_test.go
├── lesclient
│   ├── api_backend.go
│   ├── backend.go
│   ├── bloombits.go
│   ├── common.go
│   ├── distributor
│   │   ├── distributor.go
│   │   └── request.go
│   ├── fetcher
│   │   ├── fetcher.go
│   │   └── ulc.go
│   ├── handler.go
│   ├── odr.go
│   ├── odr_requests.go
│   ├── peer.go
│   ├── retriever.go
│   ├── serverpool
│   │   └── serverpool.go
│   ├── sync.go
│   └── txrelay.go
├── lesserver
│   ├── api.go
│   ├── backend.go
│   ├── clientpool
│   │   ├── balance.go
│   │   ├── balance_test.go
│   │   └── clientpool.go
│   ├── costtracker.go
│   ├── enr_entry.go
│   ├── handler.go
│   ├── misc.go
│   ├── peers.go
│   └── servingqueue.go
├── metrics
│   └── metrics.go
├── protocol
│   ├── costable.go
│   └── protocol.go
├── server
│   ├── backend.go
│   ├── common.go
│   ├── costtracker.go
│   ├── handler.go
│   ├── peer.go
│   └── servingqueue.go
└── utilities
    ├── execqueue.go
    ├── execqueue_test.go
    ├── extendablemap.go
    ├── randselect_test.go
    └── randselector.go

Basically I propose to split a few common utilities used by both server and client in the utilities sub-package. All protocol relative message and structures are all moved to protocol sub-package.

All in all, it's the purposal for cleanup current les package for long term maintenance. Need input from internal team members especially @zsfelfoldi .

@rjl493456442 rjl493456442 self-assigned this Dec 30, 2019
@rjl493456442
Copy link
Member Author

https://github.com/rjl493456442/go-ethereum/tree/separate-les is an experiment branch for revamp

@rjl493456442
Copy link
Member Author

In the server side, we have two logic modules: flow control and capacity management.

For the flow control, it's a shared package used by client and server, which capacity management is server special. However now a few capacity management relative code is mixed in flow control package.

@gballet
Copy link
Member

gballet commented May 9, 2023

LES will be rewritten based on the new beacon light client work. Closing.

@gballet gballet closed this as completed May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants