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

backing-performance: Evaluate only doing work on best block #3146

Closed
eskimor opened this issue May 31, 2021 · 6 comments
Closed

backing-performance: Evaluate only doing work on best block #3146

eskimor opened this issue May 31, 2021 · 6 comments
Labels
S0-design PR/Issue is in the design stage T5-parachains_protocol This PR/Issue is related to Parachains features and protocol changes.

Comments

@eskimor
Copy link
Member

eskimor commented May 31, 2021

Currently we start work on every imported block. This is really bad for performance as the work being done is significant, e.g. a collation for each fork, availability, full gossip, .... With each fork we significantly reduce the load we can potentially handle. Ideally we would only start work on the current best fork, as exposed in substrate.

This would need to be thought through though, as it might open attack vectors, as mentioned here.

@eskimor eskimor added the S0-design PR/Issue is in the design stage label May 31, 2021
@burdges
Copy link
Contributor

burdges commented Jun 1, 2021

It's tricky.. @AlistairStewart can tell you fun stories of chain splitting, but..

Almost all work done by polkadot validators should be approvals checks, including related gossip, but available candidates forks a couple blocks behind assignments and other work. We've trouble abandoning work once we've assigned ourselves, but we could delay work on BABE secondary blocks when a primary block appears. That's pretty BABE specific though and Sassafras obsoletes that, so I'm tempted to ignore that problem.

We should be prepared for workload increases when forks become longer than a couple blocks anyways since then we've somewhat different candidates, but..

Availability distribution happens immediately after backing, but similarly gets bounded by backer rules, although availability bitfield votes depend upon the chain. Approval checks and reconstruction benefit from the same backer rules, which limits damage when forks grow longer than a coupe blocks.

In brief, we should've already caught the bigger fish within this problem space, but..

Approval votes already create a mapping from grandpa votes possibly on future blocks back to best finalizable chain. We could explore grandpa informing our notion, not just of best chain, but of "the chain everyone wants to work on" somehow. It's tricky though..

@eskimor
Copy link
Member Author

eskimor commented Jun 1, 2021

Thanks @burdges !

@eskimor
Copy link
Member Author

eskimor commented Nov 16, 2021

The currently best fork as exposed by Substrate is unfortunately not really the best fork, but just the longest. Only BABE knows about the real best fork, so we would need to expose that information in order to implement anything in this regard.

@bkchr
Copy link
Member

bkchr commented Nov 17, 2021

@eskimor Babe does already exposes this information on import:
https://github.com/paritytech/substrate/blob/master/client/consensus/babe/src/lib.rs#L1613-L1637

Aka, the "best fork" should be set as best block.

@eskimor eskimor changed the title Evaluate only doing work on best block backing-performance: Evaluate only doing work on best block Nov 26, 2021
@eskimor
Copy link
Member Author

eskimor commented Nov 26, 2021

Prioritize according to results of #4302

@ordian ordian added the T5-parachains_protocol This PR/Issue is related to Parachains features and protocol changes. label Aug 16, 2022
@eskimor
Copy link
Member Author

eskimor commented Sep 1, 2022

Does not seem to be a major issue and will be resolved with SASSAFRAS anyway.

@eskimor eskimor closed this as completed Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S0-design PR/Issue is in the design stage T5-parachains_protocol This PR/Issue is related to Parachains features and protocol changes.
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants