paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

Better offline detection for authoring #1475

Open arkpar opened 5 years ago

arkpar commented 5 years ago

Currently validators that go offline continue producing blocks and end up on a fork thath they can't reorg from because of the state pruning.

Validators on chains other than dev should not be producing blocks when offline or having zero peers or not seeing blocks from someone else.

rphmeier: I would suggest extending SyncOracle to serve this purpose as well

xlc commented 5 years ago

Is there a pruning mode that only prune up to last finalized block? So that it never prune state from unfinalized blocks and able to reorg when connected to rest of the networks

gavofyork commented 5 years ago

@xlc sadly not, but that should be introduced in #1652

gavofyork commented 5 years ago

We'll need a fairly clever definition of "offline" for this to work well.

rphmeier commented 5 years ago

@arkpar You did something here (although I don't recall which PR), do you think it's enough to close or downgrade the issue?

arkpar commented 5 years ago

Being offline is currently just having no peers. This is good enough for now, but should be made more sophisticated in the future. E.g. not receiving new blocks for a certain period of time.

rphmeier commented 5 years ago

not receiving new blocks for a certain period of time.

That could be dangerous if there is a big network partition (especially in quorum-based consensus engines). You could end up in a self-reinforcing state where no authorities are making blocks because no authorities are making blocks ...