diff --git a/src/block.rs b/src/block.rs index 9ace99d..4940e12 100644 --- a/src/block.rs +++ b/src/block.rs @@ -1,4 +1,3 @@ -#[cfg(not(feature = "std"))] use alloc::vec::Vec; use ethereum_types::H256; diff --git a/src/lib.rs b/src/lib.rs index c24c5f6..798ddd0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] -#[cfg(not(feature = "std"))] extern crate alloc; mod account; @@ -13,10 +12,7 @@ mod transaction; pub mod util; // Alias for `Vec<u8>`. This type alias is necessary for rlp-derive to work correctly. -#[cfg(not(feature = "std"))] type Bytes = alloc::vec::Vec<u8>; -#[cfg(feature = "std")] -type Bytes = Vec<u8>; pub use crate::account::Account; pub use crate::block::*; diff --git a/src/log.rs b/src/log.rs index df9c684..036b3cd 100644 --- a/src/log.rs +++ b/src/log.rs @@ -1,4 +1,3 @@ -#[cfg(not(feature = "std"))] use alloc::vec::Vec; use ethereum_types::{H160, H256}; diff --git a/src/receipt.rs b/src/receipt.rs index a1fa287..a5026a3 100644 --- a/src/receipt.rs +++ b/src/receipt.rs @@ -1,4 +1,3 @@ -#[cfg(not(feature = "std"))] use alloc::vec::Vec; use bytes::BytesMut; diff --git a/src/transaction/eip1559.rs b/src/transaction/eip1559.rs index 67d5a23..3b01e58 100644 --- a/src/transaction/eip1559.rs +++ b/src/transaction/eip1559.rs @@ -1,6 +1,3 @@ -#[cfg(not(feature = "std"))] -use alloc::vec; - use ethereum_types::{H256, U256}; use rlp::{DecoderError, Rlp, RlpStream}; use sha3::{Digest, Keccak256}; @@ -34,7 +31,7 @@ pub struct EIP1559Transaction { impl EIP1559Transaction { pub fn hash(&self) -> H256 { let encoded = rlp::encode(self); - let mut out = vec![0; 1 + encoded.len()]; + let mut out = alloc::vec![0; 1 + encoded.len()]; out[0] = 2; out[1..].copy_from_slice(&encoded); H256::from_slice(Keccak256::digest(&out).as_slice()) @@ -120,7 +117,7 @@ pub struct EIP1559TransactionMessage { impl EIP1559TransactionMessage { pub fn hash(&self) -> H256 { let encoded = rlp::encode(self); - let mut out = vec![0; 1 + encoded.len()]; + let mut out = alloc::vec![0; 1 + encoded.len()]; out[0] = 2; out[1..].copy_from_slice(&encoded); H256::from_slice(Keccak256::digest(&out).as_slice()) diff --git a/src/transaction/eip2930.rs b/src/transaction/eip2930.rs index 245959b..25da6a0 100644 --- a/src/transaction/eip2930.rs +++ b/src/transaction/eip2930.rs @@ -1,5 +1,4 @@ -#[cfg(not(feature = "std"))] -use alloc::{vec, vec::Vec}; +use alloc::vec::Vec; use ethereum_types::{Address, H256, U256}; use rlp::{DecoderError, Rlp, RlpStream}; @@ -64,7 +63,7 @@ pub struct EIP2930Transaction { impl EIP2930Transaction { pub fn hash(&self) -> H256 { let encoded = rlp::encode(self); - let mut out = vec![0; 1 + encoded.len()]; + let mut out = alloc::vec![0; 1 + encoded.len()]; out[0] = 1; out[1..].copy_from_slice(&encoded); H256::from_slice(Keccak256::digest(&out).as_slice()) @@ -146,7 +145,7 @@ pub struct EIP2930TransactionMessage { impl EIP2930TransactionMessage { pub fn hash(&self) -> H256 { let encoded = rlp::encode(self); - let mut out = vec![0; 1 + encoded.len()]; + let mut out = alloc::vec![0; 1 + encoded.len()]; out[0] = 1; out[1..].copy_from_slice(&encoded); H256::from_slice(Keccak256::digest(&out).as_slice()) diff --git a/src/util.rs b/src/util.rs index c762f8f..fa33ae5 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,6 +1,5 @@ //! Utility functions for Ethereum. -#[cfg(not(feature = "std"))] use alloc::vec::Vec; use ethereum_types::H256;