Skip to content

Disable block production for the peer if it's not bioauth-unauthorized#101

Merged
dmitrylavrenov merged 8 commits intomasterfrom
techdebt-67
Sep 10, 2021
Merged

Disable block production for the peer if it's not bioauth-unauthorized#101
dmitrylavrenov merged 8 commits intomasterfrom
techdebt-67

Conversation

@dmitrylavrenov
Copy link
Contributor

Closes #67

@dmitrylavrenov dmitrylavrenov marked this pull request as draft August 24, 2021 10:54
@dmitrylavrenov
Copy link
Contributor Author

I think for today there are the following possible solutions to make it in a simple way.

  • Implement DisableValidators trait.
  • Implement CanAuthorWith trait.

Here is a documentation for DisableValidators trait - https://github.com/paritytech/substrate/blob/864d096214cbde236f1ced7fdf4017ac22f5e5f5/frame/support/src/traits/validation.rs#L249.
Here is using of it at the Aura consensus part - https://github.com/paritytech/substrate/blob/864d096214cbde236f1ced7fdf4017ac22f5e5f5/frame/aura/src/lib.rs#L95
According the first one I have the following vision, in case Aura for each new slot there should be a logic to make a list by index whether a node is able to be blockAuthor or not. But it allows you to produce and sign block within your runtime. After that it will be verified at the consensus layer between all nodes.

Here is a documentation for CanAuthorWith trait - https://github.com/paritytech/substrate/blob/026a8491694783dd95c9c3d2f917b11cf609cb49/primitives/consensus/common/src/lib.rs#L273.
Usage is here - https://github.com/paritytech/substrate/blob/4c3a55e7ca5c4c85c1eb53fd82ed71029d952510/client/consensus/slots/src/lib.rs#L511
So, here it starts when a new slot is triggered. But it doesn't allow you to produce and sign block within your runtime before block authoring. It happens during build_aura_worker - https://github.com/paritytech/substrate/blob/4c3a55e7ca5c4c85c1eb53fd82ed71029d952510/client/consensus/aura/src/lib.rs#L209

That's why I think that CanAuthorWith looks more suitable for this PR goals.

@dmitrylavrenov dmitrylavrenov marked this pull request as ready for review August 30, 2021 14:41
@dmitrylavrenov dmitrylavrenov requested a review from MOZGIII August 30, 2021 14:41
@dmitrylavrenov
Copy link
Contributor Author

One more thing. Maybe we should use this one - https://github.com/paritytech/substrate/blob/864d096214cbde236f1ced7fdf4017ac22f5e5f5/primitives/consensus/common/src/lib.rs#L91

@MOZGIII MOZGIII marked this pull request as draft September 1, 2021 06:58
@MOZGIII
Copy link
Contributor

MOZGIII commented Sep 1, 2021

Since work is ongoing here, I've set it back to draft. Please re-request review when you're ready.

@MOZGIII MOZGIII removed their request for review September 1, 2021 06:59
@dmitrylavrenov dmitrylavrenov marked this pull request as ready for review September 2, 2021 14:10
@MOZGIII MOZGIII self-assigned this Sep 7, 2021
Copy link
Contributor

@MOZGIII MOZGIII left a comment

Choose a reason for hiding this comment

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

I wanted to do some improvements, but we can address those later.

LGTM, except for outstanding comments.

@MOZGIII MOZGIII assigned dmitrylavrenov and unassigned MOZGIII Sep 10, 2021
@dmitrylavrenov dmitrylavrenov merged commit a198820 into master Sep 10, 2021
@dmitrylavrenov dmitrylavrenov deleted the techdebt-67 branch September 10, 2021 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Disable block production for the peer if it's not bioauth-unauthorized

2 participants