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
Parent Issue
#3922
Summary
Implement Move framework changes for Bitcoin header-only import mode. This is a sub-issue of #3922.
Tasks
1. Modify
execute_l1_blockto skip transaction processingexecute_l1_blockinbitcoin.moveto directly callprocess_block_headerpending_block::add_pending_blockand transaction processingexecute_l1_block_headerfor future use by Relayer2. Add Merkle proof verification module
Create
merkle_proof.movewith:MerkleProofandProofNodedata structures intypes.moveverify_merkle_proof(tx_hash, merkle_root, proof)functionverify_tx_in_block(block_hash, tx, proof)functionsha256d_concathelper inbitcoin_hash.move3. Implement minimal
submit_tx_with_proof4. Unit tests
execute_l1_block_headerfunctionalitysubmit_tx_with_proofverificationFiles to modify
frameworks/bitcoin-move/sources/bitcoin.moveframeworks/bitcoin-move/sources/types.moveframeworks/bitcoin-move/sources/bitcoin_hash.move(if needed)frameworks/bitcoin-move/sources/merkle_proof.moveAcceptance Criteria
submit_tx_with_proofcan verify transaction inclusionParent Issue
#3922