Skip to content

Add block preparation abstractions for optimized verification#100

Merged
liuchengxu merged 1 commit intomainfrom
tx-execution-levels
Dec 26, 2025
Merged

Add block preparation abstractions for optimized verification#100
liuchengxu merged 1 commit intomainfrom
tx-execution-levels

Conversation

@liuchengxu
Copy link
Copy Markdown
Member

Summary

Add reusable abstractions for optimized block verification, extracted from the native-utxo-storage experimental branch. These abstractions are backend-agnostic and can work with both Substrate state (MPT) and native storage.

New Components

  • UtxoProvider trait: Abstraction for UTXO access from different backends (Substrate state, native storage, or pre-fetched HashMap). Supports both individual and batch fetching.

  • TxExecutionLevels: Analyzes in-block transaction dependencies and groups them into parallel execution levels using topological sort. Enables intra-block parallel verification.

  • PreparedBlock: Block with pre-fetched UTXOs ready for verification. Enables batch UTXO fetching and eliminates duplicate lookups between verify and apply stages.

  • VerifiedBlock: Block that passed verification, carries spent UTXOs for reuse during state application (no re-fetching).

Documentation

  • Added docs/VALUE_PROPOSITION.md documenting Subcoin strategic direction

Design Goals

  1. Eliminate duplicate UTXO lookups
  2. Enable batch fetching
  3. Support parallel verification
  4. Backend agnostic

Test plan

  • All 11 unit tests pass
  • Code compiles
  • Code formatted

Add reusable abstractions extracted from native-utxo-storage branch:

- UtxoProvider trait: Abstraction for UTXO access from different backends
  (Substrate state, native storage, or pre-fetched HashMap)

- TxExecutionLevels: Analyzes in-block transaction dependencies and groups
  them into parallel execution levels using topological sort

- PreparedBlock: Block with pre-fetched UTXOs ready for verification,
  enabling batch UTXO fetching and eliminating duplicate lookups

- VerifiedBlock: Block that passed verification, carries spent UTXOs
  for reuse during apply (no re-fetching)

Also add VALUE_PROPOSITION.md documenting Subcoin's strategic direction:
- Unique value: decentralized Bitcoin fast sync via Substrate state sync
- Comparison with Bitcoin Core, Floresta, ICP, and ZK bridges
- Future roadmap for MPT optimization and Polkadot integration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@liuchengxu liuchengxu merged commit 7b794f4 into main Dec 26, 2025
5 checks passed
@liuchengxu liuchengxu deleted the tx-execution-levels branch December 26, 2025 23:11
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.

1 participant