Skip to content

Commit

Permalink
Merge pull request #11 from taikoxyz/gwyneth_with_debug_shit_revm_and…
Browse files Browse the repository at this point in the history
…_inspector

Hook revm and inspectors into gwyneth
  • Loading branch information
Brechtpd authored Jan 11, 2025
2 parents bb68b60 + f93d526 commit 3ca34f0
Show file tree
Hide file tree
Showing 46 changed files with 2,799 additions and 1,272 deletions.
2,090 changes: 1,158 additions & 932 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 14 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ tracing = "0.1.0"
tracing-appender = "0.2"
url = "2.3"
zstd = "0.13"
bincode = "1.3"

# metrics
metrics = "0.23.0"
Expand Down Expand Up @@ -563,11 +564,18 @@ proptest-derive = "0.5"
serial_test = "3"
similar-asserts = "1.5.0"
tempfile = "3.8"
test-fuzz = "5"
test-fuzz = "5"

[patch.crates-io]
revm = { git = "https://github.com/taikoxyz/revm.git", branch = "v43-gwyneth" }
revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v43-gwyneth" }
revm-interpreter = { git = "https://github.com/taikoxyz/revm.git", branch = "v43-gwyneth" }
revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v43-gwyneth" }
revm-inspectors = { git = "https://github.com/taikoxyz/revm-inspectors.git", branch = "main-rbuilder" }
revm = { git = "https://github.com/taikoxyz/revm.git", branch = "gwyneth-debug-shit" }
revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "gwyneth-debug-shit" }
revm-interpreter = { git = "https://github.com/taikoxyz/revm.git", branch = "gwyneth-debug-shit" }
revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "gwyneth-debug-shit" }

#revm = { path = "../../revm-gwyneth/revm/crates/revm" }
#revm-primitives = { path = "../../revm-gwyneth/revm/crates/primitives" }
#revm-interpreter = { path = "../../revm-gwyneth/revm/crates/interpreter" }
#revm-precompile = { path = "../../revm-gwyneth/revm/crates/precompile" }

revm-inspectors = { git = "https://github.com/taikoxyz/revm-inspectors.git", branch = "main-rbuilder" }
#revm-inspectors = { path = "../../revm-inspector-gwyneth/revm-inspectors"}
9 changes: 8 additions & 1 deletion bin/reth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use reth::args::{DiscoveryArgs, NetworkArgs, RpcServerArgs};
use reth_chainspec::ChainSpecBuilder;
use reth_node_builder::{NodeBuilder, NodeConfig, NodeHandle};
use reth_node_ethereum::EthereumNode;
use reth_provider::NODES;
use reth_tasks::TaskManager;

const BASE_CHAIN_ID: u64 = gwyneth::exex::BASE_CHAIN_ID; // Base chain ID for L2s
Expand Down Expand Up @@ -49,13 +50,16 @@ fn main() -> eyre::Result<()> {
.with_static_l2_rpc_ip_and_port(chain_id)
);

let chain_id = chain_spec.chain.id();

let NodeHandle { node: gwyneth_node, node_exit_future: _ } =
NodeBuilder::new(node_config.clone())
.gwyneth_node(exec.clone(), chain_spec.chain.id())
.gwyneth_node(exec.clone(), chain_id)
.node(GwynethNode::default())
.launch()
.await?;

NODES.lock().unwrap().insert(chain_id, gwyneth_node.provider.clone());
gwyneth_nodes.push(gwyneth_node);
}

Expand All @@ -67,6 +71,9 @@ fn main() -> eyre::Result<()> {
.launch()
.await?;


NODES.lock().unwrap().insert(handle.node.chain_spec().chain.id(), handle.node.provider.clone());

handle.wait_for_node_exit().await
})
}
Expand Down
3 changes: 3 additions & 0 deletions crates/blockchain-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ metrics.workspace = true
# misc
aquamarine.workspace = true
linked_hash_set.workspace = true
serde.workspace = true
serde_json.workspace = true
bincode.workspace = true

[dev-dependencies]
reth-chainspec.workspace = true
Expand Down
22 changes: 2 additions & 20 deletions crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use reth_primitives::{
use reth_provider::{
BlockExecutionWriter, BlockNumReader, BlockWriter, CanonStateNotification,
CanonStateNotificationSender, CanonStateNotifications, ChainSpecProvider, ChainSplit,
ChainSplitTarget, DisplayBlocksChain, HeaderProvider, ProviderError, StaticFileProviderFactory,
ChainSplitTarget, DisplayBlocksChain, HeaderProvider, ProviderError, StaticFileProviderFactory, NODES,
};
use reth_prune_types::PruneModes;
use reth_stages_api::{MetricEvent, MetricEventsSender};
Expand Down Expand Up @@ -648,6 +648,7 @@ where
return None;
};

println!("insert_unwound_chain");
debug!(target: "blockchain_tree",
unwound_block= ?block.num_hash(),
chain_id = ?chain_id,
Expand Down Expand Up @@ -1285,25 +1286,6 @@ where
Ok(())
}

/// Unwind tables and put it inside state
pub fn unwind(&mut self, unwind_to: BlockNumber) -> Result<(), CanonicalError> {
// nothing to be done if unwind_to is higher then the tip
if self.block_indices().canonical_tip().number <= unwind_to {
return Ok(())
}
// revert `N` blocks from current canonical chain and put them inside BlockchainTree
let old_canon_chain = self.revert_canonical_from_database(unwind_to)?;

// check if there is block in chain
if let Some(old_canon_chain) = old_canon_chain {
self.state.block_indices.unwind_canonical_chain(unwind_to);
// insert old canonical chain to BlockchainTree.
self.insert_unwound_chain(AppendableChain::new(old_canon_chain));
}

Ok(())
}

/// Reverts the canonical chain down to the given block from the database and returns the
/// unwound chain.
///
Expand Down
Loading

0 comments on commit 3ca34f0

Please sign in to comment.