Skip to content

Commit

Permalink
ok revert some ;
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jun 18, 2024
1 parent b5f410a commit 002da6c
Show file tree
Hide file tree
Showing 302 changed files with 1,750 additions and 1,534 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ workspace = true

[dependencies]
# reth
reth-chainspec.workspace = true
reth-config.workspace = true
reth-primitives.workspace = true
reth-fs-util.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use crate::{
version::{LONG_VERSION, SHORT_VERSION},
};
use clap::{value_parser, Parser, Subcommand};
use reth_chainspec::ChainSpec;
use reth_cli_runner::CliRunner;
use reth_db::DatabaseEnv;
use reth_node_builder::{NodeBuilder, WithLaunchContext};
use reth_primitives::ChainSpec;
use reth_tracing::FileWorkerGuard;
use std::{ffi::OsString, fmt, future::Future, sync::Arc};
use tracing::info;
Expand Down
5 changes: 2 additions & 3 deletions bin/reth/src/commands/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use clap::Parser;
use reth_beacon_consensus::EthBeaconConsensus;
use reth_chainspec::ChainSpec;
use reth_config::{config::EtlConfig, Config};
use reth_db::{init_db, open_db_read_only, DatabaseEnv};
use reth_db_common::init::init_genesis;
Expand All @@ -15,7 +14,7 @@ use reth_node_core::{
},
dirs::{ChainPath, DataDirPath},
};
use reth_primitives::B256;
use reth_primitives::{ChainSpec, B256};
use reth_provider::{providers::StaticFileProvider, ProviderFactory, StaticFileProviderFactory};
use reth_stages::{sets::DefaultStages, Pipeline, PipelineTarget};
use reth_static_file::StaticFileProducer;
Expand Down Expand Up @@ -116,7 +115,7 @@ impl EnvironmentArgs {
{
if factory.db_ref().is_read_only() {
warn!(target: "reth::cli", ?unwind_target, "Inconsistent storage. Restart node to heal.");
return Ok(factory);
return Ok(factory)
}

let prune_modes = config.prune.clone().map(|prune| prune.segments).unwrap_or_default();
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<DB: Database> TableViewer<(u64, Duration)> for ChecksumViewer<'_, DB> {

total = index + 1;
if total >= limit {
break;
break
}
}

Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/db/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ where
) {
// do not bother comparing if the key is already in the discrepancies map
if self.discrepancies.contains_key(&key) {
return;
return
}

// do not bother comparing if the key is already in the extra elements map
if self.extra_elements.contains_key(&key) {
return;
return
}

match (first, second) {
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Command {
.as_ref()
.map(|search| {
if let Some(search) = search.strip_prefix("0x") {
return hex::decode(search).unwrap();
return hex::decode(search).unwrap()
}
search.as_bytes().to_vec()
})
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl Command {

if !input.trim().eq_ignore_ascii_case("y") {
println!("Database drop aborted!");
return Ok(());
return Ok(())
}
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ where
}
}

return Ok(false);
return Ok(false)
}

match event {
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/debug_cmd/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl Command {
match get_single_header(&client, BlockHashOrNumber::Number(block)).await {
Ok(tip_header) => {
info!(target: "reth::cli", ?block, "Successfully fetched block");
return Ok(tip_header.hash());
return Ok(tip_header.hash())
}
Err(error) => {
error!(target: "reth::cli", ?block, %error, "Failed to fetch the block. Retrying...");
Expand Down Expand Up @@ -202,7 +202,7 @@ impl Command {
provider.get_stage_checkpoint(StageId::Finish)?.map(|ch| ch.block_number);
if latest_block_number.unwrap_or_default() >= self.to {
info!(target: "reth::cli", latest = latest_block_number, "Nothing to run");
return Ok(());
return Ok(())
}

let pipeline_events = pipeline.events();
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/debug_cmd/in_memory_merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl Command {

if in_memory_state_root == block.state_root {
info!(target: "reth::cli", state_root = ?in_memory_state_root, "Computed in-memory state root matches");
return Ok(());
return Ok(())
}

let provider_rw = provider_factory.provider_rw()?;
Expand Down
6 changes: 3 additions & 3 deletions bin/reth/src/commands/debug_cmd/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl Command {

if incremental_result.is_ok() {
debug!(target: "reth::cli", block_number, "Successfully computed incremental root");
continue;
continue
}

warn!(target: "reth::cli", block_number, "Incremental calculation failed, retrying from scratch");
Expand All @@ -210,7 +210,7 @@ impl Command {
let clean_result = merkle_stage.execute(&provider_rw, clean_input);
assert!(clean_result.is_ok(), "Clean state root calculation failed");
if clean_result.unwrap().done {
break;
break
}
}

Expand Down Expand Up @@ -270,7 +270,7 @@ impl Command {
clean.1.nibbles.len() > self.skip_node_depth.unwrap_or_default()
{
first_mismatched_storage = Some((incremental, clean));
break;
break
}
}
(Some(incremental), None) => {
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/dump_genesis.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Command that dumps genesis block JSON configuration to stdout
use crate::args::utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS};
use clap::Parser;
use reth_chainspec::ChainSpec;
use reth_primitives::ChainSpec;
use std::sync::Arc;

/// Dumps genesis block JSON configuration to stdout
Expand Down Expand Up @@ -39,7 +39,7 @@ mod tests {
DumpGenesisCommand::parse_from(["reth", "--chain", chain]);
assert_eq!(
Ok(args.chain.chain),
chain.parse::<reth_chainspec::Chain>(),
chain.parse::<reth_primitives::Chain>(),
"failed to parse chain {chain}"
);
}
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ mod tests {
let args: ImportCommand = ImportCommand::parse_from(["reth", "--chain", chain, "."]);
assert_eq!(
Ok(args.env.chain.chain),
chain.parse::<reth_chainspec::Chain>(),
chain.parse::<reth_primitives::Chain>(),
"failed to parse chain {chain}"
);
}
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/import_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl ImportOpCommand {
body.transactions.retain(|_| {
if is_dup_tx(block_number) {
total_filtered_out_dup_txns += 1;
return false;
return false
}
true
})
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/import_receipts_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ where

if total_decoded_receipts == 0 {
error!(target: "reth::cli", "No receipts were imported, ensure the receipt file is valid and not empty");
return Ok(());
return Ok(())
}

let total_imported_receipts = static_file_provider
Expand Down
6 changes: 3 additions & 3 deletions bin/reth/src/commands/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use crate::args::{
RpcServerArgs, TxPoolArgs,
};
use clap::{value_parser, Args, Parser};
use reth_chainspec::ChainSpec;
use reth_cli_runner::CliContext;
use reth_db::{init_db, DatabaseEnv};
use reth_node_builder::{NodeBuilder, WithLaunchContext};
use reth_node_core::{node_config::NodeConfig, version};
use reth_primitives::ChainSpec;
use std::{ffi::OsString, fmt, future::Future, net::SocketAddr, path::PathBuf, sync::Arc};

/// Start the node
Expand Down Expand Up @@ -213,7 +213,7 @@ mod tests {
fn parse_common_node_command_chain_args() {
for chain in SUPPORTED_CHAINS {
let args: NodeCommand = NodeCommand::<NoArgs>::parse_from(["reth", "--chain", chain]);
assert_eq!(args.chain.chain, chain.parse::<reth_chainspec::Chain>().unwrap());
assert_eq!(args.chain.chain, chain.parse::<reth_primitives::Chain>().unwrap());
}
}

Expand Down Expand Up @@ -305,7 +305,7 @@ mod tests {
#[cfg(not(feature = "optimism"))] // dev mode not yet supported in op-reth
fn parse_dev() {
let cmd = NodeCommand::<NoArgs>::parse_from(["reth", "--dev"]);
let chain = reth_chainspec::DEV.clone();
let chain = reth_primitives::DEV.clone();
assert_eq!(cmd.chain.chain, chain.chain);
assert_eq!(cmd.chain.genesis_hash, chain.genesis_hash);
assert_eq!(
Expand Down
3 changes: 1 addition & 2 deletions bin/reth/src/commands/p2p/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ use crate::{
use backon::{ConstantBuilder, Retryable};
use clap::{Parser, Subcommand};
use discv5::ListenConfig;
use reth_chainspec::ChainSpec;
use reth_config::Config;
use reth_db::create_db;
use reth_network::NetworkConfigBuilder;
use reth_network_p2p::bodies::client::BodiesClient;
use reth_node_core::args::DatadirArgs;
use reth_primitives::BlockHashOrNumber;
use reth_primitives::{BlockHashOrNumber, ChainSpec};
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
use std::{
net::{IpAddr, SocketAddrV4, SocketAddrV6},
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/dump/hashing_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async fn dry_run<DB: Database>(
checkpoint: Some(StageCheckpoint::new(from)),
};
if stage.execute(&provider, input)?.done {
break;
break
}
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/dump/hashing_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async fn dry_run<DB: Database>(
checkpoint: Some(StageCheckpoint::new(from)),
};
if stage.execute(&provider, input)?.done {
break;
break
}
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/dump/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ async fn dry_run<DB: Database>(
checkpoint: Some(StageCheckpoint::new(from)),
};
if stage.execute(&provider, input)?.done {
break;
break
}
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl Command {
}

if done {
break;
break
}
}
info!(target: "reth::cli", stage = %self.stage, time = ?start.elapsed(), "Finished stage");
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/test_vectors/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ where
let key: T::Key = strat_keys.new_tree(runner).map_err(|e| eyre::eyre!("{e}"))?.current();

if !seen_keys.insert(key.clone()) {
continue;
continue
}

let mut values: Vec<T::Value> =
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/sigsegv_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern "C" fn print_stack_trace(_: libc::c_int) {
// Collect return addresses
let depth = libc::backtrace(STACK_TRACE.as_mut_ptr(), MAX_FRAMES as i32);
if depth == 0 {
return;
return
}
&STACK_TRACE.as_slice()[0..(depth as _)]
};
Expand All @@ -69,7 +69,7 @@ extern "C" fn print_stack_trace(_: libc::c_int) {
let period = period.saturating_add(1); // avoid "what if wrapped?" branches
let Some(offset) = stack.iter().skip(period).zip(stack).position(cycled) else {
// impossible.
return;
return
};

// Count matching trace slices, else we could miscount "biphasic cycles"
Expand Down
14 changes: 7 additions & 7 deletions bin/reth/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use boyer_moore_magiclen::BMByte;
use eyre::Result;
use reth_chainspec::ChainSpec;
use reth_db::{RawTable, TableRawRow};
use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO},
Expand All @@ -12,6 +11,7 @@ use reth_db_api::{
DatabaseError,
};
use reth_fs_util as fs;
use reth_primitives::ChainSpec;
use reth_provider::{ChainSpecProvider, ProviderFactory};
use std::{path::Path, rc::Rc, sync::Arc};
use tracing::info;
Expand Down Expand Up @@ -68,18 +68,18 @@ impl<DB: Database> DbTool<DB> {
let (key, value) = (k.into_key(), v.into_value());

if key.len() + value.len() < filter.min_row_size {
return None;
return None
}
if key.len() < filter.min_key_size {
return None;
return None
}
if value.len() < filter.min_value_size {
return None;
return None
}

let result = || {
if filter.only_count {
return None;
return None
}
Some((
<T as Table>::Key::decode(&key).unwrap(),
Expand All @@ -93,12 +93,12 @@ impl<DB: Database> DbTool<DB> {
searcher.find_first_in(&key).is_some()
{
hits += 1;
return result();
return result()
}
}
None => {
hits += 1;
return result();
return result()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/blockchain-tree/src/block_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl BlockBuffer {
// discard all blocks that are before the finalized number.
while let Some(entry) = self.earliest_blocks.first_entry() {
if *entry.key() > block_number {
break;
break
}
let block_hashes = entry.remove();
block_hashes_to_remove.extend(block_hashes);
Expand Down
Loading

0 comments on commit 002da6c

Please sign in to comment.