Skip to content

Commit 5f8a86e

Browse files
authored
fix(crate): disable std for all deps (#61)
* fix(crate): disable std for all deps This fixes an issue with the no-std PR, which did not properly disable std for all the other deps. This is blocked on revm/alloy implementing `core::error::Error` instead of `std` on the erroring types. * chore: gate mod journal * chore: feature gates * chore: feature gates
1 parent 5e49efb commit 5f8a86e

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ option-if-let-else = "warn"
2727
redundant-clone = "warn"
2828

2929
[dependencies]
30-
alloy-rlp = "0.3"
30+
alloy-rlp = { version = "0.3", default-features = false }
3131

32-
alloy-primitives = "=0.8.8"
33-
alloy-sol-types = "=0.8.8"
32+
alloy-primitives = { version = "=0.8.8", default-features = false }
33+
alloy-sol-types = { version = "=0.8.8", default-features = false }
3434

35-
alloy = { version = "=0.5.2", default-features = false, features = ["consensus", "rpc-types-mev"] }
35+
alloy = { version = "=0.5.2", default-features = false, features = ["consensus", "rpc-types-mev", "eips", "k256"] }
3636

37-
revm = { version = "16.0.0", default-features = false, features = ["std"] }
37+
revm = { version = "16.0.0", default-features = false }
3838

39-
zenith-types = "0.10"
39+
zenith-types = { version = "0.10", optional = true }
4040

4141
[dev-dependencies]
4242
alloy-rlp = { version = "0.3", default-features = false }
@@ -63,7 +63,7 @@ default = [
6363
"revm/secp256k1",
6464
]
6565

66-
std = ["revm/std", "alloy/std", "alloy-rlp/std", "alloy-primitives/std", "alloy-sol-types/std"]
66+
std = ["revm/std", "alloy/std", "alloy-rlp/std", "alloy-primitives/std", "alloy-sol-types/std", "dep:zenith-types"]
6767

6868
test-utils = ["revm/test-utils", "revm/std", "revm/serde-json", "revm/alloydb"]
6969

src/driver/alloy.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(feature = "std")]
2+
13
use crate::{
24
trevm_bail, trevm_ensure, unwrap_or_trevm_err, Block, BundleDriver, DriveBundleResult,
35
};
@@ -76,8 +78,8 @@ impl<Db: revm::Database> From<EVMError<Db::Error>> for BundleError<Db> {
7678
}
7779
}
7880

79-
impl<Db: revm::Database> core::error::Error for BundleError<Db> {
80-
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
81+
impl<Db: revm::Database> std::error::Error for BundleError<Db> {
82+
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
8183
match self {
8284
Self::TransactionDecodingError(err) => Some(err),
8385
Self::TransactionSenderRecoveryError(err) => Some(err),

src/driver/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mod alloy;
2+
#[cfg(feature = "std")]
23
pub use alloy::{BundleError, BundleProcessor};
34

45
mod block;

src/fill/zenith.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(feature = "std")]
2+
13
use crate::Tx;
24
use alloc::vec;
35
use alloy_primitives::{Address, U256};

src/journal/coder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ use revm::{
1414
eof::EofDecodeError, AccountInfo, Bytecode, Eip7702Bytecode, Eip7702DecodeError, Eof,
1515
},
1616
};
17+
18+
#[cfg(feature = "std")]
1719
use zenith_types::Zenith;
1820

1921
type Result<T, E = JournalDecodeError> = core::result::Result<T, E>;
@@ -411,6 +413,7 @@ impl JournalEncode for BundleState {
411413
}
412414
}
413415

416+
#[cfg(feature = "std")]
414417
impl JournalEncode for Zenith::BlockHeader {
415418
fn serialized_size(&self) -> usize {
416419
ZENITH_HEADER_BYTES
@@ -636,6 +639,7 @@ impl JournalDecode for BundleState {
636639
}
637640
}
638641

642+
#[cfg(feature = "std")]
639643
impl JournalDecode for Zenith::BlockHeader {
640644
fn decode(buf: &mut &[u8]) -> Result<Self> {
641645
Ok(Self {

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,11 @@ extern crate alloc;
365365

366366
mod driver;
367367
pub use driver::{
368-
BlockDriver, BundleDriver, BundleError, BundleProcessor, ChainDriver, DriveBlockResult,
369-
DriveBundleResult, DriveChainResult, RunTxResult,
368+
BlockDriver, BundleDriver, ChainDriver, DriveBlockResult, DriveBundleResult, DriveChainResult,
369+
RunTxResult,
370370
};
371+
#[cfg(feature = "std")]
372+
pub use driver::{BundleError, BundleProcessor};
371373

372374
mod evm;
373375
pub use evm::Trevm;
@@ -378,6 +380,7 @@ pub use ext::EvmExtUnchecked;
378380
mod fill;
379381
pub use fill::{Block, Cfg, DisableGasChecks, DisableNonceCheck, NoopBlock, NoopCfg, Tx};
380382

383+
#[cfg(feature = "std")]
381384
pub mod journal;
382385

383386
mod lifecycle;

0 commit comments

Comments
 (0)