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

fix(octane/evmengine): handle engine errors #2469

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Conversation

corverroos
Copy link
Collaborator

Improve EngineAPI error handling:

  • Geth returns status:INVALID AND errors, so swallow errors if known status is returned.
  • Remaining errors (with unknown status) should only be temporary networking (or some unexpected geth error).
  • Timeout PrepareProposal after 10s, proposing an empty consensus block rather (other validators probably already moved on in any case.)
  • Timeout ProcessProposal after 1min, prevent blocking forever

issue: #2461

@@ -32,6 +38,11 @@ func makeProcessProposalRouter(app *App) *baseapp.MsgServiceRouter {
// It also updates some external state.
func makeProcessProposalHandler(router *baseapp.MsgServiceRouter, txConfig client.TxConfig) sdk.ProcessProposalHandler {
return func(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) {
// Only allow 10s to process a proposal. Reject proposal otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

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

good idea


return resp, nil
return engine.PayloadStatusV1{}, errors.New("nil error and unknown status", "status", resp.Status)
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be a [BUG]?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

possibly yeah

@@ -129,30 +108,33 @@ func (c engineClient) ForkchoiceUpdatedV3(ctx context.Context, update engine.For
const endpoint = "forkchoice_updated_v3"
defer latency(c.chain, endpoint)()

// isStatusOk returns true if the response status is valid.
isStatusOk := func(resp engine.ForkChoiceResponse) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious about this code style: why do you prefer wrapping a map with a closure over simply using a map given it's used once in the function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

functions are easy to read and document. Also slightly more concise

if isStatusOk(resp) {

vs

if okStatuses[resp.PayloadStatus.Status] {

@corverroos corverroos merged commit c5dc5fc into main Nov 13, 2024
19 checks passed
@corverroos corverroos deleted the corver/engineerrors branch November 13, 2024 13:28
0xHansLee added a commit to piplabs/story that referenced this pull request Nov 28, 2024
This PR is the commit from Omni to handle errors of engineAPI
(omni-network/omni#2469).

issue: none
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.

3 participants