Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

BlockImport-Interface #12697

@mustermeiszer

Description

@mustermeiszer

This issue is more a temperature check, whether there is a will to change the BlockImport interface.

Currently, the traits needed for a "client" are all - I did not check every trait, but most - taking &self as a parameter, with the sole conception of BlockImport that is taking &mut self introduced in the following PR: #3058.

As the default Substrate client is usually used as an Arc<Client>, taking just &self this is very convenient. But due to the API of BlockImport many generic usages of client need an HRTB of the kind of for<'r> &'r Client: BlockImport in order to use it behind an Arc<Client>, while some still hide it under an Arc<Mutex<Client>> in order to satisfy the traits API.

While developing FUDGE I tried to be generic at all points, in order to be flexible with possible alternative implementations of the core structs that satisfy backend, client and pool needs. But the API of BlockImport forces me to either use the restrictive HRTB or hide the generic client behind a Mutex, which is unnecessary as I know the client takes care of interior mutability itself.

So, my main point is:

  • Is there a chance to change the API of BlockImport and basically enforce every implementation to take care of interior mutability

OR

  • live with the fact that in order to use a generic client there is a need for a "restrictive" HRTB or an Mutex

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions