diff --git a/crates/consensus/src/constants.rs b/crates/consensus/src/constants.rs index 764ca25fc86..4b64cb22606 100644 --- a/crates/consensus/src/constants.rs +++ b/crates/consensus/src/constants.rs @@ -1,5 +1,5 @@ //! Ethereum protocol-related constants -use alloy_primitives::{address, b256, Address, B256}; +use alloy_primitives::{b256, B256}; /// The first four bytes of the call data for a function call specifies the function to be called. pub const SELECTOR_LEN: usize = 4; @@ -67,6 +67,3 @@ pub const EMPTY_TRANSACTIONS: B256 = EMPTY_ROOT_HASH; /// Withdrawals root of empty withdrawals set. pub const EMPTY_WITHDRAWALS: B256 = EMPTY_ROOT_HASH; - -/// The address for the beacon roots contract defined in EIP-4788. -pub const BEACON_ROOTS_ADDRESS: Address = address!("000F3df6D732807Ef1319fB7B8bB8522d0Beac02"); diff --git a/crates/eips/src/eip4788.rs b/crates/eips/src/eip4788.rs index 42aa14b394d..4dad2b97a45 100644 --- a/crates/eips/src/eip4788.rs +++ b/crates/eips/src/eip4788.rs @@ -2,8 +2,14 @@ //! //! [EIP-4788]: https://eips.ethereum.org/EIPS/eip-4788 -use alloy_primitives::{address, Address}; +use alloy_primitives::{address, bytes, Address, Bytes}; /// The caller to be used when calling the EIP-4788 beacon roots contract at the beginning of the /// block. pub const SYSTEM_ADDRESS: Address = address!("fffffffffffffffffffffffffffffffffffffffe"); + +/// The address for the EIP-4788 beacon roots contract. +pub const BEACON_ROOTS_ADDRESS: Address = address!("000F3df6D732807Ef1319fB7B8bB8522d0Beac02"); + +/// The code for the EIP-4788 beacon roots contract. +pub static BEACON_ROOTS_CODE: Bytes = bytes!("3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500"); diff --git a/crates/eips/src/eip7002.rs b/crates/eips/src/eip7002.rs index be07dadce06..da523349eb4 100644 --- a/crates/eips/src/eip7002.rs +++ b/crates/eips/src/eip7002.rs @@ -1,10 +1,24 @@ -//! Contains WithdrawalRequest types, first introduced in the [Prague hardfork](https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md). +//! Contains the system contract and [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}; +use alloy_primitives::{address, bytes, Address, Bytes, FixedBytes}; use alloy_rlp::{RlpDecodable, RlpEncodable}; +/// The caller to be used when calling the EIP-7002 withdrawal requests contract at the end of the +/// block. +pub const SYSTEM_ADDRESS: Address = address!("fffffffffffffffffffffffffffffffffffffffe"); + +/// The address for the EIP-7002 withdrawal requests contract. +pub const WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS: Address = + address!("00A3ca265EBcb825B45F985A16CEFB49958cE017"); + +/// The code for the EIP-7002 withdrawal requests contract. +pub static WITHDRAWAL_REQUEST_PREDEPLOY_CODE: Bytes = bytes!("3373fffffffffffffffffffffffffffffffffffffffe146090573615156028575f545f5260205ff35b366038141561012e5760115f54600182026001905f5b5f82111560595781019083028483029004916001019190603e565b90939004341061012e57600154600101600155600354806003026004013381556001015f3581556001016020359055600101600355005b6003546002548082038060101160a4575060105b5f5b81811460dd5780604c02838201600302600401805490600101805490600101549160601b83528260140152906034015260010160a6565b910180921460ed579060025560f8565b90505f6002555f6003555b5f548061049d141561010757505f5b60015460028282011161011c5750505f610122565b01600290035b5f555f600155604c025ff35b5f5ffd"); + +/// The [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) request type for withdrawal requests. +pub const WITHDRAWAL_REQUEST_TYPE: u8 = 0x01; + /// Represents an execution layer triggerable withdrawal request. /// /// See [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002).