forked from alloy-rs/alloy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add prague engine types (alloy-rs#557)
* feat: add prague engine types * Update crates/eips/src/eip6110.rs Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * clippy * Update crates/eips/src/eip6110.rs Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com> * Update crates/rpc-types-engine/src/exit.rs Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com> --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com>
- Loading branch information
1 parent
c887c28
commit b7894df
Showing
6 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//! Contains Deposit types, first introduced in the Prague hardfork: <https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md> | ||
//! | ||
//! See also [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110): Supply validator deposits on chain | ||
//! | ||
//! Provides validator deposits as a list of deposit operations added to the Execution Layer block. | ||
|
||
use alloy_primitives::{address, Address, FixedBytes, B256}; | ||
use alloy_rlp::{RlpDecodable, RlpEncodable}; | ||
|
||
/// Mainnet deposit contract address. | ||
pub const MAINNET_DEPOSIT_CONTRACT_ADDRESS: Address = | ||
address!("00000000219ab540356cbb839cbe05303d7705fa"); | ||
|
||
/// This structure maps onto the deposit object from [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110). | ||
#[derive(Clone, Copy, Debug, PartialEq, Eq, RlpEncodable, RlpDecodable)] | ||
#[cfg_attr( | ||
any(test, feature = "arbitrary"), | ||
derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) | ||
)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
#[cfg_attr(feature = "ssz", derive(ssz_derive::Encode, ssz_derive::Decode))] | ||
pub struct Deposit { | ||
/// Validator public key | ||
pub pubkey: FixedBytes<48>, | ||
/// Withdrawal credentials | ||
pub withdrawal_credentials: B256, | ||
/// Amount of ether deposited in gwei | ||
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::u64_hex"))] | ||
pub amount: u64, | ||
/// Deposit signature | ||
pub signature: FixedBytes<96>, | ||
/// Deposit index | ||
#[cfg_attr(feature = "serde", serde(with = "alloy_serde::u64_hex"))] | ||
pub index: u64, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//! Contains Exit types, first introduced in the Prague hardfork: <https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md> | ||
//! | ||
//! See also [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110). | ||
|
||
use alloy_primitives::{FixedBytes, B256}; | ||
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 { | ||
/// Validator public key | ||
pub pubkey: FixedBytes<48>, | ||
/// Withdrawal credentials | ||
pub withdrawal_credentials: B256, | ||
/// Amount of withdrawn ether in gwei | ||
#[serde(with = "alloy_serde::u64_hex")] | ||
pub amount: u64, | ||
/// Deposit signature | ||
pub signature: FixedBytes<96>, | ||
/// Deposit index | ||
#[serde(with = "alloy_serde::u64_hex")] | ||
pub index: u64, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters