Skip to content

Commit

Permalink
Chore: some no_std cleanup (bluealloy#1834)
Browse files Browse the repository at this point in the history
* chore: clean up some std feature usage

* chore: clean up some std feature flags and tests in no_std
  • Loading branch information
prestwich authored Oct 24, 2024
1 parent dad766d commit 51d50f6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/bytecode/src/eof/printer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[cfg(feature = "std")]
#![cfg(feature = "std")]

pub fn print(code: &[u8]) {
use crate::{opcode::*, utils::read_i16};
use primitives::hex;
Expand Down Expand Up @@ -60,7 +61,6 @@ pub fn print(code: &[u8]) {
mod test {
use primitives::hex;

#[cfg(feature = "std")]
#[test]
fn sanity_test() {
super::print(&hex!("6001e200ffff00"));
Expand Down
5 changes: 4 additions & 1 deletion crates/revm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,16 @@ where

#[cfg(test)]
mod test {
extern crate alloc;

use crate::{Context, Evm};
use alloc::{boxed::Box, rc::Rc};
use bytecode::Bytecode;
use core::cell::RefCell;
use database::InMemoryDB;
use interpreter::Interpreter;
use primitives::{address, TxKind, U256};
use state::AccountInfo;
use std::{cell::RefCell, rc::Rc};
use wiring::EthereumWiring;

/// Custom evm context
Expand Down
3 changes: 3 additions & 0 deletions crates/revm/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ impl<'a, EvmWiringT: EvmWiring> EvmHandler<'a, EvmWiringT> {

#[cfg(test)]
mod test {
extern crate alloc;

use alloc::boxed::Box;
use core::cell::RefCell;
use database_interface::EmptyDB;
use std::{rc::Rc, sync::Arc};
Expand Down
9 changes: 4 additions & 5 deletions crates/wiring/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,13 @@ impl<DBError, TransactionValidationErrorT> EVMError<DBError, TransactionValidati
}
}

#[cfg(feature = "std")]
impl<DBError, TransactionValidationErrorT> std::error::Error
impl<DBError, TransactionValidationErrorT> core::error::Error
for EVMError<DBError, TransactionValidationErrorT>
where
DBError: std::error::Error + 'static,
TransactionValidationErrorT: std::error::Error + 'static,
DBError: core::error::Error + 'static,
TransactionValidationErrorT: core::error::Error + 'static,
{
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::Transaction(e) => Some(e),
Self::Header(e) => Some(e),
Expand Down

0 comments on commit 51d50f6

Please sign in to comment.