|
1 | 1 | use crate::Provider; |
2 | 2 | use alloy_eips::eip7685::RequestsOrHash; |
3 | 3 | use alloy_network::Network; |
4 | | -use alloy_primitives::{BlockHash, Bytes, B256, U64}; |
| 4 | +use alloy_primitives::{BlockHash, Bytes, B128, B256, U64}; |
5 | 5 | use alloy_rpc_types_engine::{ |
6 | 6 | BlobAndProofV1, BlobAndProofV2, ClientVersionV1, ExecutionPayloadBodiesV1, |
7 | 7 | ExecutionPayloadBodiesV2, ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, |
8 | 8 | ExecutionPayloadEnvelopeV4, ExecutionPayloadEnvelopeV5, ExecutionPayloadEnvelopeV6, |
9 | 9 | ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3, ExecutionPayloadV4, |
10 | | - ForkchoiceState, ForkchoiceUpdated, PayloadAttributes, PayloadId, PayloadStatus, |
| 10 | + ForkchoiceState, ForkchoiceUpdated, ForkchoiceUpdatedResponseV2, PayloadAttributes, PayloadId, |
| 11 | + PayloadStatus, PayloadStatusV2, |
11 | 12 | }; |
12 | 13 | use alloy_transport::TransportResult; |
13 | 14 |
|
@@ -76,6 +77,18 @@ pub trait EngineApi<N>: Send + Sync { |
76 | 77 | execution_requests: RequestsOrHash, |
77 | 78 | ) -> TransportResult<PayloadStatus>; |
78 | 79 |
|
| 80 | + /// Sends the given payload to the execution layer client, as specified for the Bogota fork. |
| 81 | + /// |
| 82 | + /// See also <https://github.com/ethereum/execution-apis/blob/main/src/engine/bogota.md#engine_newpayloadv6> |
| 83 | + async fn new_payload_v6( |
| 84 | + &self, |
| 85 | + payload: ExecutionPayloadV4, |
| 86 | + versioned_hashes: Vec<B256>, |
| 87 | + parent_beacon_block_root: B256, |
| 88 | + execution_requests: RequestsOrHash, |
| 89 | + inclusion_list_transactions: Vec<Bytes>, |
| 90 | + ) -> TransportResult<PayloadStatusV2>; |
| 91 | + |
79 | 92 | /// Updates the execution layer client with the given fork choice, as specified for the Paris |
80 | 93 | /// fork. |
81 | 94 | /// |
@@ -120,6 +133,22 @@ pub trait EngineApi<N>: Send + Sync { |
120 | 133 | payload_attributes: Option<PayloadAttributes>, |
121 | 134 | ) -> TransportResult<ForkchoiceUpdated>; |
122 | 135 |
|
| 136 | + /// Updates the execution layer client with the given fork choice, as specified for the Bogota |
| 137 | + /// fork. |
| 138 | + /// |
| 139 | + /// `custody_columns` is the custody-column bitmask used for [EIP-8070] sparse blobpool |
| 140 | + /// signaling. It must be 16 bytes when set. |
| 141 | + /// |
| 142 | + /// [EIP-8070]: https://eips.ethereum.org/EIPS/eip-8070 |
| 143 | + /// |
| 144 | + /// See also <https://github.com/ethereum/execution-apis/blob/main/src/engine/bogota.md#engine_forkchoiceupdatedv5> |
| 145 | + async fn fork_choice_updated_v5( |
| 146 | + &self, |
| 147 | + fork_choice_state: ForkchoiceState, |
| 148 | + payload_attributes: Option<PayloadAttributes>, |
| 149 | + custody_columns: Option<B128>, |
| 150 | + ) -> TransportResult<ForkchoiceUpdatedResponseV2>; |
| 151 | + |
123 | 152 | /// Retrieves an execution payload from a previously started build process, as specified for the |
124 | 153 | /// Paris fork. |
125 | 154 | /// |
@@ -362,6 +391,28 @@ where |
362 | 391 | .await |
363 | 392 | } |
364 | 393 |
|
| 394 | + async fn new_payload_v6( |
| 395 | + &self, |
| 396 | + payload: ExecutionPayloadV4, |
| 397 | + versioned_hashes: Vec<B256>, |
| 398 | + parent_beacon_block_root: B256, |
| 399 | + execution_requests: RequestsOrHash, |
| 400 | + inclusion_list_transactions: Vec<Bytes>, |
| 401 | + ) -> TransportResult<PayloadStatusV2> { |
| 402 | + self.client() |
| 403 | + .request( |
| 404 | + "engine_newPayloadV6", |
| 405 | + ( |
| 406 | + payload, |
| 407 | + versioned_hashes, |
| 408 | + parent_beacon_block_root, |
| 409 | + execution_requests, |
| 410 | + inclusion_list_transactions, |
| 411 | + ), |
| 412 | + ) |
| 413 | + .await |
| 414 | + } |
| 415 | + |
365 | 416 | async fn fork_choice_updated_v1( |
366 | 417 | &self, |
367 | 418 | fork_choice_state: ForkchoiceState, |
@@ -402,6 +453,20 @@ where |
402 | 453 | .await |
403 | 454 | } |
404 | 455 |
|
| 456 | + async fn fork_choice_updated_v5( |
| 457 | + &self, |
| 458 | + fork_choice_state: ForkchoiceState, |
| 459 | + payload_attributes: Option<PayloadAttributes>, |
| 460 | + custody_columns: Option<B128>, |
| 461 | + ) -> TransportResult<ForkchoiceUpdatedResponseV2> { |
| 462 | + self.client() |
| 463 | + .request( |
| 464 | + "engine_forkchoiceUpdatedV5", |
| 465 | + (fork_choice_state, payload_attributes, custody_columns), |
| 466 | + ) |
| 467 | + .await |
| 468 | + } |
| 469 | + |
405 | 470 | async fn get_payload_v1(&self, payload_id: PayloadId) -> TransportResult<ExecutionPayloadV1> { |
406 | 471 | self.client().request("engine_getPayloadV1", (payload_id,)).await |
407 | 472 | } |
|
0 commit comments