Skip to content

[bitcoin-move] Header-only import and Merkle proof verification #3923

@jolestar

Description

@jolestar

Summary

Implement Move framework changes for Bitcoin header-only import mode. This is a sub-issue of #3922.

Tasks

1. Modify execute_l1_block to skip transaction processing

  • Modify execute_l1_block in bitcoin.move to directly call process_block_header
  • Skip pending_block::add_pending_block and transaction processing
  • Keep timestamp update logic
  • Add new entry function execute_l1_block_header for future use by Relayer

2. Add Merkle proof verification module

Create merkle_proof.move with:

  • MerkleProof and ProofNode data structures in types.move
  • verify_merkle_proof(tx_hash, merkle_root, proof) function
  • verify_tx_in_block(block_hash, tx, proof) function
  • May need to add sha256d_concat helper in bitcoin_hash.move

3. Implement minimal submit_tx_with_proof

public entry fun submit_tx_with_proof(
    block_hash: address, 
    tx_bytes: vector<u8>, 
    proof_bytes: vector<u8>
) {
    // 1. Parse transaction and proof
    // 2. Verify Merkle proof
    // 3. Emit verification success event
    // Note: UTXO creation will be added in future versions
}

4. Unit tests

  • Test Merkle proof verification with valid/invalid proofs
  • Test execute_l1_block_header functionality
  • Test submit_tx_with_proof verification

Files to modify

  • frameworks/bitcoin-move/sources/bitcoin.move
  • frameworks/bitcoin-move/sources/types.move
  • frameworks/bitcoin-move/sources/bitcoin_hash.move (if needed)
  • New: frameworks/bitcoin-move/sources/merkle_proof.move

Acceptance Criteria

  • New blocks no longer create UTXO objects
  • Timestamp updates still work correctly
  • Merkle proof verification passes unit tests
  • submit_tx_with_proof can verify transaction inclusion

Parent Issue

#3922

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions