Skip to content

Commit 958b16c

Browse files
committed
chore: release v0.4.0
Major feature release with provider utilities, transport layers, and batch operations. Highlights: - Connection pooling and dynamic provider utilities for multi-chain apps - Tower-based rate limiting, retry with exponential backoff, and logging layers - EIP-4844 blob gas support with comprehensive utilities - Batch fetching for transactions, receipts, balances, and token decimals - WebSocket support for real-time event streaming - Minimum Rust version updated to 1.92
1 parent c252633 commit 958b16c

File tree

3 files changed

+106
-11
lines changed

3 files changed

+106
-11
lines changed

CHANGELOG.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,96 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.4.0] - 2026-01-03
11+
12+
### Added
13+
14+
#### Provider Utilities
15+
16+
- **Connection Pooling**: Thread-safe provider pooling for efficient connection reuse across concurrent operations
17+
- `ProviderPool`: Thread-safe pool using RwLock for concurrent access
18+
- `ProviderPoolBuilder`: Builder pattern for easy configuration
19+
- `ChainEndpoint`: Configuration struct with chain-specific helpers
20+
- `PooledProvider`: Type alias for Arc<RootProvider<AnyNetwork>>
21+
- Lazy provider initialization via `get_or_add()`
22+
- Per-chain rate limiting support
23+
- Compatible with `std::sync::LazyLock` for static pools
24+
25+
- **Dynamic Provider Utilities**: Runtime chain selection without compile-time network constraints
26+
- Type aliases: `AnyHttpProvider`, `EthereumHttpProvider`, `OptimismHttpProvider`
27+
- `NetworkType` enum with `network_type_for_chain()` for chain categorization
28+
- `ChainAwareProvider` wrapper for tracking chain metadata
29+
- Factory functions: `create_http_provider`, `create_ws_provider`, `create_typed_http_provider`
30+
- `ProviderConfig` with presets for public/private endpoints, Infura, Alchemy
31+
32+
#### Transport Layers
33+
34+
- **Rate Limiting Layer**: Token bucket rate limiter with configurable limits
35+
- `RateLimitLayer::per_second(n)` for requests-per-second limiting
36+
- `RateLimitLayer::with_min_delay(duration)` for fixed delays between requests
37+
- Async-safe with Arc<Mutex<RateLimitState>>
38+
39+
- **Logging Layer**: RPC call tracing with configurable verbosity
40+
- Automatic method extraction from RequestPacket
41+
- Duration tracking in tracing spans
42+
- Optional request/response payload logging via `with_request_logging()` and `verbose()`
43+
44+
- **Retry Layer**: Automatic retry of transient RPC failures with exponential backoff
45+
- `RetryLayer::new()` with configurable max retries, base delay, and max delay
46+
- Builder pattern for flexible configuration
47+
- Preset configurations: `aggressive()` and `conservative()`
48+
- Uses Alloy's `is_retry_err()` for smart error classification
49+
50+
#### Gas Calculation
51+
52+
- **EIP-4844 Blob Gas Support**: Comprehensive blob gas tracking and utilities
53+
- `BlobGasPrice` type with `from_gwei()` and `cost_for_blobs()` methods
54+
- `GasBreakdown` struct separating execution/blob/L1 costs
55+
- `GasBreakdownBuilder` for flexible breakdown construction
56+
- Enhanced `L1Gas`/`L2Gas` with `blob_count` and `blob_gas_price` fields
57+
- `GasCostResult` now includes `breakdown` field for analytics
58+
- New `blob` module with utilities:
59+
- `get_blob_base_fee()` - fetch from latest block
60+
- `get_blob_base_fee_at_block()` - fetch from specific block
61+
- `estimate_blob_cost()` - estimate cost for N blobs
62+
- `calculate_blob_gas()` - pure blob gas calculation
63+
- `max_blob_gas_per_block()` - returns 786,432 max
64+
- `estimate_total_tx_cost()` - combines execution + blob costs
65+
66+
#### Batch Operations
67+
68+
- **Batch Fetching for Transactions and Receipts**: Two-pass batch approach for fetching transactions and receipts in parallel via `futures::join_all`
69+
- **Batch Balance Utilities**: Fetch multiple token/ETH balances efficiently
70+
- `batch_fetch_balances()` for ERC-20 token balances
71+
- `batch_fetch_eth_balances()` for native ETH balances
72+
- New types: `BalanceQuery`, `BalanceResult`, `BalanceError`
73+
- Compatible with Alloy's `CallBatchLayer` for automatic Multicall3 batching
74+
75+
- **Batch Token Decimals**: `batch_fetch_decimals()` for fetching multiple token decimals in parallel
76+
77+
#### Real-Time Events
78+
79+
- **WebSocket Support**: Real-time event streaming via WebSocket subscriptions
80+
- `RealtimeEventScanner` for WebSocket-based event subscriptions
81+
- `subscribe_blocks()` for real-time block headers
82+
- `subscribe_logs()` for real-time log events
83+
- `subscribe_logs_with_catchup()` for subscriptions with historical catchup
84+
- New `SubscriptionFailed` error variant for WebSocket errors
85+
86+
#### Documentation
87+
88+
- **Network Selection Guide** (`docs/NETWORK_SELECTION.md`): Comprehensive guide for choosing between Ethereum, Optimism, and AnyNetwork types
89+
- **Provider Setup Examples** (`docs/PROVIDER_SETUP.md`): Practical examples covering rate limiting, retry, logging, pooling, and WebSocket providers
90+
91+
### Changed
92+
93+
- **Minimum Rust version**: Updated to 1.92 (from 1.89)
94+
- **Dependencies**: Updated and upgraded all cargo dependencies
95+
96+
### Fixed
97+
98+
- Fixed doctest imports in blob module to use correct public paths
99+
10100
## [0.3.0] - 2025-11-16
11101

