Skip to content

les: do not directly import package eth from les #22154

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

Closed
wants to merge 5 commits into from

Conversation

zsfelfoldi
Copy link
Contributor

This PR does some refactoring in order to remove all imports of package eth from package les (except for api_test which is an end-to-end test). Dependence on the eth package was ugly anyway but the current reason is that eth package imports the tracer which imports duktape which cannot be compiled with CGO and therefore go-fuzz could not fuzz anything in package les.

  • eth.Config is moved to package eth/protocols/eth (is that a good place for the config?)
  • eth.NewBloomIndexer is moved to package core (the rest of the indexer logic is there anyway)
  • eth.CreateConsensusEngine is passed as a function parameter to les.New

les/client.go Outdated
// New creates an instance of the light client.
func New(stack *node.Node, config *eth.Config) (*LightEthereum, error) {
func New(stack *node.Node, config *eth.Config, cc consensusCreatorFn) (*LightEthereum, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use something a bit more friendly, perhaps

Suggested change
func New(stack *node.Node, config *eth.Config, cc consensusCreatorFn) (*LightEthereum, error) {
func New(stack *node.Node, config *eth.Config, mkEngineFn consensusCreatorFn) (*LightEthereum, error) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@fjl
Copy link
Contributor

fjl commented Jan 19, 2021

The config should probably live in a 'data package' that's shared between les and eth.
The package could be eth/ethconfig. This could also be the place for things like CreateConsensusEngine.

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

Successfully merging this pull request may close these issues.

3 participants