cfg: replace std feature gate alloc imports with extern crate alloc (#10861)

This commit is contained in:
Thomas Coratger
2024-09-13 18:01:12 +02:00
committed by GitHub
parent 6fc81f2b70
commit 47d188cb8e
54 changed files with 39 additions and 163 deletions

View File

@ -1,10 +1,8 @@
use crate::Compact;
use alloc::vec::Vec;
use alloy_eips::eip2930::{AccessList, AccessListItem};
use alloy_primitives::Address;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// Implement `Compact` for `AccessListItem` and `AccessList`.
impl Compact for AccessListItem {
fn to_compact<B>(&self, buf: &mut B) -> usize

View File

@ -1,12 +1,10 @@
use crate::Compact;
use alloc::vec::Vec;
use alloy_genesis::GenesisAccount as AlloyGenesisAccount;
use alloy_primitives::{Bytes, B256, U256};
use reth_codecs_derive::add_arbitrary_tests;
use serde::{Deserialize, Serialize};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// `GenesisAccount` acts as bridge which simplifies Compact implementation for
/// `AlloyGenesisAccount`.
///

View File

@ -1,12 +1,10 @@
//! Native Compact codec impl for primitive alloy log types.
use crate::Compact;
use alloc::vec::Vec;
use alloy_primitives::{Address, Bytes, Log, LogData};
use bytes::BufMut;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// Implement `Compact` for `LogData` and `Log`.
impl Compact for LogData {
fn to_compact<B>(&self, buf: &mut B) -> usize

View File

@ -1,13 +1,11 @@
use crate::{Compact, CompactPlaceholder};
use alloc::vec::Vec;
use alloy_consensus::transaction::TxEip4844 as AlloyTxEip4844;
use alloy_eips::eip2930::AccessList;
use alloy_primitives::{Address, Bytes, ChainId, B256, U256};
use reth_codecs_derive::add_arbitrary_tests;
use serde::{Deserialize, Serialize};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// [EIP-4844 Blob Transaction](https://eips.ethereum.org/EIPS/eip-4844#blob-transaction)
///
/// This is a helper type to use derive on it instead of manually managing `bitfield`.

View File

@ -1,13 +1,11 @@
use crate::Compact;
use alloc::vec::Vec;
use alloy_consensus::transaction::TxEip7702 as AlloyTxEip7702;
use alloy_eips::{eip2930::AccessList, eip7702::SignedAuthorization};
use alloy_primitives::{Address, Bytes, ChainId, U256};
use reth_codecs_derive::add_arbitrary_tests;
use serde::{Deserialize, Serialize};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// [EIP-7702 Set Code Transaction](https://eips.ethereum.org/EIPS/eip-7702)
///
/// This is a helper type to use derive on it instead of manually managing `bitfield`.

View File

@ -1,13 +1,11 @@
//! Native Compact codec impl for EIP-7685 requests.
use crate::Compact;
use alloc::vec::Vec;
use alloy_primitives::B256;
use alloy_trie::{hash_builder::HashBuilderValue, BranchNodeCompact, TrieMask};
use bytes::{Buf, BufMut};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// Identifier for [`HashBuilderValue::Hash`]
const HASH_BUILDER_TYPE_HASH: u8 = 0;

View File

@ -22,9 +22,7 @@ pub use reth_codecs_derive::*;
use alloy_primitives::{Address, Bloom, Bytes, FixedBytes, U256};
use bytes::{Buf, BufMut};
#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(any(test, feature = "alloy"))]