Skip to content

SCslope/pevm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PEVM

This project implements an Ethereum Virtual Machine (EVM) command executor, leveraging Rust's powerful concurrency features. The executor processes blocks from a blockchain, performing transactions in parallel using multiple threads to maximize efficiency.

Features

  • Executes EVM commands over a specified range of blocks.
  • Utilizes a multi-threaded approach to improve execution speed.
  • Supports dynamic task allocation and load balancing across threads.
  • Provides real-time execution progress monitoring.

Dependencies

The project relies on several external crates:

  • clap for command-line argument parsing.
  • eyre for error handling.
  • tracing for logging.
  • reth_* crates for blockchain-related functionalities.
  • num_cpus to determine the number of CPU cores.

Installation

  1. Ensure you have Rust installed. If not, install it from rustup.rs.
  2. Clone the repository:
    git clone <repository-url>
    cd <repository-directory>
  3. Build the project:
    cargo build --release

Usage

The main functionality is provided by the EvmCommand struct, which is configured and executed through the command line.

Command Line Arguments

  • --begin or -b: Begin block number (required).
  • --end or -e: End block number (required).
  • --step or -s: Step size for loop, default is 100.

Example

To execute the EVM command for blocks from 1000 to 2000 with a step size of 50, run:

cargo run --release -- -b 1000 -e 2000 -s 50

Code Overview

The core functionality is implemented in the EvmCommand struct. The execute method performs the following steps:

  • Initializes the environment and consensus.
  • Configures the blockchain tree and provider.
  • Validates the block range.
  • Creates a task queue and divides the block range into tasks.
  • Spawns multiple threads to process the tasks concurrently.
  • Monitors and logs the execution progress in real-time.
  • Joins the threads and handles any errors that occur during execution.

Task Execution

Each thread fetches tasks from a shared task queue, processes blocks within the specified range, and updates shared counters for gas usage, block count, and transaction count. The execution results are logged for monitoring.

Real-Time Monitoring

A separate thread periodically logs the current progress, including the number of processed blocks, transactions, and gas throughput.

Contributing

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -am 'Add your feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

  • Thanks to the authors of the reth crates for providing essential blockchain components.
  • Thanks to the Rust community for their invaluable support and resources.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%