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

Don't mark blocks as invalid on context deadlines #14838

Merged
merged 4 commits into from
Jan 31, 2025

Conversation

potuz
Copy link
Contributor

@potuz potuz commented Jan 29, 2025

When processing state transition, if the error is because of a context deadline, do not mark it as invalid.

@potuz potuz requested a review from a team as a code owner January 29, 2025 11:02
@potuz potuz requested review from nalepae, saolyn and dB2510 January 29, 2025 11:02
@potuz potuz force-pushed the dont_mark_invalid_on_context_deadlines branch from 0935b35 to 365c245 Compare January 29, 2025 11:03
When processing state transition, if the error is because of a context
deadline, do not mark it as invalid.
@potuz potuz force-pushed the dont_mark_invalid_on_context_deadlines branch from 365c245 to 5d9c3d6 Compare January 29, 2025 11:05
Copy link
Member

@terencechain terencechain left a comment

Choose a reason for hiding this comment

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

we dont mark the block as invalid due to context error, it's being handle on the cache level. I think it's better to handle this on the cache level...

if ctx.Err() != nil { // Do not mark block as bad if it was due to context error.
return
}

@@ -468,6 +468,9 @@ func (s *Service) validateStateTransition(ctx context.Context, preState state.Be
stateTransitionStartTime := time.Now()
postState, err := transition.ExecuteStateTransition(ctx, preState, signed)
if err != nil {
if ctx.Err() == context.DeadlineExceeded {
Copy link
Member

Choose a reason for hiding this comment

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

Why not handle this for all context error? is deadline the only one? what about timeout?

terencechain
terencechain previously approved these changes Jan 29, 2025
@@ -468,6 +468,9 @@ func (s *Service) validateStateTransition(ctx context.Context, preState state.Be
stateTransitionStartTime := time.Now()
postState, err := transition.ExecuteStateTransition(ctx, preState, signed)
if err != nil {
if ctx.Err() != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

do we not need a log or error wrapper for context?

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 will be logged by the p2p package.

@james-prysm
Copy link
Contributor

you need to add a changelog

@potuz potuz added this pull request to the merge queue Jan 31, 2025
Merged via the queue into develop with commit 4a487ba Jan 31, 2025
17 checks passed
@potuz potuz deleted the dont_mark_invalid_on_context_deadlines branch January 31, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants