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

chore: replace ExitV1 with WithdrawalRequest #672

Merged
merged 5 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions crates/eips/src/eip7002.rs
Original file line number Diff line number Diff line change
@@ -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,
}
4 changes: 3 additions & 1 deletion crates/eips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
19 changes: 0 additions & 19 deletions crates/rpc-types-engine/src/exit.rs

This file was deleted.

7 changes: 4 additions & 3 deletions crates/rpc-types-engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod cancun;
mod exit;
mod forkchoice;
mod identification;
mod jwt;
Expand All @@ -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",
Expand Down
9 changes: 5 additions & 4 deletions crates/rpc-types-engine/src/payload.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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<DepositReceipt>,
/// Array of exits
pub exits: Vec<ExitV1>,
/// Array of execution layer triggerable withdrawal requests.
///
/// See [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002).
pub withdrawal_requests: Vec<WithdrawalRequest>,
}

impl ExecutionPayloadV4 {
Expand Down
Loading