-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Improve block-selection strategy #10727
Improve block-selection strategy #10727
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, only have some small comments. We also need #10669 merged before this PR.
client/beefy/src/worker.rs
Outdated
@@ -146,18 +141,28 @@ where | |||
B: Block, | |||
BE: Backend<B>, | |||
C: Client<B, BE>, | |||
C::Api: BeefyApi<B>, | |||
C::Api: BeefyApi<B, NumberFor<B>>, | |||
{ | |||
/// Return `true`, if we should vote on block `number` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Return `true`, if we should vote on block `number` | |
/// Return `true`, if we should vote on block with `header` |
client/beefy/src/worker.rs
Outdated
let session_start = if let Some(session_boundary) = session_boundary { | ||
session_boundary | ||
} else { | ||
debug!(target: "beefy", "🥩 Could not retrieve session boundary- won't vote for: {:?}", number); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at least warning here:
debug!(target: "beefy", "🥩 Could not retrieve session boundary- won't vote for: {:?}", number); | |
warn!(target: "beefy", "🥩 Could not retrieve session boundary - won't vote for: {:?}", number); |
fn should_vote_on(&self, header: &B::Header) -> bool { | ||
let number = *header.number(); | ||
let at = BlockId::hash(header.hash()); | ||
let session_boundary = self.client.runtime_api().get_session_boundary(&at).ok(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to open an enhancement issue to cache session boundary in the worker and not have to call runtime api for every block here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep that in mind.
client/beefy/src/worker.rs
Outdated
// if the session_start as a mandatory block does not have a beefy justification yet, we vote on | ||
// it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
// if the session_start as a mandatory block does not have a beefy justification yet, we vote on | |
// it | |
// if the session_start as a mandatory block does not have a beefy justification yet, | |
// we vote on it |
client/beefy/src/lib.rs
Outdated
/// Minimal delta between blocks, BEEFY should vote for | ||
pub min_block_delta: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not remove this. You can still use it on top of your changes as described in beefy.md #L224.
… david/beefy-round-selection
…bstrate into david/beefy-round-selection
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Bump |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Alternative PR #10882 merged |
Fixes paritytech/grandpa-bridge-gadget#16
Round selection formula updated to match
as outlined in https://github.com/paritytech/grandpa-bridge-gadget/blob/td-docs/docs/beefy.md#round-selection
Session boundary API that is used here is already implemented in #10669