Skip to content

Commit

Permalink
fix: fix the fmt errors
Browse files Browse the repository at this point in the history
  • Loading branch information
yutianwu committed Oct 14, 2024
1 parent ab8db91 commit 42f5f29
Show file tree
Hide file tree
Showing 55 changed files with 225 additions and 159 deletions.
3 changes: 2 additions & 1 deletion crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,8 @@ mod tests {
ommers: Vec::new(),
withdrawals: Some(Withdrawals::default()),
sidecars: None,
requests: None,},
requests: None,
},
},
body.iter().map(|tx| tx.signer()).collect(),
)
Expand Down
4 changes: 3 additions & 1 deletion crates/blockchain-tree/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
use reth_evm::execute::{BlockExecutorProvider, Executor};
use reth_execution_errors::BlockExecutionError;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{revm_primitives::EvmState, GotExpected, Header, SealedBlockWithSenders, SealedHeader};
use reth_primitives::{
revm_primitives::EvmState, GotExpected, Header, SealedBlockWithSenders, SealedHeader,
};
use reth_provider::{
providers::{BundleStateProvider, ConsistentDbView, ProviderNodeTypes},
FullExecutionDataProvider, ProviderError, StateRootProvider, TryIntoHistoricalStateProvider,
Expand Down
2 changes: 1 addition & 1 deletion crates/bsc/chainspec/src/bsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::sync::Arc;
use alloy_chains::{Chain, NamedChain};
use alloy_primitives::{b256, U256};
use once_cell::sync::Lazy;
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
use reth_bsc_forks::BscHardfork;
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};

use crate::BscChainSpec;

Expand Down
2 changes: 1 addition & 1 deletion crates/bsc/chainspec/src/bsc_chapel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::sync::Arc;
use alloy_chains::{Chain, NamedChain};
use alloy_primitives::{b256, U256};
use once_cell::sync::Lazy;
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
use reth_bsc_forks::BscHardfork;
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};

use crate::BscChainSpec;

Expand Down
2 changes: 1 addition & 1 deletion crates/bsc/chainspec/src/bsc_rialto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::sync::Arc;
use alloy_chains::Chain;
use alloy_primitives::{b256, U256};
use once_cell::sync::Lazy;
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
use reth_bsc_forks::BscHardfork;
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};

use crate::BscChainSpec;

Expand Down
2 changes: 1 addition & 1 deletion crates/bsc/chainspec/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::sync::Arc;
use alloy_chains::Chain;
use alloy_primitives::U256;
use once_cell::sync::Lazy;
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
use reth_bsc_forks::DEV_HARDFORKS;
use reth_chainspec::{once_cell_set, BaseFeeParams, BaseFeeParamsKind, ChainSpec};
use reth_primitives_traits::constants::DEV_GENESIS_HASH;

use crate::BscChainSpec;
Expand Down
4 changes: 1 addition & 3 deletions crates/bsc/consensus/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use alloy_dyn_abi::{DynSolValue, FunctionExt, JsonAbiExt};
use alloy_primitives::{Address, BlockNumber, Bytes, U256};
use lazy_static::lazy_static;
use reth_bsc_forks::BscHardforks;
use reth_primitives::{
system_contracts::{STAKE_HUB_CONTRACT, VALIDATOR_CONTRACT},
};
use reth_primitives::system_contracts::{STAKE_HUB_CONTRACT, VALIDATOR_CONTRACT};

