Skip to content

Commit 3b0ad92

Browse files
authored
chore: remove no-std support (#69)
* fix: use `OnceLock` for Sync reqs on `BlockOutput` * chore: remove no-std support (#70) * chore: remove no-std action * chore: remove no std support
1 parent ccc744e commit 3b0ad92

File tree

14 files changed

+25
-62
lines changed

14 files changed

+25
-62
lines changed

.github/workflows/rust-ci.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,4 @@ env:
1111

1212
jobs:
1313
rust-base:
14-
uses: init4tech/actions/.github/workflows/rust-base.yml@main
15-
16-
test-no-features:
17-
name: Test Suite (no default features)
18-
runs-on:
19-
group: init4-runners
20-
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v4
23-
- name: Install Rust toolchain
24-
uses: dtolnay/rust-toolchain@stable
25-
- uses: Swatinem/rust-cache@v2
26-
- name: Run tests
27-
env:
28-
CARGO_NET_GIT_FETCH_WITH_CLI: true
29-
run: |
30-
cargo test --no-default-features
14+
uses: init4tech/actions/.github/workflows/rust-base.yml@main

Cargo.toml

Lines changed: 7 additions & 10 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 = { version = "0.3.10", default-features = false }
30+
alloy-rlp = { version = "0.3.10", default-features = false, features = ["std"]}
3131

32-
alloy-primitives = { version = "0.8.11", default-features = false }
33-
alloy-sol-types = { version = "0.8.11", default-features = false }
32+
alloy-primitives = { version = "0.8.11", default-features = false, features = ["std"]}
33+
alloy-sol-types = { version = "0.8.11", default-features = false, features = ["std"]}
3434

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

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

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

4141
dashmap = { version = "6.1.0", optional = true }
4242

@@ -57,7 +57,6 @@ tokio = { version = "1.39", features = ["macros", "rt-multi-thread"] }
5757

5858
[features]
5959
default = [
60-
"std",
6160
"concurrent-db",
6261
"revm/std",
6362
"revm/c-kzg",
@@ -66,9 +65,7 @@ default = [
6665
"revm/secp256k1",
6766
]
6867

69-
std = ["revm/std", "alloy/std", "alloy-rlp/std", "alloy-primitives/std", "alloy-sol-types/std", "dep:zenith-types"]
70-
71-
concurrent-db = ["std", "dep:dashmap"]
68+
concurrent-db = ["dep:dashmap"]
7269

7370
test-utils = ["revm/test-utils", "revm/std", "revm/serde-json", "revm/alloydb"]
7471

src/connect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use alloc::format;
21
use core::convert::Infallible;
32
use revm::{
43
primitives::{EVMError, ResultAndState},
54
Database, DatabaseCommit,
65
};
6+
use std::format;
77

88
use crate::{
99
Block, Cfg, EvmErrored, EvmNeedsBlock, EvmNeedsCfg, EvmNeedsTx, EvmReady, EvmTransacted, Tx,

src/db/sync_state.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::db::ConcurrentCacheState;
2-
use alloc::{collections::BTreeMap, vec::Vec};
32
use alloy_primitives::{Address, B256, U256};
43
use dashmap::mapref::one::RefMut;
54
use revm::{
@@ -10,7 +9,10 @@ use revm::{
109
primitives::{Account, AccountInfo, Bytecode},
1110
Database, DatabaseCommit, DatabaseRef, TransitionAccount, TransitionState,
1211
};
13-
use std::{collections::hash_map, sync::RwLock};
12+
use std::{
13+
collections::{hash_map, BTreeMap},
14+
sync::RwLock,
15+
};
1416

1517
/// State of the blockchain.
1618
///

src/driver/alloy.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
#![cfg(feature = "std")]
2-
31
use crate::{
42
trevm_bail, trevm_ensure, unwrap_or_trevm_err, Block, BundleDriver, DriveBundleResult,
53
};
6-
use alloc::vec::Vec;
74
use alloy::{
85
consensus::{Transaction, TxEip4844Variant, TxEnvelope},
96
eips::{eip2718::Decodable2718, BlockNumberOrTag},

src/driver/mod.rs

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

54
mod block;

src/evm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::{
44
EvmNeedsCfg, EvmNeedsTx, EvmReady, EvmTransacted, HasBlock, HasCfg, HasTx, NeedsCfg, NeedsTx,
55
TransactedState, Tx,
66
};
7-
use alloc::{boxed::Box, fmt};
87
use alloy_primitives::{Address, Bytes, U256};
98
use core::convert::Infallible;
109
use revm::{
@@ -15,6 +14,7 @@ use revm::{
1514
},
1615
Database, DatabaseCommit, DatabaseRef, Evm,
1716
};
17+
use std::fmt;
1818

1919
/// Trevm provides a type-safe interface to the EVM, using the typestate pattern.
2020
///

src/fill/zenith.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#![cfg(feature = "std")]
2-
31
use crate::Tx;
4-
use alloc::vec;
52
use alloy_primitives::{Address, U256};
63
use alloy_sol_types::SolCall;
74
use revm::primitives::{TransactTo, TxEnv};

src/journal/coder.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
use crate::journal::{AcctDiff, BundleStateIndex, InfoOutcome};
2-
use alloc::{
3-
borrow::{Cow, ToOwned},
4-
collections::BTreeMap,
5-
fmt::Debug,
6-
sync::Arc,
7-
vec::Vec,
8-
};
92
use alloy_primitives::{Address, Bytes, B256, U256};
103
use alloy_rlp::{Buf, BufMut};
114
use revm::{
@@ -14,8 +7,14 @@ use revm::{
147
eof::EofDecodeError, AccountInfo, Bytecode, Eip7702Bytecode, Eip7702DecodeError, Eof,
158
},
169
};
10+
use std::{
11+
borrow::{Cow, ToOwned},
12+
collections::BTreeMap,
13+
fmt::Debug,
14+
sync::Arc,
15+
vec::Vec,
16+
};
1717

18-
#[cfg(feature = "std")]
1918
use zenith_types::Zenith;
2019

2120
type Result<T, E = JournalDecodeError> = core::result::Result<T, E>;
@@ -413,7 +412,6 @@ impl JournalEncode for BundleState {
413412
}
414413
}
415414

416-
#[cfg(feature = "std")]
417415
impl JournalEncode for Zenith::BlockHeader {
418416
fn serialized_size(&self) -> usize {
419417
ZENITH_HEADER_BYTES
@@ -639,7 +637,6 @@ impl JournalDecode for BundleState {
639637
}
640638
}
641639

642-
#[cfg(feature = "std")]
643640
impl JournalDecode for Zenith::BlockHeader {
644641
fn decode(buf: &mut &[u8]) -> Result<Self> {
645642
Ok(Self {
@@ -655,7 +652,6 @@ impl JournalDecode for Zenith::BlockHeader {
655652
#[cfg(test)]
656653
mod test {
657654
use super::*;
658-
use alloc::vec;
659655

660656
fn roundtrip<T: JournalDecode + JournalEncode + PartialEq>(expected: &T) {
661657
let enc = JournalEncode::encoded(expected);

src/journal/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use alloc::{borrow::Cow, collections::BTreeMap};
21
use alloy_primitives::{Address, Sign, B256, I256, U256};
32
use revm::{
43
db::{states::StorageSlot, AccountStatus, BundleAccount, BundleState},
54
primitives::{AccountInfo, Bytecode, HashMap},
65
};
6+
use std::{borrow::Cow, collections::BTreeMap};
77

88
/// Outcome of an account info after block execution.
99
///

0 commit comments

Comments
 (0)