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",
"tempfile",
"test-fuzz",
"thiserror-no-std",
"thiserror",
"toml",
"zstd",
]

View File

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

View File

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

View File

@ -9,7 +9,7 @@ use alloy_primitives::TxKind;
use alloy_rlp::Error as RlpError;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use alloc::{string::ToString, vec::Vec};
impl TryFrom<alloy_rpc_types::Block> for Block {
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
// root is the empty root then we can just return an empty vec.
if block.header.transactions_root == EMPTY_TRANSACTIONS {
Ok(vec![])
Ok(Vec::new())
} else {
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.
#[cfg(feature = "c-kzg")]
#[cfg(all(feature = "c-kzg", feature = "std"))]
pub use trusted_setup::*;
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,
};
// 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"))]
mod trusted_setup {
use crate::kzg::KzgSettings;
@ -26,7 +32,7 @@ mod trusted_setup {
}
/// Error type for loading the trusted setup.
#[derive(Debug, thiserror_no_std::Error)]
#[derive(Debug, thiserror::Error)]
pub enum LoadKzgSettingsError {
/// Failed to create temp file to store bytes for loading [`KzgSettings`] via
/// [`KzgSettings::load_trusted_setup_file`].

View File

@ -1,6 +1,9 @@
use crate::{Address, Transaction, TransactionSigned, TxKind, U256};
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.
pub trait FillTxEnv {
/// 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,
};
use bytes::Buf;
use core::mem;
#[cfg(any(test, feature = "reth-codec"))]
use reth_codecs::{reth_codec, Compact};
use serde::{Deserialize, Serialize};
use std::mem;
/// Deposit transactions, also known as deposits are initiated on L1, and executed on L2.
#[cfg_attr(any(test, feature = "reth-codec"), reth_codec)]