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

feat: add arbitrary for alloy types #1777

Merged
merged 1 commit into from
Dec 10, 2024
Merged
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
7 changes: 4 additions & 3 deletions crates/eips/src/eip1898.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ use core::{
str::FromStr,
};

#[cfg(feature = "serde")]
use serde::ser::SerializeStruct;

/// A helper struct to store the block number/hash and its parent hash.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
pub struct BlockWithParent {
/// Parent hash.
pub parent: B256,
Expand Down Expand Up @@ -457,6 +455,8 @@ impl serde::Serialize for BlockId {
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;

match self {
Self::Hash(RpcBlockHash { block_hash, require_canonical }) => {
let mut s = serializer.serialize_struct("BlockIdEip1898", 1)?;
Expand Down Expand Up @@ -644,6 +644,7 @@ impl FromStr for BlockId {
/// A number and a hash.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
pub struct NumHash {
/// The number
pub number: u64,
Expand Down
Loading