Skip to content

Commit 1c1f5f5

Browse files
authored
feat(provider): add bogota engine api methods (#4142)
1 parent df0a0b5 commit 1c1f5f5

1 file changed

Lines changed: 67 additions & 2 deletions

File tree

crates/provider/src/ext/engine.rs

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
use crate::Provider;
22
use alloy_eips::eip7685::RequestsOrHash;
33
use alloy_network::Network;
4-
use alloy_primitives::{BlockHash, Bytes, B256, U64};
4+
use alloy_primitives::{BlockHash, Bytes, B128, B256, U64};
55
use alloy_rpc_types_engine::{
66
BlobAndProofV1, BlobAndProofV2, ClientVersionV1, ExecutionPayloadBodiesV1,
77
ExecutionPayloadBodiesV2, ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3,
88
ExecutionPayloadEnvelopeV4, ExecutionPayloadEnvelopeV5, ExecutionPayloadEnvelopeV6,
99
ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3, ExecutionPayloadV4,
10-
ForkchoiceState, ForkchoiceUpdated, PayloadAttributes, PayloadId, PayloadStatus,
10+
ForkchoiceState, ForkchoiceUpdated, ForkchoiceUpdatedResponseV2, PayloadAttributes, PayloadId,
11+
PayloadStatus, PayloadStatusV2,
1112
};
1213
use alloy_transport::TransportResult;
1314

@@ -76,6 +77,18 @@ pub trait EngineApi<N>: Send + Sync {
7677
execution_requests: RequestsOrHash,
7778
) -> TransportResult<PayloadStatus>;
7879

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+
7992
/// Updates the execution layer client with the given fork choice, as specified for the Paris
8093
/// fork.
8194
///
@@ -120,6 +133,22 @@ pub trait EngineApi<N>: Send + Sync {
120133
payload_attributes: Option<PayloadAttributes>,
121134
) -> TransportResult<ForkchoiceUpdated>;
122135

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+
123152
/// Retrieves an execution payload from a previously started build process, as specified for the
124153
/// Paris fork.
125154
///
@@ -362,6 +391,28 @@ where
362391
.await
363392
}
364393

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+
365416
async fn fork_choice_updated_v1(
366417
&self,
367418
fork_choice_state: ForkchoiceState,
@@ -402,6 +453,20 @@ where
402453
.await
403454
}
404455

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+
405470
async fn get_payload_v1(&self, payload_id: PayloadId) -> TransportResult<ExecutionPayloadV1> {
406471
self.client().request("engine_getPayloadV1", (payload_id,)).await
407472
}

0 commit comments

Comments
 (0)