Skip to content

Commit

Permalink
update type params
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed May 6, 2024
1 parent 37f8cb7 commit bc8361c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions crates/consensus/parlia/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ pub struct Parlia<P: HeaderProvider + ParliaSnapshotReader + ParliaSnapshotWrite
provider: Option<P>,
}

impl<P> Default for Parlia<P> {
impl Default for Parlia<_> {
fn default() -> Self {
Self::new(Arc::new(ChainSpec::default()), 200, 3)
}
}

impl<P: HeaderProvider + ParliaSnapshotReader + ParliaSnapshotWriter> Parlia<P> {
impl Parlia<_> {
pub fn new(chain_spec: Arc<ChainSpec>, epoch: u64, period: u64) -> Self {
let validator_abi = load_abi_from_file("./abi/validator_set.json").unwrap();
let validator_abi_before_luban =
Expand Down Expand Up @@ -392,7 +392,7 @@ impl<P: HeaderProvider + ParliaSnapshotReader + ParliaSnapshotWriter> Parlia<P>
}
}

impl<P> Parlia<P> {
impl Parlia<_> {
pub fn init_genesis_contracts(&self, nonce: u64) -> Vec<Transaction> {
let function = self.validator_abi.function("init").unwrap().first().unwrap();
let input = function.abi_encode_input(&[]).unwrap();
Expand Down Expand Up @@ -559,7 +559,7 @@ impl<P> Parlia<P> {
}
}

impl<P> Parlia<P> {
impl Parlia<_> {
pub fn get_current_validators_before_luban(
&self,
block_number: BlockNumber,
Expand Down Expand Up @@ -671,7 +671,7 @@ impl<P> Parlia<P> {
}
}

impl<P> Parlia<P> {
impl Parlia<_> {
pub fn chain_spec(&self) -> &ChainSpec {
&self.chain_spec
}
Expand Down Expand Up @@ -1006,7 +1006,7 @@ impl<P: HeaderProvider + ParliaSnapshotReader + ParliaSnapshotWriter> Parlia<P>
}
}

impl<P> Debug for Parlia<P> {
impl Debug for Parlia<_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Parlia")
.field("chain_spec", &self.chain_spec)
Expand All @@ -1016,7 +1016,7 @@ impl<P> Debug for Parlia<P> {
}
}

impl<P> Consensus for Parlia<P> {
impl Consensus for Parlia<_> {
fn validate_header(&self, header: &SealedHeader) -> Result<(), ConsensusError> {
// Don't waste time checking blocks from the future
let present_timestamp =
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<EvmConfig, P> EvmProcessorFactory<EvmConfig, P> {
stack: None,
evm_config,
#[cfg(feature = "bsc")]
parlia_consensus: Arc::new(Parlia::<P>::default()),
parlia_consensus: Arc::new(Parlia::default()),
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ where
stats: BlockExecutorStats::default(),
_evm_config: evm_config,
#[cfg(feature = "bsc")]
parlia_consensus: Arc::new(Parlia::<P>::default()),
parlia_consensus: Arc::new(Parlia::default()),
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/stages/src/stages/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ mod tests {
use reth_revm::EvmProcessorFactory;
use std::collections::BTreeMap;

fn stage() -> ExecutionStage<EvmProcessorFactory<EthEvmConfig>> {
fn stage<P>() -> ExecutionStage<EvmProcessorFactory<EthEvmConfig, P>> {
let executor_factory = EvmProcessorFactory::new(
Arc::new(ChainSpecBuilder::mainnet().berlin_activated().build()),
EthEvmConfig::default(),
Expand Down Expand Up @@ -866,7 +866,7 @@ mod tests {
mode.receipts_log_filter = random_filter.clone();
}

let mut execution_stage: ExecutionStage<EvmProcessorFactory<EthEvmConfig>> = stage();
let mut execution_stage: ExecutionStage<EvmProcessorFactory<EthEvmConfig, _>> = stage();
execution_stage.prune_modes = mode.clone().unwrap_or_default();

let output = execution_stage.execute(&provider, input).unwrap();
Expand Down

0 comments on commit bc8361c

Please sign in to comment.