diff --git a/crates/eips/src/eip7002.rs b/crates/eips/src/eip7002.rs new file mode 100644 index 00000000000..0400f9631fa --- /dev/null +++ b/crates/eips/src/eip7002.rs @@ -0,0 +1,25 @@ +//! Contains WithdrawalRequest types, first introduced in the [Prague hardfork](https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md). +//! +//! See also [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002): Execution layer triggerable withdrawals + +use alloy_primitives::{Address, FixedBytes}; + +/// Represents an execution layer triggerable withdrawal request. +/// +/// See [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] +#[cfg_attr( + any(test, feature = "arbitrary"), + derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) +)] +pub struct WithdrawalRequest { + /// Address of the source of the exit. + pub source_address: Address, + /// Validator public key. + pub validator_public_key: FixedBytes<48>, + /// Amount of withdrawn ether in gwei. + #[cfg_attr(feature = "serde", serde(with = "alloy_serde::u64_via_ruint"))] + pub amount: u64, +} diff --git a/crates/eips/src/lib.rs b/crates/eips/src/lib.rs index 8a519b02116..89b0f3074a7 100644 --- a/crates/eips/src/lib.rs +++ b/crates/eips/src/lib.rs @@ -33,10 +33,12 @@ pub mod eip2930; pub mod eip4788; +pub mod eip4895; + pub mod eip4844; pub use eip4844::{calc_blob_gasprice, calc_excess_blob_gas}; pub mod eip6110; pub mod merge; -pub mod eip4895; +pub mod eip7002; diff --git a/crates/rpc-types-engine/src/exit.rs b/crates/rpc-types-engine/src/exit.rs deleted file mode 100644 index 0f22bdb790e..00000000000 --- a/crates/rpc-types-engine/src/exit.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! Contains Exit types, first introduced in the Prague hardfork: -//! -//! See also [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110). - -use alloy_primitives::{Address, FixedBytes}; -use serde::{Deserialize, Serialize}; - -/// This structure maps onto the exit object -#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ExitV1 { - /// Address of the source of the exit. - pub source_address: Address, - /// Validator public key. - pub pubkey: FixedBytes<48>, - /// Amount of withdrawn ether in gwei. - #[serde(with = "alloy_serde::u64_via_ruint")] - pub amount: u64, -} diff --git a/crates/rpc-types-engine/src/lib.rs b/crates/rpc-types-engine/src/lib.rs index 0d4663b8e26..7a70bdd4083 100644 --- a/crates/rpc-types-engine/src/lib.rs +++ b/crates/rpc-types-engine/src/lib.rs @@ -21,7 +21,6 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] mod cancun; -mod exit; mod forkchoice; mod identification; mod jwt; @@ -30,13 +29,15 @@ pub mod payload; mod transition; pub use self::{ - cancun::*, exit::*, forkchoice::*, identification::*, jwt::*, optimism::*, payload::*, - transition::*, + cancun::*, forkchoice::*, identification::*, jwt::*, optimism::*, payload::*, transition::*, }; #[doc(inline)] pub use alloy_eips::eip6110::DepositReceipt; +#[doc(inline)] +pub use alloy_eips::eip7002::WithdrawalRequest as WithdrawalRequestV1; + /// The list of all supported Engine capabilities available over the engine endpoint. pub const CAPABILITIES: [&str; 12] = [ "engine_forkchoiceUpdatedV1", diff --git a/crates/rpc-types-engine/src/payload.rs b/crates/rpc-types-engine/src/payload.rs index 349a514c4bd..99a7a9d825c 100644 --- a/crates/rpc-types-engine/src/payload.rs +++ b/crates/rpc-types-engine/src/payload.rs @@ -1,7 +1,6 @@ //! Payload types. -use crate::ExitV1; use alloy_consensus::{Blob, Bytes48}; -use alloy_eips::eip6110::DepositReceipt; +use alloy_eips::{eip6110::DepositReceipt, eip7002::WithdrawalRequest}; use alloy_primitives::{Address, Bloom, Bytes, B256, B64, U256}; use alloy_rpc_types::{transaction::BlobTransactionSidecar, Withdrawal}; use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer}; @@ -417,8 +416,10 @@ pub struct ExecutionPayloadV4 { /// /// This maps directly to the Deposits defined in [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110). pub deposit_receipts: Vec, - /// Array of exits - pub exits: Vec, + /// Array of execution layer triggerable withdrawal requests. + /// + /// See [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002). + pub withdrawal_requests: Vec, } impl ExecutionPayloadV4 {