Skip to content

Commit 8b755a7

Browse files
authored
refactor: remove reth dependency from signet sdk (#103)
1 parent ecf69e0 commit 8b755a7

File tree

6 files changed

+35
-121
lines changed

6 files changed

+35
-121
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ alloy = { version = "1.0.19", features = [
5959
] }
6060
alloy-contract = { version = "1.0.19", features = ["pubsub"] }
6161

62-
# Reth
63-
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
64-
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.5.1" }
65-
6662
# Async
6763
tokio = { version = "1.43.0", features = ["macros"] }
6864
async-trait = "0.1.87"

crates/test-utils/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ trevm = { workspace = true, features = ["test-utils"] }
2121

2222
alloy.workspace = true
2323

24-
reth.workspace = true
25-
reth-exex.workspace = true
26-
2724
tracing-subscriber.workspace = true
28-
tokio.workspace = true
25+
tokio.workspace = true
26+
27+
[dev-dependencies]
28+
tracing-subscriber = { workspace = true, features = ["env-filter"] }

crates/test-utils/src/convert.rs

Lines changed: 0 additions & 99 deletions
This file was deleted.

crates/test-utils/src/evm.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use reth::revm::context::CfgEnv;
21
use signet_constants::test_utils::*;
3-
use trevm::revm::{database::in_memory_db::InMemoryDB, primitives::hardfork::SpecId};
2+
use trevm::revm::{
3+
context::CfgEnv, database::in_memory_db::InMemoryDB, primitives::hardfork::SpecId,
4+
};
45

56
/// Create a new Signet EVM with an in-memory database for testing.
67
pub fn test_signet_evm() -> signet_evm::EvmNeedsBlock<InMemoryDB> {

crates/test-utils/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pub mod chain;
2-
pub mod convert;
32
pub mod evm;
43
pub mod specs;
54
pub mod users;

crates/test-utils/src/specs/notif_spec.rs

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
1-
use crate::{convert::ToRethPrimitive, specs::HostBlockSpec};
1+
use crate::{chain::Chain, specs::HostBlockSpec};
22
use alloy::consensus::BlobTransactionSidecar;
3-
use reth_exex::ExExNotification;
43
use signet_types::primitives::TransactionSigned;
54
use std::{collections::BTreeMap, sync::Arc};
65

6+
/// A shim for reth_exex::ExExNotification that allows us to use it in tests.
7+
#[derive(Debug, Clone, PartialEq, Eq)]
8+
pub enum ExExNotification {
9+
/// Chain got committed without a reorg, and only the new chain is returned.
10+
Committed {
11+
/// The new chain after commit.
12+
new: Arc<Chain>,
13+
},
14+
/// Chain got reorged, and both the old and the new chains are returned.
15+
Reorged {
16+
/// The old chain before reorg.
17+
old: Arc<Chain>,
18+
/// The new chain after reorg.
19+
new: Arc<Chain>,
20+
},
21+
/// Chain got reverted, and only the old chain is returned.
22+
Reverted {
23+
/// The old chain before reversion.
24+
old: Arc<Chain>,
25+
},
26+
}
27+
728
/// A notification spec.
829
#[derive(Debug, Default)]
930
pub struct NotificationSpec {
@@ -86,22 +107,18 @@ impl NotificationSpec {
86107

87108
match (old_chain, new_chain) {
88109
(Some(old_chain), Some(new_chain)) => NotificationWithSidecars {
89-
notification: ExExNotification::ChainReorged {
90-
old: Arc::new(old_chain.to_reth()),
91-
new: Arc::new(new_chain.to_reth()),
110+
notification: ExExNotification::Reorged {
111+
old: Arc::new(old_chain),
112+
new: Arc::new(new_chain),
92113
},
93114
sidecars,
94115
},
95116
(Some(old_chain), None) => NotificationWithSidecars {
96-
notification: ExExNotification::ChainReverted {
97-
old: Arc::new(old_chain.to_reth()),
98-
},
117+
notification: ExExNotification::Reverted { old: Arc::new(old_chain) },
99118
sidecars,
100119
},
101120
(None, Some(new_chain)) => NotificationWithSidecars {
102-
notification: ExExNotification::ChainCommitted {
103-
new: Arc::new(new_chain.to_reth()),
104-
},
121+
notification: ExExNotification::Committed { new: Arc::new(new_chain) },
105122
sidecars,
106123
},
107124
(None, None) => panic!("missing old and new chains"),

0 commit comments

Comments
 (0)