Skip to content
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: add OptimismExecutionPayloadV3 #242

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions crates/rpc-engine-types/src/optimism.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::PayloadAttributes;
use alloy_primitives::Bytes;
use crate::{ExecutionPayloadV2, PayloadAttributes};
use alloy_primitives::{Bytes, B256};
use serde::{Deserialize, Serialize};

/// Optimism Payload Attributes
Expand All @@ -24,6 +24,29 @@ pub struct OptimismPayloadAttributes {
pub gas_limit: Option<u64>,
}

/// This structure maps on the ExecutionPayloadV3 structure of the beacon chain spec.
///
/// See also: <https://github.com/ethereum/execution-apis/blob/6709c2a795b707202e93c4f2867fa0bf2640a84f/src/engine/shanghai.md#executionpayloadv2>
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should also reference the op spec:

sure, proposed here #244

pub struct OptimismExecutionPayloadV3 {
/// Inner V2 payload
#[serde(flatten)]
pub payload_inner: ExecutionPayloadV2,

/// Array of hex [`u64`] representing blob gas used, enabled with V3
/// See <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#ExecutionPayloadV3>
#[serde(with = "alloy_rpc_types::serde_helpers::u64_hex")]
pub blob_gas_used: u64,
/// Array of hex[`u64`] representing excess blob gas, enabled with V3
/// See <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#ExecutionPayloadV3>
#[serde(with = "alloy_rpc_types::serde_helpers::u64_hex")]
pub excess_blob_gas: u64,

/// Ecotone parent beacon block root
pub parent_beacon_block_root: B256,
}

#[cfg(test)]
mod tests {
use crate::ExecutionPayloadInputV2;
Expand Down
Loading