Skip to content

BQIP-0002: Rollback weight formula from BQIP-0007 to BQIP-0002 #169

@AlphaB135

Description

@AlphaB135

Problem

BQIP-0007 weight formula (base_bytes × 4 + witness_bytes × 1) was copied from Bitcoin SegWit but hurts PQC performance because Dilithium5 signatures are ~80x larger than ECDSA.

Numbers

Formula Weight/tx (1-in 1-out D5) tx/block (4M WU) TPS
BQIP-0002 (old) ~3,894 WU ~1,027 ~1.45
BQIP-0007 (current) ~7,240 WU ~552 ~0.78

BQIP-0007 gives 46% fewer transactions per block than BQIP-0002.

Root Cause

Bitcoin SegWit: signature ~100 bytes, base ~200 bytes → 4:1 discount helps
BitQuan PQC: signature ~8,000 bytes, base ~110 bytes → 4:1 discount penalizes base while witness still dominates

Solution

Rollback calculate_tx_weight() to BQIP-0002 formula:

weight = base_bytes + sig_count × 384 + witness_bytes × 0.5
  • base_bytes × 1 — base data at 1 WU/byte
  • sig_count × 384 — fixed cost per signature (algorithm-agnostic)
  • witness_bytes × 0.5 — 50% discount on witness data

Scope

  • crates/consensus/src/lib.rscalculate_tx_weight()
  • crates/mempool/src/lib.rscalculate_tx_weight()
  • Remove deprecated calculate_block_weight_with_beta() (now redundant)
  • Update all test assertions
  • BQIP-0007 SegWit infrastructure stays (struct separation, txid/wtxid, witness root)

Files NOT Changed

  • transaction.rs — struct already correct
  • block.rscompute_witness_root() already exists
  • wire.rs — serialization already correct
  • aggregation.rs — BQIP-0008 already correct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions