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

Execution API: execution requests serialization #14498

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
adding comments for exportable functions
  • Loading branch information
james-prysm committed Oct 2, 2024
commit 1a9cd9f7041d35c0ede7b867df3997d7d4feb8ab
3 changes: 3 additions & 0 deletions proto/engine/v1/electra.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
type ExecutionPayloadElectra = ExecutionPayloadDeneb
type ExecutionPayloadHeaderElectra = ExecutionPayloadHeaderDeneb

// GetDecodedExecutionRequests decodes the byte array in ExecutionBundleElectra and returns a ExecutionRequests container object
// based on specifications from EIP-7685
func (eb *ExecutionBundleElectra) GetDecodedExecutionRequests() (*ExecutionRequests, error) {
if len(eb.ExecutionRequests) == 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should this error out or return empty?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be the empty requests, we need to guarantee that the slice is not nil before though.

return nil, errors.New("no execution requests found")
Expand Down Expand Up @@ -93,6 +95,7 @@ func processRequestBytes(
return processRequestBytes(remainingBytes, requests)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a loop instead of a recursive algorithm is better here, the tail recursion elimination in this case is simple.

}

// EncodeExecutionRequests is a helper function that takes a ExecutionRequests container and converts it into a hash used for `engine_NewPayloadV4`
func EncodeExecutionRequests(eb *ExecutionRequests) (common.Hash, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Pending questions here on whether ordering would matter to the EL. cc @fjl

var executionRequestBytes []byte
depositBytes, err := encodeExecutionRequestsByType(0, eb.Deposits)
Expand Down
Loading