Skip to content

Commit

Permalink
docs: expand on what Requests contains
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg committed Oct 24, 2024
1 parent ae1bef2 commit 329b6c9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/eips/src/eip7685.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ use derive_more::{Deref, DerefMut, From, IntoIterator};
pub const EMPTY_REQUESTS_HASH: B256 =
b256!("6036c41849da9c076ed79654d434017387a88fb833c2856b32e18218b3341c5f");

/// A list of opaque EIP-7685 requests.
/// A container of EIP-7685 requests.
///
/// The container only holds the `requests_data` as defined by their respective EIPs. The request
/// type is prepended to `requests_data` in [`Requests::requests_hash`] to calculate the requests
/// hash as definned in EIP-7685.
#[derive(Debug, Clone, PartialEq, Eq, Default, Hash, Deref, DerefMut, From, IntoIterator)]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
Expand Down Expand Up @@ -46,6 +50,10 @@ impl Requests {
/// ```text
/// sha256(sha256(requests_0) ++ sha256(requests_1) ++ ...)
/// ```
///
/// The request type for each requests is prepended to the `requests_data` inside of this
/// container. The request type for the first request in the container will be `0x00`, the
/// second request will have type `0x01`, and so on.
#[cfg(feature = "sha2")]
pub fn requests_hash(&self) -> B256 {
use sha2::{Digest, Sha256};
Expand Down

0 comments on commit 329b6c9

Please sign in to comment.