lazy_static! {
pub static ref VALIDATOR_SET_ABI: &'static str = r#"
Expand Down
2 changes: 1 addition & 1 deletion crates/bsc/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use alloy_rlp::Decodable;
use lazy_static::lazy_static;
use lru::LruCache;
use parking_lot::RwLock;
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_bsc_forks::BscHardforks;
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
use reth_primitives::{
constants::EMPTY_MIX_HASH,
Expand Down
2 changes: 1 addition & 1 deletion crates/bsc/consensus/src/system_tx.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::Parlia;
use alloy_consensus::TxLegacy;
use alloy_primitives::{Address, Bytes, TxKind, U256};
use alloy_dyn_abi::{DynSolValue, JsonAbiExt};
use alloy_primitives::{Address, Bytes, TxKind, U256};
use reth_primitives::{
system_contracts::{
CROSS_CHAIN_CONTRACT, GOVERNOR_CONTRACT, GOV_TOKEN_CONTRACT, LIGHT_CLIENT_CONTRACT,
Expand Down
5 changes: 4 additions & 1 deletion crates/bsc/consensus/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::EXTRA_SEAL_LEN;
use alloy_primitives::{keccak256, bytes::{BufMut, BytesMut}, B256, B64, U256};
use alloy_primitives::{
bytes::{BufMut, BytesMut},
keccak256, B256, B64, U256,
};
use alloy_rlp::Encodable;
use reth_primitives::Header;
use std::env;
Expand Down
8 changes: 3 additions & 5 deletions crates/bsc/engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ use reth_engine_primitives::EngineTypes;
use reth_evm_bsc::SnapshotReader;
use reth_network_api::events::EngineMessage;
use reth_network_p2p::BlockClient;
use reth_primitives::{
parlia::ParliaConfig, BlockBody, BlockHashOrNumber, SealedHeader,
};
use reth_primitives::{parlia::ParliaConfig, BlockBody, BlockHashOrNumber, SealedHeader};
use reth_provider::{BlockReaderIdExt, CanonChainTracker, ParliaProvider};
use std::{
clone::Clone,
Expand Down Expand Up @@ -283,8 +281,8 @@ where

#[cfg(test)]
mod tests {
use alloy_primitives::Sealable;
use super::*;
use alloy_primitives::Sealable;
use reth_primitives::SealedHeader;

#[test]
Expand Down Expand Up @@ -356,7 +354,7 @@ mod tests {

#[test]
fn test_clean_cache() {
let default_block =SealedHeader::default();
let default_block = SealedHeader::default();
let mut storage = StorageInner {
best_hash: default_block.hash_slow(),
best_block: default_block.number,
Expand Down
2 changes: 1 addition & 1 deletion crates/bsc/evm/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use reth_chainspec::ChainSpec;
use reth_bsc_forks::BscHardfork;
use reth_chainspec::ChainSpec;
use reth_ethereum_forks::{EthereumHardfork, Head};

/// Returns the spec id at the given timestamp.
Expand Down
4 changes: 2 additions & 2 deletions crates/bsc/evm/src/execute.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//! Bsc block executor.

use crate::{post_execution::PostExecutionInput, BscBlockExecutionError, BscEvmConfig};
use alloy_primitives::{Address, BlockNumber, B256, Bytes, U256};
use alloy_primitives::{Address, BlockNumber, Bytes, B256, U256};
use core::fmt::Display;
use lazy_static::lazy_static;
use lru::LruCache;
use parking_lot::RwLock;
use reth_bsc_consensus::{
is_breathe_block, validate_block_post_execution, Parlia, ValidatorElectionInfo, ValidatorsInfo,
};
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_bsc_forks::BscHardforks;
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_errors::{BlockExecutionError, BlockValidationError, ProviderError};
use reth_evm::{
execute::{
Expand Down
4 changes: 1 addition & 3 deletions crates/bsc/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ mod tests {
use super::*;
use alloy_genesis::Genesis;
use reth_chainspec::Chain;
use reth_primitives::{
revm_primitives::{BlockEnv, CfgEnv},
};
use reth_primitives::revm_primitives::{BlockEnv, CfgEnv};
use revm_primitives::SpecId;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/bsc/evm/src/post_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use reth_bsc_consensus::{
COLLECT_ADDITIONAL_VOTES_REWARD_RATIO, DEFAULT_TURN_LENGTH, DIFF_INTURN, MAX_SYSTEM_REWARD,
SYSTEM_REWARD_PERCENT,
};
use reth_errors::{BlockExecutionError, BlockValidationError, ProviderError};
use reth_bsc_forks::BscHardforks;
use reth_errors::{BlockExecutionError, BlockValidationError, ProviderError};
use reth_evm::ConfigureEvm;
use reth_primitives::{
parlia::{Snapshot, VoteAddress, VoteAttestation},
Expand Down
6 changes: 2 additions & 4 deletions crates/bsc/evm/src/pre_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use blst::{
BLST_ERROR,
};
use reth_bsc_consensus::{DIFF_INTURN, DIFF_NOTURN};
use reth_bsc_forks::BscHardforks;
use reth_errors::{BlockExecutionError, ProviderError};
use reth_ethereum_forks::EthereumHardforks;
use reth_bsc_forks::BscHardforks;
use reth_evm::ConfigureEvm;
use reth_primitives::{
parlia::{Snapshot, VoteAddress, MAX_ATTESTATION_EXTRA_LENGTH},
Expand Down Expand Up @@ -230,9 +230,7 @@ mod tests {
use alloy_primitives::{b256, hex};

use blst::min_pk::{PublicKey, Signature};
use reth_primitives::{
parlia::{VoteAddress, VoteData, VoteSignature},
};
use reth_primitives::parlia::{VoteAddress, VoteData, VoteSignature};

#[test]
fn verify_vote_attestation() {
Expand Down
11 changes: 6 additions & 5 deletions crates/bsc/node/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
//! BSC Node types config.

use std::sync::Arc;
use crate::EthEngineTypes;
use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig};
use reth_bsc_consensus::Parlia;
use reth_chainspec::ChainSpec;
use reth_ethereum_engine_primitives::{EthBuiltPayload, EthPayloadAttributes, EthPayloadBuilderAttributes, EthereumEngineValidator};
use reth_ethereum_engine_primitives::{
EthBuiltPayload, EthPayloadAttributes, EthPayloadBuilderAttributes, EthereumEngineValidator,
};
use reth_evm_bsc::{BscEvmConfig, BscExecutorProvider};
use reth_network::NetworkHandle;
use reth_node_api::{ConfigureEvm, EngineValidator, FullNodeComponents, NodeAddOns};
use reth_node_builder::{
components::{
ComponentsBuilder, ConsensusBuilder, ExecutorBuilder, NetworkBuilder,
PayloadServiceBuilder, PoolBuilder,
ComponentsBuilder, ConsensusBuilder, EngineValidatorBuilder, ExecutorBuilder,
NetworkBuilder, PayloadServiceBuilder, PoolBuilder,
},
node::{FullNodeTypes, NodeTypes, NodeTypesWithEngine},
BuilderContext, Node, PayloadBuilderConfig, PayloadTypes,
};
use reth_node_builder::components::EngineValidatorBuilder;
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
use reth_primitives::Header;
use reth_provider::CanonStateSubscriptions;
Expand All @@ -27,6 +27,7 @@ use reth_transaction_pool::{
blobstore::DiskFileBlobStore, EthTransactionPool, TransactionPool,
TransactionValidationTaskExecutor,
};
use std::sync::Arc;

/// Type configuration for a regular BSC node.
#[derive(Debug, Default, Clone, Copy)]
Expand Down
3 changes: 2 additions & 1 deletion crates/chain-state/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ impl TestBlockBuilder {
ommers: Vec::new(),
withdrawals: Some(vec![].into()),
sidecars: None,
requests: None,},
requests: None,
},
};

SealedBlockWithSenders::new(block, vec![self.signer; num_txs as usize]).unwrap()
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/commands/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use reth_ethereum_cli::chainspec::EthereumChainSpecParser;
use reth_node_builder::{NodeBuilder, WithLaunchContext};
use reth_node_core::{
args::{
DatabaseArgs, DatadirArgs, DebugArgs, DevArgs, NetworkArgs,
PayloadBuilderArgs, PerformanceOptimizationArgs, PruningArgs, RpcServerArgs, TxPoolArgs,
DatabaseArgs, DatadirArgs, DebugArgs, DevArgs, NetworkArgs, PayloadBuilderArgs,
PerformanceOptimizationArgs, PruningArgs, RpcServerArgs, TxPoolArgs,
},
node_config::NodeConfig,
version,
Expand Down
9 changes: 7 additions & 2 deletions crates/consensus/auto-seal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,13 @@ impl StorageInner {
// root here

let Block { mut header, body, .. } = block.block;
let body = BlockBody { transactions: body.transactions, ommers, withdrawals, sidecars: None, requests };

let body = BlockBody {
transactions: body.transactions,
ommers,
withdrawals,
sidecars: None,
requests,
};
trace!(target: "consensus::auto", ?execution_outcome, ?header, ?body, "executed block, calculating state root and completing header");

// now we need to update certain header fields with the results of the execution
Expand Down
12 changes: 7 additions & 5 deletions crates/consensus/common/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,13 @@ mod tests {
(
SealedBlock {
header: SealedHeader::new(header, seal),
body: BlockBody { transactions,
ommers,
withdrawals: None,
sidecars: None,
requests: None},
body: BlockBody {
transactions,
ommers,
withdrawals: None,
sidecars: None,
requests: None,
},
},
parent,
)
Expand Down
9 changes: 7 additions & 2 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,10 @@ where
.collect::<HashMap<_, _>>();

let exec_time = Instant::now();
let output = self.metrics.executor.execute_metered(executor, (&block, U256::MAX, Some(&ancestor_blocks)).into())?;
let output = self
.metrics
.executor
.execute_metered(executor, (&block, U256::MAX, Some(&ancestor_blocks)).into())?;

trace!(target: "engine::tree", elapsed=?exec_time.elapsed(), ?block_number, "Executed block");
if let Err(err) = self.consensus.validate_block_post_execution(
Expand Down Expand Up @@ -2259,7 +2262,9 @@ where
}
trie_output = _trie_output;
let root_elapsed = root_time.elapsed();
self.metrics.block_validation.record_state_root(&trie_output, root_elapsed.as_secs_f64());
self.metrics
.block_validation
.record_state_root(&trie_output, root_elapsed.as_secs_f64());
debug!(target: "engine::tree", ?root_elapsed, ?block_number, "Calculated state root");
}

Expand Down
19 changes: 14 additions & 5 deletions crates/ethereum/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,12 @@ where
let env = self.evm_env_for_block(&block.header, total_difficulty);
let output = {
let evm = self.executor.evm_config.evm_with_env(&mut self.state, env);
self.executor.execute_state_transitions(block, evm, state_hook, self.prefetch_tx.clone())
self.executor.execute_state_transitions(
block,
evm,
state_hook,
self.prefetch_tx.clone(),
)
}?;

// 3. apply post execution changes
Expand Down Expand Up @@ -646,7 +651,8 @@ mod tests {
ommers: vec![],
withdrawals: None,
sidecars: None,
requests: None,},
requests: None,
},
},
senders: vec![],
},
Expand Down Expand Up @@ -680,7 +686,8 @@ mod tests {
ommers: vec![],
withdrawals: None,
sidecars: None,
requests: None,},
requests: None,
},
},
senders: vec![],
},
Expand Down Expand Up @@ -748,7 +755,8 @@ mod tests {
ommers: vec![],
withdrawals: None,
sidecars: None,
requests: None,},
requests: None,
},
},
senders: vec![],
},
Expand Down Expand Up @@ -804,7 +812,8 @@ mod tests {
ommers: vec![],
withdrawals: None,
sidecars: None,
requests: None,},
requests: None,
},
},
senders: vec![],
},
Expand Down
11 changes: 8 additions & 3 deletions crates/ethereum/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,15 @@ where
};

// seal the block
let block =
Block {
let block = Block {
header,
body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals, sidecars: None, requests },
body: BlockBody {
transactions: executed_txs,
ommers: vec![],
withdrawals,
sidecars: None,
requests,
},
};

let sealed_block = block.seal_slow();
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/execution-types/src/execution_outcome.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::BlockExecutionOutput;
use alloy_primitives::{Address, BlockNumber, Bloom, Log, B256, U256};
use reth_primitives::{
logs_bloom, Account, Bytecode, parlia::Snapshot, Receipt, Receipts, Requests, StorageEntry,
logs_bloom, parlia::Snapshot, Account, Bytecode, Receipt, Receipts, Requests, StorageEntry,
};
use reth_trie::HashedPostState;
use revm::{
Expand Down
Loading

0 comments on commit 42f5f29

Please sign in to comment.