Pharos Docs
  • Introduction
    • About Pharos Network
    • Vision & Mision
    • Why Pharos Network
    • Concepts
      • Degree of Parallelism (DP)
  • Architecture
    • Pharos Modular Stack
    • Node Architecture
      • About Pharos Nodes
  • Core Technologies
    • Pharos Consensus
    • Pharos Execution
      • Why A New Blockchain Compute Model
      • Pharos VM
    • Pharos Pipelining
    • Pharos Store
      • Why We Need a Blockchain-Native Store
    • Pharos SPNs
  • Network Overview
    • Pharos Networks
      • Pharos Testnet Information
    • Pharos Gas Model
    • FAQ
  • Node & Validator Guide
    • Validator Requirements
    • Validator Node Deployment
      • Using Docker (Devnet)
      • Using Docker (Testnet)
    • Node Management
    • Rapid Node Initialization
      • Rapid Node Initialization(Testnet)
      • Rapid Node Initialization(Devnet)
    • Pharos Network Snapshots
    • Node Debugging & Configuration
  • 🛠️ Pharos Testnet: Rebuild Node with Preserved Node Info
  • Pharos Node Monitoring
  • Developer Guide
    • Foundry
      • Write Your First dApp
      • Write Your First Token
      • Write Your First NFT
      • Write Your First Uniswap Contract
    • Hardhat
      • Write Your First dApp
      • Write Your First Token
      • Write Your First NFT
      • Write Your First Uniswap Contract
    • Rust
    • Interoperability
      • Call EVM From WASM
  • API & SDK
    • JSON-RPC API Methods
  • Resources
    • EVM
    • Solidity
Powered by GitBook
On this page
  • Architecture
  • Pipeline Finality
  • Execution Framework Overview
Export as PDF
  1. Core Technologies

Pharos Execution

Parallel Execution Framework

PreviousPharos ConsensusNextWhy A New Blockchain Compute Model

Last updated 25 days ago

Pharos Execution is the engine powering the Pharos network, designed for exceptional performance, scalability, and efficiency. The architecture comprises two key components: the scheduler and the executor. The scheduler is a core component for parallel scheduling and executing transactions, utilizing optimized algorithms for maximum parallelism and minimal conflicts. The executor features dual virtual machine (EVM and WASM) engines for fast and flexible smart contract execution. The EVM engine ensures compatibility with solidity contracts, while the WASM engine provides high-performance execution for a wider set of smart contract languages.

Architecture

Pharos adopts a parallel approach to transaction execution, focusing on:

  • Optimal Grouping: Near-optimal parallel transaction groups with high concurrency.

  • Extreme Performance: Fast transaction execution with integrity and correctness. Efficient transaction validation, deterministic finality, and conflict handling.

Pharos ensures parallel execution efficiency and deterministic finality through:

  • Parallel Hint Generation: Leveraging static analysis and speculative execution of smart contracts, Pharos generates accurate read-write set hints to minimize conflicts and enhance parallelism. This is achieved through a robust compilation framework and a fine-grained analysis algorithm, providing comprehensive control and data flow insights to reduce runtime overhead.

  • Transaction Dependency Analysis: Pharos analyzes transaction dependencies using read-write sets and generates parallelizable transaction groups with the union-find algorithm. These groups are aligned with the number of execution workers, and all state objects for each group are preloaded in a single batched I/O operation, significantly reducing execution time.

  • Optimistic Execution & Pipeline Finality: Pharos utilizes optimistic execution alongside a "Pipeline Finality" algorithm, allowing quick convergence of execution results and determining the final state efficiently.

Pharos is continuously improving its parallelism by:

  • Efficient Resource Management: Validators balance tasks such as speculative execution, fully utilizing multi-core CPUs and I/O resources while allowing executors to take on scheduling work, optimizing overall resource use.

  • Global Data Optimization: Parallel and storage optimization of global data with read-write set conflicts, such as global counters, further enhances performance.

  • Conflict Detection & Minimal Re-execution: Through fine-grained control, Pharos achieves faster conflict detection and minimal-cost re-execution, delivering optimal parallel performance.

Pipeline Finality

  • Ordering Finality: Ensures permanent transaction sequencing.

  • Transaction Finality: Provides deterministic execution results.

  • Block Finality: Allows immediate access to finalized blocks.

In the Pharos Parallel Execution Framework, Transaction Finality is prioritized to ensure a seamless Web3 user experience, while we aim to minimize the delay in Block Finality. This is crucial as infrastructure components like oracles and indexers rely on this information. To optimize block finality, Pharos employs the following techniques:

  • Setting a maximum finality time for each block (e.g., n blocks, where n = 10).

  • Faster BlockHeader Generation: Performance-optimized validators or RPC nodes may generate block headers faster, broadcasting them to other nodes that perform verification and application without full computation (via state sync).

Execution Framework Overview

The Pharos Parallel Execution Framework operates through the following seven steps:

  1. Consensus the latest block batch and synchronize parallel execution hints across the network.

  2. Split execution groups using dependency graphs based on the parallel hints.

  3. Sequentially process transactions within each group in the executor.

  4. Load merklized state data in parallel to optimize performance.

  5. Identify and resolve execution conflicts between concurrent groups.

  6. Redo some transactions in the groups and generate the finality status.

  7. Write the updated state using asynchronous I/O.

Our algorithm is designed to minimize Transaction Finality time, while Pharos Store assists by preloading merklized state data (e.g., MPT, JMT nodes), accelerating block header generation and block finality consensus.

In ,we divide the finality of transactions into the following three categories::

Full Life Cycle Async Pipelining