-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(rpc): define traits for stateless APIs #13016
Draft
syjn99
wants to merge
2
commits into
paradigmxyz:main
Choose a base branch
from
syjn99:feature/stateless-api-trait
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+276
−5
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,45 @@ pub trait EngineApi<Engine: EngineTypes> { | |
execution_requests: Requests, | ||
) -> RpcResult<PayloadStatus>; | ||
|
||
/// Analogous to `new_payload_v1`, but with the addition of a witness. | ||
/// | ||
/// Caution: This should not accept the `withdrawals` field | ||
#[method(name = "newPayloadWithWitnessV1")] | ||
async fn new_payload_with_witness_v1( | ||
&self, | ||
payload: ExecutionPayloadV1, | ||
) -> RpcResult<PayloadStatus>; | ||
|
||
/// Analogous to `new_payload_v2`, but with the addition of a witness. | ||
#[method(name = "newPayloadWithWitnessV2")] | ||
async fn new_payload_with_witness_v2( | ||
&self, | ||
payload: ExecutionPayloadInputV2, | ||
) -> RpcResult<PayloadStatus>; | ||
|
||
/// Analogous to `new_payload_v3`, but with the addition of a witness. | ||
/// | ||
/// Post Cancun payload handler | ||
#[method(name = "newPayloadWithWitnessV3")] | ||
async fn new_payload_with_witness_v3( | ||
&self, | ||
payload: ExecutionPayloadV3, | ||
versioned_hashes: Vec<B256>, | ||
parent_beacon_block_root: B256, | ||
) -> RpcResult<PayloadStatus>; | ||
|
||
/// Analogous to `new_payload_v4`, but with the addition of a witness. | ||
/// | ||
/// Post Prague payload handler | ||
#[method(name = "newPayloadWithWitnessV4")] | ||
async fn new_payload_with_witness_v4( | ||
&self, | ||
payload: ExecutionPayloadV3, | ||
versioned_hashes: Vec<B256>, | ||
parent_beacon_block_root: B256, | ||
execution_requests: Requests, | ||
) -> RpcResult<PayloadStatus>; | ||
|
||
/// See also <https://github.com/ethereum/execution-apis/blob/6709c2a795b707202e93c4f2867fa0bf2640a84f/src/engine/paris.md#engine_forkchoiceupdatedv1> | ||
/// | ||
/// Caution: This should not accept the `withdrawals` field in the payload attributes. | ||
|
@@ -100,6 +139,45 @@ pub trait EngineApi<Engine: EngineTypes> { | |
payload_attributes: Option<Engine::PayloadAttributes>, | ||
) -> RpcResult<ForkchoiceUpdated>; | ||
|
||
/// Analogous to `fork_choice_updated_v1`, but with the addition of a witness. | ||
/// | ||
/// Caution: This should not accept the `withdrawals` field in the payload attributes. | ||
#[method(name = "forkchoiceUpdatedWithWitnessV1")] | ||
async fn fork_choice_updated_with_witness_v1( | ||
&self, | ||
fork_choice_state: ForkchoiceState, | ||
payload_attributes: Option<Engine::PayloadAttributes>, | ||
) -> RpcResult<ForkchoiceUpdated>; | ||
|
||
/// Analogous to `fork_choice_updated_v2`, but with the addition of a witness. | ||
/// | ||
/// Post Shanghai forkchoice update handler | ||
/// | ||
/// This is the same as `forkchoiceUpdatedWithWitnessV1`, but expects an additional | ||
/// `withdrawals` field in the `payloadAttributes`, if payload attributes are provided. | ||
/// | ||
/// Caution: This should not accept the `parentBeaconBlockRoot` field in the payload | ||
/// attributes. | ||
#[method(name = "forkchoiceUpdatedWithWitnessV2")] | ||
async fn fork_choice_updated_with_witness_v2( | ||
&self, | ||
fork_choice_state: ForkchoiceState, | ||
payload_attributes: Option<Engine::PayloadAttributes>, | ||
) -> RpcResult<ForkchoiceUpdated>; | ||
|
||
/// Analogous to `fork_choice_updated_v3`, but with the addition of a witness. | ||
/// Post Cancun forkchoice update handler | ||
/// | ||
/// This is the same as `forkchoiceUpdatedWithWitnessV2`, but expects an additional | ||
/// `parentBeaconBlockRoot` field in the `payloadAttributes`, if payload attributes | ||
/// are provided. | ||
#[method(name = "forkchoiceUpdatedWithWitnessV3")] | ||
async fn fork_choice_updated_with_witness_v3( | ||
&self, | ||
fork_choice_state: ForkchoiceState, | ||
payload_attributes: Option<Engine::PayloadAttributes>, | ||
) -> RpcResult<ForkchoiceUpdated>; | ||
|
||
/// See also <https://github.com/ethereum/execution-apis/blob/6709c2a795b707202e93c4f2867fa0bf2640a84f/src/engine/paris.md#engine_getpayloadv1> | ||
/// | ||
/// Returns the most recent version of the payload that is available in the corresponding | ||
|
@@ -217,6 +295,57 @@ pub trait EngineApi<Engine: EngineTypes> { | |
&self, | ||
versioned_hashes: Vec<B256>, | ||
) -> RpcResult<Vec<Option<BlobAndProofV1>>>; | ||
|
||
/// Analogous to newPayloadV1. | ||
/// This function operates in a stateless mode on top of a provided witness. | ||
/// | ||
/// See also <https://gist.github.com/karalabe/47c906f0ab4fdc5b8b791b74f084e5f9> | ||
/// | ||
/// Caution: This should not accept the `withdrawals` field | ||
#[method(name = "executeStatelessPayloadV1")] | ||
async fn execute_stateless_payload_v1( | ||
&self, | ||
payload: ExecutionPayloadV1, | ||
) -> RpcResult<PayloadStatus>; | ||
|
||
/// Analogous to newPayloadV2. | ||
/// This function operates in a stateless mode on top of a provided witness. | ||
/// | ||
/// See also <https://gist.github.com/karalabe/47c906f0ab4fdc5b8b791b74f084e5f9> | ||
#[method(name = "executeStatelessPayloadV2")] | ||
async fn execute_stateless_payload_v2( | ||
&self, | ||
payload: ExecutionPayloadInputV2, | ||
) -> RpcResult<PayloadStatus>; | ||
|
||
/// Analogous to newPayloadV3. | ||
/// This function operates in a stateless mode on top of a provided witness. | ||
/// | ||
/// See also <https://gist.github.com/karalabe/47c906f0ab4fdc5b8b791b74f084e5f9> | ||
/// | ||
/// Post Cancun payload handler | ||
#[method(name = "executeStatelessPayloadV3")] | ||
async fn execute_stateless_payload_v3( | ||
&self, | ||
payload: ExecutionPayloadV3, | ||
versioned_hashes: Vec<B256>, | ||
parent_beacon_block_root: B256, | ||
) -> RpcResult<PayloadStatus>; | ||
|
||
/// Analogous to newPayloadV4. | ||
/// This function operates in a stateless mode on top of a provided witness. | ||
/// | ||
/// See also <https://gist.github.com/karalabe/47c906f0ab4fdc5b8b791b74f084e5f9> | ||
/// | ||
/// Post Prague payload handler | ||
#[method(name = "executeStatelessPayloadV4")] | ||
async fn execute_stateless_payload_v4( | ||
&self, | ||
payload: ExecutionPayloadV3, | ||
versioned_hashes: Vec<B256>, | ||
parent_beacon_block_root: B256, | ||
execution_requests: Requests, | ||
) -> RpcResult<PayloadStatus>; | ||
Comment on lines
+340
to
+348
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this function no longer exists |
||
} | ||
|
||
/// A subset of the ETH rpc interface: <https://ethereum.github.io/execution-apis/api-documentation/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
how is this different from the existing payloadv3 function?
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.
You're right, it is same as
new_payload_vx
methods rn. I have a question about the scope of this PR: It seems new structs need to be defined(as I mentioned at alloy#12766), so I planned to touch the function signature after those structs are ready(I'm happy to be assigned to that issue also).Is there any good way to note that this method is not yet implemented? Or could you elaborate the scope more if I understood wrong?