Check features powerset for reth-primitives (#10138)

This commit is contained in:
Nikolai Golub
2024-08-06 17:19:58 +02:00
committed by GitHub
parent 35532e7c83
commit e24e4c773d
7 changed files with 22 additions and 10 deletions

2
Cargo.lock generated
View File

@ -8090,7 +8090,7 @@ dependencies = [
"serde_json", "serde_json",
"tempfile", "tempfile",
"test-fuzz", "test-fuzz",
"thiserror-no-std", "thiserror",
"toml", "toml",
"zstd", "zstd",
] ]

View File

@ -471,4 +471,6 @@ pr:
check-features: check-features:
cargo hack check \ cargo hack check \
--package reth-codecs \ --package reth-codecs \
--package reth-primitives-traits \
--package reth-primitives \
--feature-powerset --feature-powerset

View File

@ -46,7 +46,7 @@ once_cell.workspace = true
rayon.workspace = true rayon.workspace = true
serde.workspace = true serde.workspace = true
tempfile = { workspace = true, optional = true } tempfile = { workspace = true, optional = true }
thiserror-no-std = { workspace = true, default-features = false, optional = true } thiserror = { workspace = true, optional = true }
zstd = { workspace = true, features = ["experimental"], optional = true } zstd = { workspace = true, features = ["experimental"], optional = true }
# arbitrary utils # arbitrary utils
@ -81,8 +81,8 @@ pprof = { workspace = true, features = [
[features] [features]
default = ["c-kzg", "alloy-compat", "std", "reth-codec", "secp256k1"] default = ["c-kzg", "alloy-compat", "std", "reth-codec", "secp256k1"]
std = ["thiserror-no-std?/std", "reth-primitives-traits/std"] std = ["thiserror", "reth-primitives-traits/std"]
reth-codec = ["dep:reth-codecs", "dep:zstd", "dep:modular-bitfield"] reth-codec = ["dep:reth-codecs", "dep:zstd", "dep:modular-bitfield", "std"]
asm-keccak = ["alloy-primitives/asm-keccak"] asm-keccak = ["alloy-primitives/asm-keccak"]
arbitrary = [ arbitrary = [
"reth-primitives-traits/arbitrary", "reth-primitives-traits/arbitrary",
@ -95,7 +95,7 @@ arbitrary = [
"reth-codec", "reth-codec",
] ]
secp256k1 = ["dep:secp256k1"] secp256k1 = ["dep:secp256k1"]
c-kzg = ["dep:c-kzg", "revm-primitives/c-kzg", "dep:tempfile", "alloy-eips/kzg", "dep:thiserror-no-std"] c-kzg = ["dep:c-kzg", "revm-primitives/c-kzg", "dep:tempfile", "alloy-eips/kzg"]
optimism = [ optimism = [
"reth-chainspec/optimism", "reth-chainspec/optimism",
"reth-ethereum-forks/optimism", "reth-ethereum-forks/optimism",

View File

@ -9,7 +9,7 @@ use alloy_primitives::TxKind;
use alloy_rlp::Error as RlpError; use alloy_rlp::Error as RlpError;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
use alloc::vec::Vec; use alloc::{string::ToString, vec::Vec};
impl TryFrom<alloy_rpc_types::Block> for Block { impl TryFrom<alloy_rpc_types::Block> for Block {
type Error = alloy_rpc_types::ConversionError; type Error = alloy_rpc_types::ConversionError;
@ -43,7 +43,7 @@ impl TryFrom<alloy_rpc_types::Block> for Block {
// alloy deserializes empty blocks into `BlockTransactions::Hashes`, if the tx // alloy deserializes empty blocks into `BlockTransactions::Hashes`, if the tx
// root is the empty root then we can just return an empty vec. // root is the empty root then we can just return an empty vec.
if block.header.transactions_root == EMPTY_TRANSACTIONS { if block.header.transactions_root == EMPTY_TRANSACTIONS {
Ok(vec![]) Ok(Vec::new())
} else { } else {
Err(ConversionError::MissingFullTransactions) Err(ConversionError::MissingFullTransactions)
} }

View File

@ -1,5 +1,5 @@
//! [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844#parameters) protocol constants and utils for shard Blob Transactions. //! [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844#parameters) protocol constants and utils for shard Blob Transactions.
#[cfg(feature = "c-kzg")] #[cfg(all(feature = "c-kzg", feature = "std"))]
pub use trusted_setup::*; pub use trusted_setup::*;
pub use alloy_eips::eip4844::{ pub use alloy_eips::eip4844::{
@ -8,6 +8,12 @@ pub use alloy_eips::eip4844::{
TARGET_BLOBS_PER_BLOCK, TARGET_DATA_GAS_PER_BLOCK, VERSIONED_HASH_VERSION_KZG, TARGET_BLOBS_PER_BLOCK, TARGET_DATA_GAS_PER_BLOCK, VERSIONED_HASH_VERSION_KZG,
}; };
// These 2 to silence unused
#[cfg(all(feature = "c-kzg", not(feature = "std")))]
use tempfile as _;
#[cfg(all(not(feature = "c-kzg"), feature = "std"))]
use thiserror as _;
#[cfg(all(feature = "c-kzg", feature = "std"))] #[cfg(all(feature = "c-kzg", feature = "std"))]
mod trusted_setup { mod trusted_setup {
use crate::kzg::KzgSettings; use crate::kzg::KzgSettings;
@ -26,7 +32,7 @@ mod trusted_setup {
} }
/// Error type for loading the trusted setup. /// Error type for loading the trusted setup.
#[derive(Debug, thiserror_no_std::Error)] #[derive(Debug, thiserror::Error)]
pub enum LoadKzgSettingsError { pub enum LoadKzgSettingsError {
/// Failed to create temp file to store bytes for loading [`KzgSettings`] via /// Failed to create temp file to store bytes for loading [`KzgSettings`] via
/// [`KzgSettings::load_trusted_setup_file`]. /// [`KzgSettings::load_trusted_setup_file`].

View File

@ -1,6 +1,9 @@
use crate::{Address, Transaction, TransactionSigned, TxKind, U256}; use crate::{Address, Transaction, TransactionSigned, TxKind, U256};
use revm_primitives::{AuthorizationList, TxEnv}; use revm_primitives::{AuthorizationList, TxEnv};
#[cfg(all(not(feature = "std"), feature = "optimism"))]
use alloc::vec::Vec;
/// Implements behaviour to fill a [`TxEnv`] from another transaction. /// Implements behaviour to fill a [`TxEnv`] from another transaction.
pub trait FillTxEnv { pub trait FillTxEnv {
/// Fills [`TxEnv`] with an [`Address`] and transaction. /// Fills [`TxEnv`] with an [`Address`] and transaction.

View File

@ -3,9 +3,10 @@ use alloy_rlp::{
length_of_length, Decodable, Encodable, Error as DecodeError, Header, EMPTY_STRING_CODE, length_of_length, Decodable, Encodable, Error as DecodeError, Header, EMPTY_STRING_CODE,
}; };
use bytes::Buf; use bytes::Buf;
use core::mem;
#[cfg(any(test, feature = "reth-codec"))]
use reth_codecs::{reth_codec, Compact}; use reth_codecs::{reth_codec, Compact};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::mem;
/// Deposit transactions, also known as deposits are initiated on L1, and executed on L2. /// Deposit transactions, also known as deposits are initiated on L1, and executed on L2.
#[cfg_attr(any(test, feature = "reth-codec"), reth_codec)] #[cfg_attr(any(test, feature = "reth-codec"), reth_codec)]