Skip to content

Commit

Permalink
Merge branch 'main' into make_stats
Browse files Browse the repository at this point in the history
  • Loading branch information
ilitteri authored Dec 5, 2024
2 parents ad820df + 378fa53 commit 89bd27a
Show file tree
Hide file tree
Showing 10 changed files with 564 additions and 221 deletions.
1 change: 1 addition & 0 deletions crates/blockchain/dev/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub async fn start_block_producer(
execution_payload_response.execution_payload,
execution_payload_response
.blobs_bundle
.unwrap_or_default()
.commitments
.iter()
.map(|commitment| {
Expand Down
36 changes: 21 additions & 15 deletions crates/blockchain/dev/utils/engine_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ use ethereum_types::H256;
use ethrex_rpc::{
engine::{
fork_choice::ForkChoiceUpdatedV3,
payload::{GetPayloadV3Request, NewPayloadV3Request},
payload::{
GetPayloadRequest, GetPayloadRequestVersion, GetPayloadV3Request, NewPayloadRequest,
NewPayloadRequestVersion, NewPayloadV3Request,
},
ExchangeCapabilitiesRequest,
},
types::{
fork_choice::{ForkChoiceResponse, ForkChoiceState, PayloadAttributesV3},
payload::{ExecutionPayloadResponse, ExecutionPayloadV3, PayloadStatus},
payload::{ExecutionPayload, ExecutionPayloadResponse, PayloadStatus},
},
utils::{RpcErrorResponse, RpcRequest, RpcSuccessResponse},
};
Expand Down Expand Up @@ -79,15 +82,10 @@ impl EngineClient {
state: ForkChoiceState,
payload_attributes: Option<PayloadAttributesV3>,
) -> Result<ForkChoiceResponse, EngineClientError> {
let request = ForkChoiceUpdatedV3 {
let request = RpcRequest::from(ForkChoiceUpdatedV3 {
fork_choice_state: state,
payload_attributes: Ok(payload_attributes),
}
.try_into()
.map_err(|e| {
ForkChoiceUpdateError::ConversionError(format!("Failed to convert to RPC request: {e}"))
})
.map_err(EngineClientError::from)?;
payload_attributes,
});

match self.send_request(request).await {
Ok(RpcResponse::Success(result)) => serde_json::from_value(result.result)
Expand All @@ -104,7 +102,11 @@ impl EngineClient {
&self,
payload_id: u64,
) -> Result<ExecutionPayloadResponse, EngineClientError> {
let request = GetPayloadV3Request { payload_id }.into();
let request = GetPayloadV3Request(GetPayloadRequest {
payload_id,
version: GetPayloadRequestVersion::V3,
})
.into();

match self.send_request(request).await {
Ok(RpcResponse::Success(result)) => serde_json::from_value(result.result)
Expand All @@ -119,14 +121,18 @@ impl EngineClient {

pub async fn engine_new_payload_v3(
&self,
execution_payload: ExecutionPayloadV3,
execution_payload: ExecutionPayload,
expected_blob_versioned_hashes: Vec<H256>,
parent_beacon_block_root: H256,
) -> Result<PayloadStatus, EngineClientError> {
let request = NewPayloadV3Request {
payload: execution_payload,
expected_blob_versioned_hashes,
parent_beacon_block_root,
new_payload_request: NewPayloadRequest {
payload: execution_payload,
version: NewPayloadRequestVersion::V3 {
expected_blob_versioned_hashes,
parent_beacon_block_root,
},
},
}
.into();

Expand Down
4 changes: 3 additions & 1 deletion crates/blockchain/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ pub fn create_payload(args: &BuildPayloadArgs, storage: &Store) -> Result<Block,
withdrawals_root: chain_config
.is_shanghai_activated(args.timestamp)
.then_some(compute_withdrawals_root(&args.withdrawals)),
blob_gas_used: Some(0),
blob_gas_used: chain_config
.is_cancun_activated(args.timestamp)
.then_some(0),
excess_blob_gas: chain_config.is_cancun_activated(args.timestamp).then_some(
calc_excess_blob_gas(
parent_block.excess_blob_gas.unwrap_or_default(),
Expand Down
Loading

0 comments on commit 89bd27a

Please sign in to comment.