From 38e7c14386016ce4bc810daa92cd9824d736cbfd Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:24:09 -0400 Subject: [PATCH 1/6] chore: remove proptest in most crates and Arbitrary derives --- crates/consensus/Cargo.toml | 6 ------ crates/consensus/src/request.rs | 4 +--- crates/eips/Cargo.toml | 6 ------ crates/eips/src/eip1898.rs | 4 +--- crates/eips/src/eip2930.rs | 18 ++---------------- crates/eips/src/eip4844/sidecar.rs | 3 --- crates/eips/src/eip4895.rs | 4 +--- crates/eips/src/eip6110.rs | 4 +--- crates/eips/src/eip7002.rs | 4 +--- crates/eips/src/eip7251.rs | 4 +--- crates/rpc-types-eth/Cargo.toml | 6 ------ crates/rpc-types-eth/src/log.rs | 4 +--- .../rpc-types-eth/src/transaction/receipt.rs | 4 +--- crates/rpc-types-trace/Cargo.toml | 2 -- 14 files changed, 10 insertions(+), 63 deletions(-) diff --git a/crates/consensus/Cargo.toml b/crates/consensus/Cargo.toml index 1bc962c4911..a9d68626365 100644 --- a/crates/consensus/Cargo.toml +++ b/crates/consensus/Cargo.toml @@ -29,8 +29,6 @@ c-kzg = { workspace = true, features = ["serde"], optional = true } # arbitrary arbitrary = { workspace = true, features = ["derive"], optional = true } -proptest = { workspace = true, optional = true } -proptest-derive = { workspace = true, optional = true } # serde serde = { workspace = true, features = ["derive"], optional = true } @@ -41,8 +39,6 @@ alloy-eips = { workspace = true, features = ["arbitrary"] } alloy-signer.workspace = true arbitrary = { workspace = true, features = ["derive"] } -proptest = { workspace = true } -proptest-derive = { workspace = true } k256.workspace = true tokio = { workspace = true, features = ["macros"] } serde_json.workspace = true @@ -55,8 +51,6 @@ kzg = ["dep:c-kzg", "alloy-eips/kzg", "std"] arbitrary = [ "std", "dep:arbitrary", - "dep:proptest-derive", - "dep:proptest", "alloy-eips/arbitrary", ] serde = [ diff --git a/crates/consensus/src/request.rs b/crates/consensus/src/request.rs index eca98ef6153..b7733220369 100644 --- a/crates/consensus/src/request.rs +++ b/crates/consensus/src/request.rs @@ -1,5 +1,3 @@ -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use alloy_eips::{ eip6110::DepositRequest, eip7002::WithdrawalRequest, @@ -15,7 +13,7 @@ use alloy_rlp::{Decodable, Encodable}; #[non_exhaustive] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(untagged))] diff --git a/crates/eips/Cargo.toml b/crates/eips/Cargo.toml index 26f1c293264..07c984c2f00 100644 --- a/crates/eips/Cargo.toml +++ b/crates/eips/Cargo.toml @@ -38,8 +38,6 @@ ethereum_ssz = { workspace = true, optional = true } # arbitrary arbitrary = { workspace = true, features = ["derive"], optional = true } -proptest = { workspace = true, optional = true } -proptest-derive = { workspace = true, optional = true } [dev-dependencies] alloy-primitives = { workspace = true, features = [ @@ -48,8 +46,6 @@ alloy-primitives = { workspace = true, features = [ "arbitrary", ] } arbitrary = { workspace = true, features = ["derive"] } -proptest.workspace = true -proptest-derive.workspace = true serde_json.workspace = true [features] @@ -81,8 +77,6 @@ arbitrary = [ "std", "kzg-sidecar", "dep:arbitrary", - "dep:proptest-derive", - "dep:proptest", "alloy-primitives/arbitrary", "alloy-serde?/arbitrary", ] diff --git a/crates/eips/src/eip1898.rs b/crates/eips/src/eip1898.rs index 1ff070f2ff3..762e66e0578 100644 --- a/crates/eips/src/eip1898.rs +++ b/crates/eips/src/eip1898.rs @@ -1,7 +1,5 @@ //! [EIP-1898]: https://eips.ethereum.org/EIPS/eip-1898 -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use alloy_primitives::{hex::FromHexError, ruint::ParseError, BlockHash, BlockNumber, B256, U64}; use alloy_rlp::{bytes, Decodable, Encodable, Error as RlpError}; use core::{ @@ -618,7 +616,7 @@ impl From<(BlockHash, BlockNumber)> for BlockNumHash { #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] pub enum BlockHashOrNumber { /// A block hash diff --git a/crates/eips/src/eip2930.rs b/crates/eips/src/eip2930.rs index 2dd78fc3ecc..f5cbe2c55fa 100644 --- a/crates/eips/src/eip2930.rs +++ b/crates/eips/src/eip2930.rs @@ -2,8 +2,6 @@ //! //! [EIP-2930]: https://eips.ethereum.org/EIPS/eip-2930 -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - #[cfg(not(feature = "std"))] use alloc::vec::Vec; @@ -16,7 +14,7 @@ use core::{mem, ops::Deref}; #[derive(Clone, Debug, Default, PartialEq, Eq, Hash, RlpDecodable, RlpEncodable)] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] @@ -24,12 +22,6 @@ pub struct AccessListItem { /// Account addresses that would be loaded at the start of execution pub address: Address, /// Keys of storage that would be loaded at the start of execution - #[cfg_attr( - any(test, feature = "arbitrary"), - proptest( - strategy = "proptest::collection::vec(proptest::arbitrary::any::(), 0..=20)" - ) - )] // In JSON, we have to accept `null` for storage key, which is interpreted as an empty array. #[cfg_attr(feature = "serde", serde(deserialize_with = "alloy_serde::null_as_default"))] pub storage_keys: Vec, @@ -47,16 +39,10 @@ impl AccessListItem { #[derive(Clone, Debug, Default, PartialEq, Eq, Hash, RlpDecodableWrapper, RlpEncodableWrapper)] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct AccessList( - #[cfg_attr( - any(test, feature = "arbitrary"), - proptest( - strategy = "proptest::collection::vec(proptest::arbitrary::any::(), 0..=20)" - ) - )] pub Vec, ); diff --git a/crates/eips/src/eip4844/sidecar.rs b/crates/eips/src/eip4844/sidecar.rs index 0835561dc38..33695da1629 100644 --- a/crates/eips/src/eip4844/sidecar.rs +++ b/crates/eips/src/eip4844/sidecar.rs @@ -1,7 +1,5 @@ //! EIP-4844 sidecar type -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use crate::eip4844::{ kzg_to_versioned_hash, Blob, Bytes48, BYTES_PER_BLOB, BYTES_PER_COMMITMENT, BYTES_PER_PROOF, }; @@ -20,7 +18,6 @@ use alloc::vec::Vec; #[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] #[repr(C)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(any(test, feature = "arbitrary"), derive(proptest_derive::Arbitrary))] #[doc(alias = "BlobTxSidecar")] pub struct BlobTransactionSidecar { /// The blob data. diff --git a/crates/eips/src/eip4895.rs b/crates/eips/src/eip4895.rs index c499ca6e74c..f2c44d0623c 100644 --- a/crates/eips/src/eip4895.rs +++ b/crates/eips/src/eip4895.rs @@ -2,8 +2,6 @@ //! //! [EIP-4895]: https://eips.ethereum.org/EIPS/eip-4895 -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use alloy_primitives::{Address, U256}; use alloy_rlp::{RlpDecodable, RlpEncodable}; @@ -14,7 +12,7 @@ pub const GWEI_TO_WEI: u64 = 1_000_000_000; #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, RlpEncodable, RlpDecodable)] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "ssz", derive(ssz_derive::Encode, ssz_derive::Decode))] diff --git a/crates/eips/src/eip6110.rs b/crates/eips/src/eip6110.rs index f04c02d1897..1ae61476a59 100644 --- a/crates/eips/src/eip6110.rs +++ b/crates/eips/src/eip6110.rs @@ -4,8 +4,6 @@ //! //! Provides validator deposits as a list of deposit operations added to the Execution Layer block. -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use alloy_primitives::{address, Address, FixedBytes, B256}; use alloy_rlp::{RlpDecodable, RlpEncodable}; @@ -20,7 +18,7 @@ pub const MAINNET_DEPOSIT_CONTRACT_ADDRESS: Address = #[cfg_attr(feature = "ssz", derive(ssz_derive::Encode, ssz_derive::Decode))] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] pub struct DepositRequest { /// Validator public key diff --git a/crates/eips/src/eip7002.rs b/crates/eips/src/eip7002.rs index 9678efe22ff..a3791cde7fc 100644 --- a/crates/eips/src/eip7002.rs +++ b/crates/eips/src/eip7002.rs @@ -2,8 +2,6 @@ //! //! See also [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002): Execution layer triggerable withdrawals -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use alloy_primitives::{address, bytes, Address, Bytes, FixedBytes}; use alloy_rlp::{RlpDecodable, RlpEncodable}; @@ -29,7 +27,7 @@ pub const WITHDRAWAL_REQUEST_TYPE: u8 = 0x01; #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] pub struct WithdrawalRequest { /// Address of the source of the exit. diff --git a/crates/eips/src/eip7251.rs b/crates/eips/src/eip7251.rs index cb72a0c5352..f4136be2ba3 100644 --- a/crates/eips/src/eip7251.rs +++ b/crates/eips/src/eip7251.rs @@ -2,8 +2,6 @@ //! //! See also [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): Increase the MAX_EFFECTIVE_BALANCE -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use alloy_primitives::{address, bytes, Address, Bytes, FixedBytes}; use alloy_rlp::{RlpDecodable, RlpEncodable}; @@ -25,7 +23,7 @@ pub const CONSOLIDATION_REQUEST_TYPE: u8 = 0x02; #[cfg_attr(feature = "ssz", derive(ssz_derive::Encode, ssz_derive::Decode))] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] pub struct ConsolidationRequest { /// Source address diff --git a/crates/rpc-types-eth/Cargo.toml b/crates/rpc-types-eth/Cargo.toml index 2e2b9a759e6..df87af1eec8 100644 --- a/crates/rpc-types-eth/Cargo.toml +++ b/crates/rpc-types-eth/Cargo.toml @@ -33,8 +33,6 @@ thiserror.workspace = true # arbitrary arbitrary = { version = "1.3", features = ["derive"], optional = true } -proptest = { version = "1.4", optional = true } -proptest-derive = { version = "0.4", optional = true } # jsonrpsee jsonrpsee-types = { version = "0.23", optional = true } @@ -50,16 +48,12 @@ alloy-primitives = { workspace = true, features = [ alloy-consensus = { workspace = true, features = ["std", "arbitrary"] } arbitrary = { workspace = true, features = ["derive"] } -proptest.workspace = true -proptest-derive.workspace = true rand.workspace = true similar-asserts.workspace = true [features] arbitrary = [ "dep:arbitrary", - "dep:proptest-derive", - "dep:proptest", "alloy-primitives/arbitrary", "alloy-serde/arbitrary", "alloy-eips/arbitrary", diff --git a/crates/rpc-types-eth/src/log.rs b/crates/rpc-types-eth/src/log.rs index c22aadad4e9..41a1edbdf59 100644 --- a/crates/rpc-types-eth/src/log.rs +++ b/crates/rpc-types-eth/src/log.rs @@ -1,5 +1,3 @@ -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use alloy_primitives::{Address, BlockHash, LogData, TxHash, B256}; use serde::{Deserialize, Serialize}; @@ -7,7 +5,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] #[serde(rename_all = "camelCase")] pub struct Log { diff --git a/crates/rpc-types-eth/src/transaction/receipt.rs b/crates/rpc-types-eth/src/transaction/receipt.rs index fa32de6744c..9f2b05dfd48 100644 --- a/crates/rpc-types-eth/src/transaction/receipt.rs +++ b/crates/rpc-types-eth/src/transaction/receipt.rs @@ -1,5 +1,3 @@ -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use crate::Log; use alloy_consensus::{AnyReceiptEnvelope, ReceiptEnvelope, TxType}; use alloy_primitives::{Address, BlockHash, TxHash, B256}; @@ -13,7 +11,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] #[serde(rename_all = "camelCase")] #[doc(alias = "TxReceipt")] diff --git a/crates/rpc-types-trace/Cargo.toml b/crates/rpc-types-trace/Cargo.toml index 577584c4aed..7181ff4755f 100644 --- a/crates/rpc-types-trace/Cargo.toml +++ b/crates/rpc-types-trace/Cargo.toml @@ -36,7 +36,5 @@ alloy-primitives = { workspace = true, features = [ ] } arbitrary = { workspace = true, features = ["derive"] } -proptest.workspace = true -proptest-derive.workspace = true rand.workspace = true similar-asserts.workspace = true From 71fca38db44f16a45493a6881f2ea5cf0744ae7c Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:14:59 -0400 Subject: [PATCH 2/6] cargo fmt rewriting static --- crates/consensus/src/request.rs | 5 +---- crates/eips/src/eip1898.rs | 5 +---- crates/eips/src/eip2930.rs | 14 +++----------- crates/eips/src/eip4895.rs | 5 +---- crates/eips/src/eip6110.rs | 5 +---- crates/eips/src/eip7002.rs | 5 +---- crates/eips/src/eip7251.rs | 5 +---- crates/rpc-types-eth/src/log.rs | 5 +---- crates/rpc-types-eth/src/transaction/receipt.rs | 5 +---- 9 files changed, 11 insertions(+), 43 deletions(-) diff --git a/crates/consensus/src/request.rs b/crates/consensus/src/request.rs index b7733220369..6b6cb3211a9 100644 --- a/crates/consensus/src/request.rs +++ b/crates/consensus/src/request.rs @@ -11,10 +11,7 @@ use alloy_rlp::{Decodable, Encodable}; /// See also [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685). #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(untagged))] pub enum Request { diff --git a/crates/eips/src/eip1898.rs b/crates/eips/src/eip1898.rs index 762e66e0578..ca19ef64907 100644 --- a/crates/eips/src/eip1898.rs +++ b/crates/eips/src/eip1898.rs @@ -614,10 +614,7 @@ impl From<(BlockHash, BlockNumber)> for BlockNumHash { /// Either a block hash _or_ a block number #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] pub enum BlockHashOrNumber { /// A block hash Hash(B256), diff --git a/crates/eips/src/eip2930.rs b/crates/eips/src/eip2930.rs index f5cbe2c55fa..094361fa152 100644 --- a/crates/eips/src/eip2930.rs +++ b/crates/eips/src/eip2930.rs @@ -12,10 +12,7 @@ use core::{mem, ops::Deref}; /// A list of addresses and storage keys that the transaction plans to access. /// Accesses outside the list are possible, but become more expensive. #[derive(Clone, Debug, Default, PartialEq, Eq, Hash, RlpDecodable, RlpEncodable)] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] pub struct AccessListItem { @@ -37,14 +34,9 @@ impl AccessListItem { /// AccessList as defined in EIP-2930 #[derive(Clone, Debug, Default, PartialEq, Eq, Hash, RlpDecodableWrapper, RlpEncodableWrapper)] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct AccessList( - pub Vec, -); +pub struct AccessList(pub Vec); impl From> for AccessList { fn from(list: Vec) -> Self { diff --git a/crates/eips/src/eip4895.rs b/crates/eips/src/eip4895.rs index f2c44d0623c..61a2e7049c7 100644 --- a/crates/eips/src/eip4895.rs +++ b/crates/eips/src/eip4895.rs @@ -10,10 +10,7 @@ pub const GWEI_TO_WEI: u64 = 1_000_000_000; /// Withdrawal represents a validator withdrawal from the consensus layer. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, RlpEncodable, RlpDecodable)] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "ssz", derive(ssz_derive::Encode, ssz_derive::Decode))] pub struct Withdrawal { diff --git a/crates/eips/src/eip6110.rs b/crates/eips/src/eip6110.rs index 1ae61476a59..210f669fbfc 100644 --- a/crates/eips/src/eip6110.rs +++ b/crates/eips/src/eip6110.rs @@ -16,10 +16,7 @@ pub const MAINNET_DEPOSIT_CONTRACT_ADDRESS: Address = #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr(feature = "ssz", derive(ssz_derive::Encode, ssz_derive::Decode))] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] pub struct DepositRequest { /// Validator public key pub pubkey: FixedBytes<48>, diff --git a/crates/eips/src/eip7002.rs b/crates/eips/src/eip7002.rs index a3791cde7fc..43a11df5c06 100644 --- a/crates/eips/src/eip7002.rs +++ b/crates/eips/src/eip7002.rs @@ -25,10 +25,7 @@ pub const WITHDRAWAL_REQUEST_TYPE: u8 = 0x01; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, RlpEncodable, RlpDecodable, Default)] #[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) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] pub struct WithdrawalRequest { /// Address of the source of the exit. pub source_address: Address, diff --git a/crates/eips/src/eip7251.rs b/crates/eips/src/eip7251.rs index f4136be2ba3..23406b59efb 100644 --- a/crates/eips/src/eip7251.rs +++ b/crates/eips/src/eip7251.rs @@ -21,10 +21,7 @@ pub const CONSOLIDATION_REQUEST_TYPE: u8 = 0x02; #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr(feature = "ssz", derive(ssz_derive::Encode, ssz_derive::Decode))] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] pub struct ConsolidationRequest { /// Source address pub source_address: Address, diff --git a/crates/rpc-types-eth/src/log.rs b/crates/rpc-types-eth/src/log.rs index 41a1edbdf59..b1c4973cbab 100644 --- a/crates/rpc-types-eth/src/log.rs +++ b/crates/rpc-types-eth/src/log.rs @@ -3,10 +3,7 @@ use serde::{Deserialize, Serialize}; /// Ethereum Log emitted by a transaction #[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] #[serde(rename_all = "camelCase")] pub struct Log { #[serde(flatten)] diff --git a/crates/rpc-types-eth/src/transaction/receipt.rs b/crates/rpc-types-eth/src/transaction/receipt.rs index 9f2b05dfd48..afc93c753b6 100644 --- a/crates/rpc-types-eth/src/transaction/receipt.rs +++ b/crates/rpc-types-eth/src/transaction/receipt.rs @@ -9,10 +9,7 @@ use serde::{Deserialize, Serialize}; /// This type is generic over an inner [`ReceiptEnvelope`] which contains /// consensus data and metadata. #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] #[serde(rename_all = "camelCase")] #[doc(alias = "TxReceipt")] pub struct TransactionReceipt> { From 60f2554a3f3839e8ebc8b0f2d70fd152df2e8df7 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:52:26 -0400 Subject: [PATCH 3/6] remove other proptest derive --- crates/serde/Cargo.toml | 3 --- crates/serde/src/other/mod.rs | 7 +------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/crates/serde/Cargo.toml b/crates/serde/Cargo.toml index e99a23090b1..10a1ce2ede5 100644 --- a/crates/serde/Cargo.toml +++ b/crates/serde/Cargo.toml @@ -26,7 +26,6 @@ serde_json = { workspace = true, features = ["alloc"] } # arbitrary arbitrary = { version = "1.3", features = ["derive"], optional = true } proptest = { version = "1.4", optional = true } -proptest-derive = { version = "0.4", optional = true } [dev-dependencies] alloy-primitives = { workspace = true, features = [ @@ -38,7 +37,6 @@ alloy-primitives = { workspace = true, features = [ arbitrary = { workspace = true, features = ["derive"] } proptest.workspace = true -proptest-derive.workspace = true rand.workspace = true [features] @@ -46,7 +44,6 @@ default = ["std"] std = ["alloy-primitives/std", "serde/std", "serde_json/std"] arbitrary = [ "dep:arbitrary", - "dep:proptest-derive", "dep:proptest", "alloy-primitives/arbitrary", "std", diff --git a/crates/serde/src/other/mod.rs b/crates/serde/src/other/mod.rs index 33d62fbc98c..9f675cb1f45 100644 --- a/crates/serde/src/other/mod.rs +++ b/crates/serde/src/other/mod.rs @@ -1,7 +1,5 @@ //! Support for capturing other fields. -#![allow(unknown_lints, non_local_definitions)] // TODO: remove when proptest-derive updates - use alloc::collections::BTreeMap; use core::{ fmt, @@ -170,10 +168,7 @@ impl<'a> IntoIterator for &'a OtherFields { /// /// See [`OtherFields`] for more information. #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize)] -#[cfg_attr( - any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) -)] +#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] pub struct WithOtherFields { /// The inner struct. #[serde(flatten)] From 0012c2ef2513058739160cf6ac22e08495aca86b Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:53:55 -0400 Subject: [PATCH 4/6] remove the rest of the proptest impls --- Cargo.toml | 2 -- crates/serde/Cargo.toml | 3 -- crates/serde/src/other/arbitrary_.rs | 54 ---------------------------- 3 files changed, 59 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 56deb3c06c1..112c29ba9c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -140,8 +140,6 @@ serde_with = "3.3.0" ## misc-testing arbitrary = "1.3" assert_matches = "1.5" -proptest = { version = "1.4", default-features = false, features = ["alloc"] } -proptest-derive = { version = "0.4", default-features = false } serial_test = "3.0" similar-asserts = "1.5" tempfile = "3.10" diff --git a/crates/serde/Cargo.toml b/crates/serde/Cargo.toml index 10a1ce2ede5..8c8a74d4d1e 100644 --- a/crates/serde/Cargo.toml +++ b/crates/serde/Cargo.toml @@ -25,7 +25,6 @@ serde_json = { workspace = true, features = ["alloc"] } # arbitrary arbitrary = { version = "1.3", features = ["derive"], optional = true } -proptest = { version = "1.4", optional = true } [dev-dependencies] alloy-primitives = { workspace = true, features = [ @@ -36,7 +35,6 @@ alloy-primitives = { workspace = true, features = [ ] } arbitrary = { workspace = true, features = ["derive"] } -proptest.workspace = true rand.workspace = true [features] @@ -44,7 +42,6 @@ default = ["std"] std = ["alloy-primitives/std", "serde/std", "serde_json/std"] arbitrary = [ "dep:arbitrary", - "dep:proptest", "alloy-primitives/arbitrary", "std", ] diff --git a/crates/serde/src/other/arbitrary_.rs b/crates/serde/src/other/arbitrary_.rs index 53c92799c80..3f28a84b724 100644 --- a/crates/serde/src/other/arbitrary_.rs +++ b/crates/serde/src/other/arbitrary_.rs @@ -1,10 +1,5 @@ use crate::OtherFields; use alloc::collections::BTreeMap; -use proptest::{ - arbitrary::any, - prop_oneof, - strategy::{BoxedStrategy, Just, Strategy}, -}; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; @@ -19,22 +14,6 @@ impl arbitrary::Arbitrary<'_> for OtherFields { } } -impl proptest::arbitrary::Arbitrary for OtherFields { - type Parameters = (); - type Strategy = proptest::strategy::Map< - proptest::collection::VecStrategy<( - ::Strategy, - ::Strategy, - )>, - fn(Vec<(String, ArbitraryValue)>) -> Self, - >; - - fn arbitrary_with((): Self::Parameters) -> Self::Strategy { - proptest::collection::vec(any::<(String, ArbitraryValue)>(), 0..16) - .prop_map(|map| map.into_iter().map(|(k, v)| (k, v.into_json_value())).collect()) - } -} - /// Redefinition of `serde_json::Value` for the purpose of implementing `Arbitrary`. #[derive(Clone, Debug, arbitrary::Arbitrary)] #[allow(unnameable_types)] @@ -47,27 +26,6 @@ pub enum ArbitraryValue { Object(BTreeMap), } -impl proptest::arbitrary::Arbitrary for ArbitraryValue { - type Parameters = (); - type Strategy = BoxedStrategy; - - fn arbitrary_with((): Self::Parameters) -> Self::Strategy { - prop_oneof![ - Just(Self::Null), - any::().prop_map(Self::Bool), - any::().prop_map(Self::Number), - any::().prop_map(Self::String), - ] - .prop_recursive(4, 64, 16, |this| { - prop_oneof![ - 1 => proptest::collection::vec(this.clone(), 0..16).prop_map(Self::Array), - 1 => proptest::collection::btree_map(any::(), this, 0..16).prop_map(Self::Object), - ] - }) - .boxed() - } -} - impl ArbitraryValue { fn into_json_value(self) -> serde_json::Value { match self { @@ -84,15 +42,3 @@ impl ArbitraryValue { } } } - -#[cfg(test)] -mod tests { - use super::*; - - proptest::proptest!( - #[test] - fn test_arbitrary_value(value in any::()) { - let _json_value = value.into_json_value(); - } - ); -} From 4ba7d703ac125c6d151f1d225cbfe2a49f28ad22 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:46:45 -0400 Subject: [PATCH 5/6] make arbitraryvalue not pub --- crates/serde/src/other/arbitrary_.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/serde/src/other/arbitrary_.rs b/crates/serde/src/other/arbitrary_.rs index 3f28a84b724..1b437780121 100644 --- a/crates/serde/src/other/arbitrary_.rs +++ b/crates/serde/src/other/arbitrary_.rs @@ -17,7 +17,7 @@ impl arbitrary::Arbitrary<'_> for OtherFields { /// Redefinition of `serde_json::Value` for the purpose of implementing `Arbitrary`. #[derive(Clone, Debug, arbitrary::Arbitrary)] #[allow(unnameable_types)] -pub enum ArbitraryValue { +enum ArbitraryValue { Null, Bool(bool), Number(u64), From 88c6cd760f108d03b19d8692847376afa2658e98 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:22:18 -0400 Subject: [PATCH 6/6] remove proptest derive from auth list --- crates/eips/src/eip7702/auth_list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/eips/src/eip7702/auth_list.rs b/crates/eips/src/eip7702/auth_list.rs index 568a1deaf27..5604508a619 100644 --- a/crates/eips/src/eip7702/auth_list.rs +++ b/crates/eips/src/eip7702/auth_list.rs @@ -15,7 +15,7 @@ use core::hash::{Hash, Hasher}; #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] pub struct Authorization { /// The chain ID of the authorization. @@ -235,7 +235,7 @@ impl Deref for RecoveredAuthorization { #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( any(test, feature = "arbitrary"), - derive(proptest_derive::Arbitrary, arbitrary::Arbitrary) + derive(arbitrary::Arbitrary) )] pub struct OptionalNonce(Option);