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

remove preparePayload #83

Merged
merged 5 commits into from
Oct 14, 2021
Merged

remove preparePayload #83

merged 5 commits into from
Oct 14, 2021

Conversation

djrtwo
Copy link
Contributor

@djrtwo djrtwo commented Oct 12, 2021

As discussed at the amphora interop, we are combining engine_preparePayload functionality as an extension of engine_forkchoiceUpdated via an additional parameter. This avoids potential synchronicity issues that arise when the methods are decoupled.

Intuitively the call semantics become

  • "update your fork choice" (no payload build requested)
  • "update your fork choice and start building something valuable on top of it!" (payload build requested)

Changes enumerated below. I apologize that the diff isn't the easiest to parse:

  • Move prepare payload functionality to forkchoiceUpdated:
    • Remove preparePayload
    • Define PayloadAttributes object (the former fields from preparePayload) for use as an optional parameter in forkchoiceUpdated
    • Port all preparePayload specs to a subset of forkchoiceUpdated specs
    • Move definition of getPayload to be below forkchoiceUpdated to aid in readability/natural sequentiality of calls
  • Define payloadId procedurally based on input parameters (make bytes-8 instead of integer to avoid dealing with bytes to integer encoding). This greatly simplifies the requisite various return values for forkchoiceUpdated by not needing to return payloadId
  • Clean up forkchoiceUpdated return values. Now status SUCCESS or SYNCING OR return an Error

@djrtwo djrtwo changed the title [WIP] remove preparePayload remove preparePayload Oct 12, 2021
Copy link
Collaborator

@mkalinin mkalinin left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍 Added a couple of minor suggestions

src/engine/specification.md Outdated Show resolved Hide resolved
src/engine/specification.md Outdated Show resolved Hide resolved
@djrtwo
Copy link
Contributor Author

djrtwo commented Oct 14, 2021

Got a tentative 👍 from @mkalinin out of band.

Can @lightclient or @mkalinin give a final approval here?

src/engine/specification.md Outdated Show resolved Hide resolved
src/engine/specification.md Outdated Show resolved Hide resolved

#### Returns
None or an error

`Object|Error` - Either instance of response object or an error. Response object:
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't appear the errors that can be returned are described?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Must we describe all errors? Anything that actually fails on the client during this call might bubble up an error. At interop, the general idea was to have return values not error under normal operation (thus SYNCING instead of "error: block missing") and for errors to actually represent errors in the operation.

Peter made it seem like if any number of things fail in geth, they'd surface that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can have SUCCESS or you could be or enter into SYNCING. In the event that something fails outside of those two, you then send an error.

Can we define all such errors?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that's fair. I think the small thing that's bothering me is that Object|Error when Error doesn't feel very well defined. I will take a stab fixing this myself after we merge this though!

src/engine/specification.md Show resolved Hide resolved
Copy link
Contributor Author

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

I'm not sure we should restrict errors to only those specifically specified

See discussion points below


#### Returns
None or an error

`Object|Error` - Either instance of response object or an error. Response object:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Must we describe all errors? Anything that actually fails on the client during this call might bubble up an error. At interop, the general idea was to have return values not error under normal operation (thus SYNCING instead of "error: block missing") and for errors to actually represent errors in the operation.

Peter made it seem like if any number of things fail in geth, they'd surface that here.


#### Returns
None or an error

`Object|Error` - Either instance of response object or an error. Response object:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can have SUCCESS or you could be or enter into SYNCING. In the event that something fails outside of those two, you then send an error.

Can we define all such errors?

src/engine/specification.md Show resolved Hide resolved
djrtwo and others added 2 commits October 14, 2021 11:56
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
@lightclient
Copy link
Member

Fair points - I'm happy to merge this PR and improve the clarity of the error codes in a subsequent PR :)


`Object|Error` - Either instance of response object or an error. Response object:
1. `status`: `String` - The result of updating the fork choice
- `SUCCESS` - The fork choice is successfully updated, and if requested, the payload build process has successfully started
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is SUCCESS status supposed to mean? Success fo receiving the call or updating the fork choice state? The former doesn't seem valuable as JSON-RPC would send a respond in any case indicating whether it's been successfully received or not. The latter implies the failure scenario, one of such scenarios is the absence of either finalized or head block coming in the method call; and if we have a success scenario signalled in the response then the failure should be signalled as well. Or we may rename SUCCESS to ACK to avoid confusion which won't be useful by itself but would allow for SYNCING to be returned as an alternative.

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.

None yet

3 participants