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

Defer consensus verification #2350

Draft
wants to merge 52 commits into
base: master
Choose a base branch
from
Draft

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

How this works

How this was tested

Comment on lines 295 to 303
// If the set of preferred IDs already contains the preference, then the
// tail is guaranteed to already be set correctly. This is because the value
// returned from vote reports the next preferred block after the last
// preferred block that was voted for. If this block was previously
// preferred, then we know that following the preferences down the chain
// will return the current tail.
if ts.preferredIDs.Contains(preferred) {
return nil
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR removes this optimization. Should look into how important it was.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because it is incompatible with these changes or for some other reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wasn't really compatible - because we may still want to update our preference due to something passing verification that previously failed... When we change the code to evict invalid blocks - I think this optimization makes sense again.

parent, err := b.vm.getPreForkBlock(ctx, b.Block.Parent())
if err != nil {
return err
}
return parent.verifyPreForkChild(ctx, b)
}

func (b *preForkBlock) Verify(ctx context.Context) error {
return nil // Block verification is fully handled by VerifyProposer
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -866,6 +866,13 @@ func (b *blockClient) Parent() ids.ID {
return b.parentID
}

func (b *blockClient) VerifyProposer(ctx context.Context) error {
_, err := b.vm.client.BlockVerifyProposer(ctx, &vmpb.BlockVerifyProposerRequest{
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this required if the VM always returns nil? ava-labs/coreth@2486845

Is this an optimistic future where the VM would manage proposer validity?

}

func (b *postForkBlock) verifyPostForkChild(ctx context.Context, child *postForkBlock) error {
parentPChainHeight := b.PChainHeight()
Copy link
Contributor

@patrick-ogrady patrick-ogrady Nov 21, 2023

Choose a reason for hiding this comment

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

nit: variable declaration not needed here?

Base automatically changed from snowman-cleanup to dev November 21, 2023 18:50
@StephenButtolph StephenButtolph changed the base branch from dev to options-before-verify November 23, 2023 18:25
@StephenButtolph StephenButtolph modified the milestones: v1.10.17, v1.10.18 Nov 29, 2023
@StephenButtolph StephenButtolph modified the milestones: v1.10.18, v1.10.19 Dec 6, 2023
Copy link

github-actions bot commented Jan 7, 2024

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will cause this PR to ignore lifecycle events.

@StephenButtolph StephenButtolph removed this from the v1.10.19 milestone Jan 19, 2024
Base automatically changed from options-before-verify to master January 22, 2024 21:29
Copy link

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will cause this PR to ignore lifecycle events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress 🏗
Development

Successfully merging this pull request may close these issues.

3 participants