12102
### Breaking Changes

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "semioscan"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["Joseph Livesey <joseph@semiotic.ai>"]
6-
rust-version = "1.89"
6+
rust-version = "1.92"
77
description = "Production-grade Rust library for blockchain analytics: gas calculation, price extraction, and block window calculations for EVM chains"
88
license = "Apache-2.0"
99
repository = "https://github.com/semiotic-ai/semioscan"
@@ -46,7 +46,10 @@ alloy-transport-http = { version = "1.2", default-features = false, features = [
4646
] }
4747
async-trait = "0.1"
4848
# futures with std enables join_all for batch RPC calls and StreamExt for WebSocket subscriptions
49-
futures = { version = "0.3", default-features = false, features = ["alloc", "std"] }
49+
futures = { version = "0.3", default-features = false, features = [
50+
"alloc",
51+
"std",
52+
] }
5053
bigdecimal = { version = "0.4", features = ["serde"] }
5154
chrono = { version = "0.4", features = ["serde"] }
5255
op-alloy-network = "0.22"

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ Built on [Alloy](https://github.com/alloy-rs/alloy), the modern Ethereum library
6161

6262
## Features
6363

64-
- **Gas Cost Calculation**: Accurately calculate transaction gas costs for both L1 (Ethereum) and L2 (Optimism Stack) chains, including L1 data fees
64+
- **Gas Cost Calculation**: Accurately calculate transaction gas costs for both L1 (Ethereum) and L2 (Optimism Stack) chains, including L1 data fees and EIP-4844 blob gas
6565
- **Block Window Calculations**: Map UTC dates to blockchain block ranges with intelligent caching
6666
- **DEX Price Extraction**: Extensible trait-based system for extracting price data from on-chain swap events
6767
- **Multi-Chain Support**: Works with 12+ EVM chains including Ethereum, Arbitrum, Base, Optimism, Polygon, and more
68-
- **Event Scanning**: Extract transfer amounts and events from blockchain transaction logs
68+
- **Event Scanning**: Extract transfer amounts and events from blockchain transaction logs with real-time WebSocket subscriptions
69+
- **Provider Utilities**: Connection pooling, rate limiting, retry with exponential backoff, and logging layers
70+
- **Batch Operations**: Efficient batch fetching for transactions, receipts, balances, and token decimals
6971
- **Production-Ready**: Battle-tested in production for automated trading and DeFi applications processing millions of dollars in swaps
7072

7173
## Use Cases
@@ -87,10 +89,10 @@ Add semioscan to your `Cargo.toml`:
8789
```toml
8890
[dependencies]
8991
# Core library (gas, block windows, events)
90-
semioscan = "0.3"
92+
semioscan = "0.4"
9193

9294
# With Odos DEX reference implementation (optional)
93-
semioscan = { version = "0.3", features = ["odos-example"] }
95+
semioscan = { version = "0.4", features = ["odos-example"] }
9496
```
9597

9698
### Feature Flags
@@ -611,13 +613,13 @@ cargo run --package semioscan --example router_token_discovery -- arbitrum
611613

612614
Semioscan may not be the best choice for:
613615

614-
- **Real-time price feeds**: Use WebSocket-based oracles (Chainlink, Pyth, etc.) for sub-second price updates
616+
- **Real-time price feeds**: Use WebSocket-based oracles (Chainlink, Pyth, etc.) for sub-second price updates (though Semioscan now supports WebSocket subscriptions for event streaming)
615617
- **Non-EVM chains**: Semioscan is EVM-specific (Solana, Cosmos, etc. are not supported)
616-
- **Simple balance queries**: Use lighter libraries like `ethers-rs` for basic token balances
618+
- **Simple balance queries**: Use lighter libraries for basic token balances (though Semioscan provides efficient batch balance queries)
617619
- **Indexing entire chains**: Use The Graph or custom indexers for comprehensive blockchain indexing
618-
- **High-frequency trading**: RPC-based queries have latency; use WebSocket streams or MEV infrastructure
620+
- **High-frequency trading**: For ultra-low latency, use dedicated MEV infrastructure
619621

620-
Semioscan excels at **batch analytics**, **historical queries**, and **multi-chain operations** where accurate gas cost calculation and flexible price extraction are required.
622+
Semioscan excels at **batch analytics**, **historical queries**, **real-time event streaming**, and **multi-chain operations** where accurate gas cost calculation and flexible price extraction are required.
621623

622624
## Production Usage
623625

0 commit comments

Comments
 (0)