Skip to content

Commit

Permalink
feat: add more beacon API types (#5292)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 6, 2023
1 parent fa803fd commit 29a8489
Show file tree
Hide file tree
Showing 17 changed files with 844 additions and 151 deletions.
4 changes: 4 additions & 0 deletions crates/rpc/rpc-types/src/beacon/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub const BLS_DST: &[u8] = b"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
pub const BLS_PUBLIC_KEY_BYTES_LEN: usize = 48;
pub const BLS_SECRET_KEY_BYTES_LEN: usize = 32;
pub const BLS_SIGNATURE_BYTES_LEN: usize = 96;
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub struct PayloadAttributesData {
///
/// Note: this uses the beacon API format which uses snake-case and quoted decimals rather than
/// big-endian hex.
#[serde(with = "crate::eth::engine::payload::beacon_api_payload_attributes")]
#[serde(with = "crate::beacon::payload::beacon_api_payload_attributes")]
pub payload_attributes: PayloadAttributes,
}

Expand Down
17 changes: 17 additions & 0 deletions crates/rpc/rpc-types/src/beacon/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![allow(missing_docs)]
//! Types for the Ethereum 2.0 RPC protocol (beacon chain)

use alloy_primitives::FixedBytes;
use constants::{BLS_PUBLIC_KEY_BYTES_LEN, BLS_SIGNATURE_BYTES_LEN};

pub mod constants;
/// Beacon API events support.
pub mod events;
pub mod payload;
pub mod withdrawals;

/// BLS signature type
pub type BlsSignature = FixedBytes<BLS_SIGNATURE_BYTES_LEN>;

/// BLS public key type
pub type BlsPublicKey = FixedBytes<BLS_PUBLIC_KEY_BYTES_LEN>;
Loading

0 comments on commit 29a8489

Please sign in to comment.