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

Adapt client to support asynchronous backing #399

Merged
merged 16 commits into from
Feb 5, 2024

Conversation

Agusrodri
Copy link
Contributor

@Agusrodri Agusrodri commented Jan 31, 2024

Modifies the client to support future async backing, adapting it to the new kind of aura params.

Main changes

This PR refactors the way of handling how collators are spawned, from both the orchestrator and container-chains sides.
It deprecates the usage of OrchestratorAuraConsensus struct, alongside with its associated OrchestratorAuraWorker and related params.

The new approach consists on adding a new Collator struct, which has the following params:

/// Parameters for instantiating a [`Collator`].
pub struct Params<BI, CIDP, RClient, Proposer, CS> {
    /// A builder for inherent data builders.
    pub create_inherent_data_providers: CIDP,
    /// The block import handle.
    pub block_import: BI,
    /// An interface to the relay-chain client.
    pub relay_client: RClient,
    /// The keystore handle used for accessing parachain key material.
    pub keystore: KeystorePtr,
    /// The identifier of the parachain within the relay-chain.
    pub para_id: ParaId,
    /// The block proposer used for building blocks.
    pub proposer: Proposer,
    /// The collator service used for bundling proposals into collations and announcing
    /// to the network.
    pub collator_service: CS,
}

At the moment of spawning the node, the collators will wake up using a run function, that will be called using custom params (basic or lookahead ones) depending on if we are spawning the collator with async-backing enabled or not. Thus, basic params will be used without async-backing and lookahead ones will be used to spawn the node using the async-backing functionality.

Note

The lookahead implementation will be added in a future PR, when we are closer to enabling async-backing also at a runtime level.

@Agusrodri Agusrodri added B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes breaking Needs to be mentioned in breaking changes labels Jan 31, 2024
Copy link
Contributor

github-actions bot commented Jan 31, 2024

Coverage Report

(master)

@@                       Coverage Diff                        @@
##           master   agustin-client-async-backing      +/-   ##
================================================================
- Coverage   77.30%                         75.86%   -1.44%     
+ Files         105                            107       +2     
- Lines       26797                          25928     -869     
================================================================
- Hits        20715                          19668    -1047     
+ Misses       6082                           6260     +178     
Files Changed Coverage
/client/consensus/src/consensus_orchestrator.rs 0.00% (-77.90%) 🔽
/node/src/service.rs 23.35% (+1.52%) 🔼
/pallets/collator-assignment/src/lib.rs 94.63% (-0.23%) 🔽
/pallets/registrar/src/lib.rs 92.01% (+1.84%) 🔼
/pallets/registrar/src/weights.rs 50.00% (+11.65%) 🔼
/pallets/services-payment/src/lib.rs 84.56% (+6.86%) 🔼
/pallets/services-payment/src/weights.rs 0.00% (-26.47%) 🔽
/primitives/traits/src/lib.rs 100.00% (+6.25%) 🔼
/runtime/dancebox/src/lib.rs 81.32% (-0.59%) 🔽
/runtime/dancebox/tests/common/mod.rs 99.75% (-0.01%) 🔽
/runtime/dancebox/tests/integration_test.rs 99.71% (-0.01%) 🔽
/runtime/flashbox/src/lib.rs 43.87% (-1.42%) 🔽
/runtime/flashbox/tests/common/mod.rs 97.91% (-0.03%) 🔽

Coverage generated Mon Feb 5 14:10:27 UTC 2024

node/src/service.rs Outdated Show resolved Hide resolved
@girazoki
Copy link
Collaborator

girazoki commented Feb 1, 2024

all tests pass? wow

node/src/service.rs Outdated Show resolved Hide resolved
node/src/service.rs Outdated Show resolved Hide resolved
client/consensus/src/collators/basic.rs Show resolved Hide resolved
client/consensus/src/collators.rs Outdated Show resolved Hide resolved
node/src/service.rs Show resolved Hide resolved
@Agusrodri Agusrodri marked this pull request as ready for review February 2, 2024 22:56
Copy link
Contributor

@tmpolaczyk tmpolaczyk left a comment

Choose a reason for hiding this comment

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

Good job!

Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

I think it looks good overall!

@Agusrodri Agusrodri changed the title WIP: Adapt client to support asynchronous backing Adapt client to support asynchronous backing Feb 5, 2024
@Agusrodri Agusrodri merged commit 16ae4cc into master Feb 5, 2024
33 checks passed
@Agusrodri Agusrodri deleted the agustin-client-async-backing branch February 5, 2024 14:35
@Agusrodri Agusrodri mentioned this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes breaking Needs to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants