no_std support for reth-revm and fixed tests (#9634)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
frostburn
2024-07-22 12:23:32 -07:00
committed by GitHub
parent 8c690eef95
commit b2276e44f5
3 changed files with 14 additions and 12 deletions

View File

@ -1,12 +1,14 @@
//! Helper for handling execution of multiple blocks.
use crate::{precompile::Address, primitives::alloy_primitives::BlockNumber};
use crate::{
precompile::{Address, HashSet},
primitives::alloy_primitives::BlockNumber,
};
use core::time::Duration;
use reth_execution_errors::BlockExecutionError;
use reth_primitives::{Receipt, Receipts, Request, Requests};
use reth_prune_types::{PruneMode, PruneModes, PruneSegmentError, MINIMUM_PRUNING_DISTANCE};
use revm::db::states::bundle_state::BundleRetention;
use std::collections::HashSet;
use tracing::debug;
#[cfg(not(feature = "std"))]
@ -216,7 +218,12 @@ mod tests {
use super::*;
use reth_primitives::{Address, Log, Receipt};
use reth_prune_types::{PruneMode, ReceiptsLogPruneConfig};
#[cfg(feature = "std")]
use std::collections::BTreeMap;
#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::collections::BTreeMap;
#[test]
fn test_save_receipts_empty() {

View File

@ -1,3 +1,4 @@
use crate::precompile::HashMap;
use alloy_eips::eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE};
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_consensus_common::calc;
@ -9,15 +10,6 @@ use revm::{
Database, DatabaseCommit,
};
// reuse revm's hashbrown implementation for no-std
#[cfg(not(feature = "std"))]
use crate::precompile::HashMap;
#[cfg(not(feature = "std"))]
use alloc::{boxed::Box, format, string::ToString, vec::Vec};
#[cfg(feature = "std")]
use std::collections::HashMap;
/// Collect all balance changes at the end of the block.
///
/// Balance changes might include the block reward, uncle rewards, withdrawals, or irregular

View File

@ -1,3 +1,4 @@
use crate::precompile::HashMap;
use reth_primitives::{
keccak256, Account, Address, BlockNumber, Bytecode, Bytes, StorageKey, B256, U256,
};
@ -6,7 +7,9 @@ use reth_storage_api::{
};
use reth_storage_errors::provider::ProviderResult;
use reth_trie::{updates::TrieUpdates, AccountProof, HashedPostState};
use std::collections::HashMap;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// Mock state for testing
#[derive(Debug, Default, Clone, Eq, PartialEq)]