Skip to content

Commit

Permalink
feat(examples): OP Stack bridge stats ExEx (paradigmxyz#7556)
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Nordbjerg <[email protected]>
Co-authored-by: Oliver Nordbjerg <[email protected]>
  • Loading branch information
3 people authored Apr 11, 2024
1 parent 007e5c2 commit 3ffc729
Show file tree
Hide file tree
Showing 9 changed files with 1,019 additions and 7 deletions.
78 changes: 77 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ members = [
"examples/trace-transaction-cli/",
"examples/polygon-p2p/",
"examples/custom-inspector/",
"examples/exex/op-bridge/",
"testing/ef-tests/",
]
default-members = ["bin/reth"]
Expand Down
2 changes: 1 addition & 1 deletion crates/exex/src/event.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use reth_primitives::BlockNumber;

/// Events emitted by an ExEx.
#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ExExEvent {
/// Highest block processed by the ExEx.
///
Expand Down
7 changes: 6 additions & 1 deletion crates/storage/provider/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use reth_primitives::{
};
use reth_trie::updates::TrieUpdates;
use revm::db::BundleState;
use std::{borrow::Cow, collections::BTreeMap, fmt};
use std::{borrow::Cow, collections::BTreeMap, fmt, ops::RangeInclusive};

/// A chain of blocks and their final state.
///
Expand Down Expand Up @@ -177,6 +177,11 @@ impl Chain {
self.blocks.len()
}

/// Returns the range of block numbers in the chain.
pub fn range(&self) -> RangeInclusive<BlockNumber> {
self.first().number..=self.tip().number
}

/// Get all receipts for the given block.
pub fn receipts_by_block_hash(&self, block_hash: BlockHash) -> Option<Vec<&Receipt>> {
let num = self.block_number(block_hash)?;
Expand Down
5 changes: 2 additions & 3 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@ license.workspace = true

[dev-dependencies]
reth-primitives.workspace = true

reth-db.workspace = true
reth-provider.workspace = true

reth-rpc-builder.workspace = true
reth-rpc-types.workspace = true
reth-rpc-types-compat.workspace = true

reth-revm.workspace = true
reth-blockchain-tree.workspace = true
reth-beacon-consensus.workspace = true
reth-network-api.workspace = true
reth-network.workspace = true
reth-transaction-pool.workspace = true
reth-tasks.workspace = true

eyre.workspace = true
futures.workspace = true
async-trait.workspace = true
Expand All @@ -38,3 +36,4 @@ path = "network.rs"
[[example]]
name = "network-txpool"
path = "network-txpool.rs"

2 changes: 1 addition & 1 deletion examples/cli-extension-event-hooks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ license.workspace = true

[dependencies]
reth.workspace = true
reth-node-ethereum.workspace = true
reth-node-ethereum.workspace = true
23 changes: 23 additions & 0 deletions examples/exex/op-bridge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "op-bridge"
version = "0.0.0"
publish = false
edition.workspace = true
license.workspace = true

[dependencies]
reth.workspace = true
reth-exex.workspace = true
reth-node-api.workspace = true
reth-node-core.workspace = true
reth-node-ethereum.workspace = true
reth-primitives.workspace = true
reth-provider.workspace = true
reth-tracing.workspace = true

eyre.workspace = true
tokio.workspace = true
futures.workspace = true
alloy-sol-types = { workspace = true, features = ["json"] }
itertools.workspace = true
rusqlite = { version = "0.31.0", features = ["bundled"] }
Loading

0 comments on commit 3ffc729

Please sign in to comment.