Skip to content
Open
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ signet-node-config = { version = "0.16.0-rc.7", path = "crates/node-config" }
signet-node-tests = { version = "0.16.0-rc.7", path = "crates/node-tests" }
signet-node-types = { version = "0.16.0-rc.7", path = "crates/node-types" }
signet-rpc = { version = "0.16.0-rc.7", path = "crates/rpc" }
signet-rpc-storage = { version = "0.16.0-rc.7", path = "crates/rpc-storage" }

init4-bin-base = { version = "0.18.0-rc.8", features = ["alloy"] }

Expand All @@ -55,6 +56,10 @@ signet-tx-cache = "0.16.0-rc.8"
signet-types = "0.16.0-rc.8"
signet-zenith = "0.16.0-rc.8"
signet-journal = "0.16.0-rc.8"
signet-storage = "0.2.0"
signet-cold = "0.2.0"
signet-hot = "0.2.0"
signet-storage-types = "0.2.0"

# ajj
ajj = { version = "0.3.4" }
Expand Down
6 changes: 3 additions & 3 deletions crates/node-tests/tests/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,13 @@ async fn getLogs_post(ctx: &SignetTestContext, contract: &TestCounterInstance) {
.await
.unwrap();

// Two logs: one from the host transact, one from the alloy tx
// Two logs: one from the alloy tx, one from the host transact
assert_eq!(logs.len(), 2);
let log_inner = &logs[0].inner;
assert_eq!(log_inner.address, *contract.address());
// First increment is from the host transact (system tx runs first)
// First increment is from the alloy tx (regular txs execute before system txs)
assert_eq!(log_inner.topics(), &[Counter::Count::SIGNATURE_HASH, B256::with_last_byte(1)]);
// Second increment is from the alloy tx
// Second increment is from the host transact (system tx)
let log_inner = &logs[1].inner;
assert_eq!(log_inner.address, *contract.address());
assert_eq!(log_inner.topics(), &[Counter::Count::SIGNATURE_HASH, B256::with_last_byte(2)]);
Expand Down
46 changes: 46 additions & 0 deletions crates/rpc-storage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[package]
name = "signet-rpc-storage"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
description = "Ethereum JSON-RPC server backed by signet-storage"

[dependencies]
signet-storage.workspace = true
signet-cold.workspace = true
signet-hot.workspace = true
signet-storage-types.workspace = true
signet-evm.workspace = true
trevm = { workspace = true, features = ["call", "estimate_gas"] }
signet-types.workspace = true
signet-tx-cache.workspace = true
signet-bundle.workspace = true
alloy.workspace = true
ajj.workspace = true
tokio.workspace = true
tokio-util = "0.7"
tracing.workspace = true
thiserror.workspace = true
serde.workspace = true
dashmap = "6.1.0"
revm-inspectors.workspace = true
itertools.workspace = true

[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tokio-util = "0.7"
signet-cold = { workspace = true, features = ["test-utils"] }
signet-hot = { workspace = true, features = ["test-utils"] }
signet-storage.workspace = true
signet-storage-types.workspace = true
signet-constants.workspace = true
alloy.workspace = true
serde_json.workspace = true
axum = "0.8"
tower = { version = "0.5", features = ["util"] }
http = "1"
trevm.workspace = true
16 changes: 16 additions & 0 deletions crates/rpc-storage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# signet-rpc-storage

Ethereum JSON-RPC server backed by `signet-storage`'s unified storage backend.

This crate provides a standalone ETH RPC implementation that uses hot storage
for state queries and cold storage for block, transaction, and receipt data.
Unlike `signet-rpc`, it does not depend on reth's `FullNodeComponents`.

## Supported Methods

- Block queries: `eth_blockNumber`, `eth_getBlockByHash`, `eth_getBlockByNumber`, etc.
- Transaction queries: `eth_getTransactionByHash`, `eth_getTransactionReceipt`, etc.
- Account state: `eth_getBalance`, `eth_getStorageAt`, `eth_getCode`, `eth_getTransactionCount`
- EVM execution: `eth_call`, `eth_estimateGas`
- Logs: `eth_getLogs`
- Transaction submission: `eth_sendRawTransaction` (optional, via `TxCache`)
85 changes: 85 additions & 0 deletions crates/rpc-storage/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//! Configuration for the storage-backed RPC server.

use std::time::Duration;

/// Configuration for the storage-backed ETH RPC server.
///
/// Mirrors the subset of reth's `EthConfig` that applies to
/// storage-backed RPC.
///
/// # Example
///
/// ```
/// use signet_rpc_storage::StorageRpcConfig;
///
/// // Use defaults (matches reth defaults).
/// let config = StorageRpcConfig::default();
/// assert_eq!(config.rpc_gas_cap, 30_000_000);
/// ```
#[derive(Debug, Clone, Copy)]
pub struct StorageRpcConfig {
/// Maximum gas for `eth_call` and `eth_estimateGas`.
///
/// Default: `30_000_000` (30M gas).
pub rpc_gas_cap: u64,

/// Maximum block range per `eth_getLogs` query.
///
/// Default: `10_000`.
pub max_blocks_per_filter: u64,

/// Maximum number of logs returned per `eth_getLogs` response.
/// Set to `0` to disable the limit.
///
/// Default: `20_000`.
pub max_logs_per_response: usize,

/// Maximum concurrent tracing/debug requests.
///
/// Controls the size of the semaphore that gates debug
/// namespace calls.
///
/// Default: `25`.
pub max_tracing_requests: usize,

/// Time-to-live for stale filters and subscriptions.
///
/// Default: `5 minutes`.
pub stale_filter_ttl: Duration,

/// Number of recent blocks to consider for gas price suggestions.
///
/// Default: `20`.
pub gas_oracle_block_count: u64,

/// Percentile of effective tips to use as the gas price suggestion.
///
/// Default: `60.0`.
pub gas_oracle_percentile: f64,

/// Maximum header history for `eth_feeHistory` without percentiles.
///
/// Default: `1024`.
pub max_header_history: u64,

/// Maximum block history for `eth_feeHistory` with percentiles.
///
/// Default: `1024`.
pub max_block_history: u64,
}

impl Default for StorageRpcConfig {
fn default() -> Self {
Self {
rpc_gas_cap: 30_000_000,
max_blocks_per_filter: 10_000,
max_logs_per_response: 20_000,
max_tracing_requests: 25,
stale_filter_ttl: Duration::from_secs(5 * 60),
gas_oracle_block_count: 20,
gas_oracle_percentile: 60.0,
max_header_history: 1024,
max_block_history: 1024,
}
}
}
Loading