feat(optimism): Implement conversion of ExecutionPayloadBaseV1 into OpNextBlockEnvAttributes (#18097)

This commit is contained in:
Roman Hodulák
2025-08-27 15:30:47 +02:00
committed by GitHub
parent 615bd4a30f
commit 9d1ec366f8
3 changed files with 16 additions and 0 deletions

1
Cargo.lock generated
View File

@@ -9324,6 +9324,7 @@ dependencies = [
"reth-errors",
"reth-evm",
"reth-execution-types",
"reth-optimism-evm",
"reth-optimism-primitives",
"reth-primitives-traits",
"reth-revm",

View File

@@ -13,6 +13,7 @@ workspace = true
[dependencies]
# reth
reth-optimism-primitives = { workspace = true, features = ["serde"] }
reth-optimism-evm.workspace = true
reth-chain-state = { workspace = true, features = ["serde"] }
reth-primitives-traits = { workspace = true, features = ["serde"] }
reth-execution-types = { workspace = true, features = ["serde"] }

View File

@@ -1,6 +1,7 @@
use alloy_eips::eip4895::Withdrawal;
use alloy_primitives::{Address, Bloom, Bytes, B256, U256};
use alloy_rpc_types_engine::PayloadId;
use reth_optimism_evm::OpNextBlockEnvAttributes;
use reth_optimism_primitives::OpReceipt;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
@@ -93,3 +94,16 @@ pub struct ExecutionPayloadFlashblockDeltaV1 {
/// The withdrawals root of the block.
pub withdrawals_root: B256,
}
impl From<ExecutionPayloadBaseV1> for OpNextBlockEnvAttributes {
fn from(value: ExecutionPayloadBaseV1) -> Self {
Self {
timestamp: value.timestamp,
suggested_fee_recipient: value.fee_recipient,
prev_randao: value.prev_randao,
gas_limit: value.gas_limit,
parent_beacon_block_root: Some(value.parent_beacon_block_root),
extra_data: value.extra_data,
}
}
}