Skip to content

Conversation

@qj0r9j0vc2
Copy link
Member

@qj0r9j0vc2 qj0r9j0vc2 commented Dec 30, 2025

Summary

Integrates EVM-based execution layer into CipherBFT consensus using Revm 33 and Alloy 1.x.

Key Components

Core Infrastructure

  • ExecutionEngine: Transaction execution and state management
  • StateManager: Merkle Patricia Trie computation with 100-block checkpoints
  • EvmConfig: Revm 33 Context API integration with transact_one() for journal state preservation

Validator Management

  • Staking Precompile (0x100): On-chain validator registration, deregistration, and slashing
    • Minimum stake: 1 ETH
    • System-only slashing to prevent attacks

Consensus Integration

  • ExecutionBridge: Bridges consensus cuts to execution layer
  • Transaction Validator: Mempool CheckTx support
  • Cut Execution: Processes all transactions in consensus-ordered cuts

Implementation Details

  • State Root Interval: Fixed at 100 blocks (consensus-critical constant)
  • Journal Preservation: Uses transact_one() to maintain nonce/balance across transactions
  • Security: Gas limits, nonce validation, signature verification, atomic commits

Testing

  • Engine integration tests
  • Staking precompile tests
  • State root determinism verification
  • CI: clippy, rustfmt, license checks, cargo-llvm-cov

Documentation

  • crates/execution/DESIGN.md: Architecture and component details
  • crates/execution/DESIGN_ko.md: Korean version

Related

  • ADR-002: EVM Native Execution
  • ADR-009: Staking Precompile
  • ADR-012: State Root Handling

feat: add EVM configuration and receipts modules
…nto feat/el-database

# Conflicts:
#	crates/execution/Cargo.toml
#	crates/execution/src/lib.rs
#	crates/execution/src/types.rs
feat: add database and state management modules
@qj0r9j0vc2 qj0r9j0vc2 self-assigned this Dec 30, 2025
Add CipherBftPrecompileProvider implementing the PrecompileProvider trait
for stateful precompiles with context access. Handles both standard
Ethereum precompiles and custom staking precompile at address 0x100.
- Update SpecId import path to revm::primitives::hardfork::SpecId
- Add DBErrorMarker trait implementation for DatabaseError
- Fix PrecompileError import (was PrecompileErrors)
- Update module exports to use PrecompileProvider pattern
- Replace StakingPrecompileAdapter with create_staking_precompile export
Add migration notes documenting that revm 33 removed Env/BlockEnv/CfgEnv
types. Most methods in CipherBftEvmConfig are broken and need comprehensive
refactor to use Context-based API. Estimated ~600 LOC changes required.
@qj0r9j0vc2 qj0r9j0vc2 marked this pull request as ready for review December 30, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants