Skip to content

Add engine_getPayloadBodiesBy*V2 methods#9674

Merged
matkt merged 3 commits intohyperledger:mainfrom
mirgee:engine-payload-bodies
Jan 28, 2026
Merged

Add engine_getPayloadBodiesBy*V2 methods#9674
matkt merged 3 commits intohyperledger:mainfrom
mirgee:engine-payload-bodies

Conversation

@mirgee
Copy link
Contributor

@mirgee mirgee commented Jan 23, 2026

Adds the following two methods, which include BALs as part of the payload bodies, to the Engine API as per the proposed spec changes:

  • engine_getPayloadBodiesByHashV2
  • engine_getPayloadBodiesByRangeV2

Duplication was chosen over reuse for ease of implementation and simplicity (a lot of code and tests have been copied from engine_getPayloadBodiesBy*V1), but deduplication refactor is certainly possible in a follow up PR.

Closes: #9662

Signed-off-by: Miroslav Kovar <miroslavkovar@protonmail.com>
@mirgee mirgee force-pushed the engine-payload-bodies branch from b55a6b3 to a5f5c28 Compare January 23, 2026 06:47
Copy link
Contributor

@daniellehrner daniellehrner left a comment

Choose a reason for hiding this comment

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

I have some clarifying questions that might be fine. There is some code duplication, but we could clean that up in a future PR.


public class EngineGetPayloadBodiesByHashV2 extends ExecutionEngineJsonRpcMethod {

private static final int MAX_REQUEST_BLOCKS = 1024;
Copy link
Contributor

Choose a reason for hiding this comment

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

This limit seems not to be in the spec, how do other clients handle that?

Copy link
Contributor Author

@mirgee mirgee Jan 26, 2026

Choose a reason for hiding this comment

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

The specs define only the lower bound, it seems that it's up to clients to define the upper bound on the range:

Client software MUST support count values of at least 32 blocks. The call MUST return -38004: Too large request error if the requested range is too large.

Link to the quote.

}

private static String encodeBlockAccessList(final BlockAccessList blockAccessList) {
final BytesValueRLPOutput output = new BytesValueRLPOutput();
Copy link
Contributor

Choose a reason for hiding this comment

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

How are block access lists stored? It seems we are not storing them as RLP and need to encode them every single time. Why not store them as RLP directly?

Copy link
Contributor

Choose a reason for hiding this comment

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

BAL is RLP encoded. So in this case we are decoding BAL from RLP and encode it again in order to return it. clearly not optimized

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are storing them in RLP, decoding them every time on retrieval, and then sometimes re-encode them back to RLP when necessary. I agree this redundant round-trip is not ideal in those cases, but it is consistent with how block headers, block bodies and transaction receipts are currently handled.

return new JsonRpcSuccessResponse(reqId, engineGetPayloadBodiesResultV2);
}

protected int getMaxRequestBlocks() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Those methods are duplicated and are the same in EngineGetPayloadBodiesByHashV2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree there is a lot of duplication overall. Happy to clean it up in a follow-up PR 😇

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we create an issue for that @mirgee . I will merge the branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@matkt matkt enabled auto-merge (squash) January 27, 2026 20:03
@matkt matkt merged commit f4056ac into hyperledger:main Jan 28, 2026
46 checks passed
@mirgee mirgee deleted the engine-payload-bodies branch January 28, 2026 07:47
macfarla pushed a commit to CPerezz/besu that referenced this pull request Feb 6, 2026
Signed-off-by: Miroslav Kovar <miroslavkovar@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EIP-7928 - Block level Access Lists : implement engine_getBlockAccessListsBy BAL RPC APIs

3 participants