Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(server/v2/cometbft): optimistic execution #22560
feat(server/v2/cometbft): optimistic execution #22560
Changes from 12 commits
0b80553
4807332
907bcd1
a58e20d
082ddec
266d53f
857f14c
f78dbe0
5718170
6791357
05e8ee7
bc9250b
f24f35e
e91f209
c836cab
d6cf77e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Add error handling for Abort operation
The
Abort()
call could potentially return an error that should be handled to ensure proper cleanup.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.
Add error handling for Execute operation
The
Execute()
call should include error handling to properly handle and log any execution failures.Apply this diff:
📝 Committable suggestion
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.
Improve error handling in optimistic execution flow
WaitResult()
at line 497 is ignored but could indicate execution failures.Reset()
call at line 510 lacks error handling.Apply this diff:
📝 Committable suggestion
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.
Fix ineffectual assignment
The
fbResp
assignment on line 780 is never used. Consider removing it or adding assertions on the response content.📝 Committable suggestion
🧰 Tools
🪛 golangci-lint (1.62.2)
780-780: ineffectual assignment to fbResp
(ineffassign)
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.
🛠️ Refactor suggestion
Add assertions for optimistic execution state
The test should verify the optimistic execution state immediately after the wrong hash is processed, before the final assertion.
// Initialize FinalizeBlock with wrong hash - should abort optimistic execution // Because is aborted, the result comes from the normal execution fbResp, err = c.FinalizeBlock(context.Background(), fbReq) require.NotNil(t, fbResp) require.NoError(t, err) require.Equal(t, 2, calledTimes) +require.False(t, c.optimisticExec.Initialized(), "optimistic execution should be reset immediately after wrong hash")
📝 Committable suggestion
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.
🛠️ Refactor suggestion
Add test cases for concurrent optimistic executions
The test suite should include scenarios testing concurrent optimistic executions to ensure thread safety.
Consider adding a test case that simulates multiple goroutines attempting optimistic execution simultaneously: