Skip to main content

SHIELDED_WITHDRAWAL_DOCUMENT_STORAGE_BYTES

Constant SHIELDED_WITHDRAWAL_DOCUMENT_STORAGE_BYTES 

Source
pub const SHIELDED_WITHDRAWAL_DOCUMENT_STORAGE_BYTES: u64 = 4100;
Expand description

Calibrated effective storage-byte cost of the Core withdrawal document a ShieldedWithdrawal creates.

A ShieldedWithdrawal does not only write notes/nullifiers like the other pool-paid transitions — it ALSO inserts a Core withdrawal document into the withdrawals contract (AddWithdrawalDocument), which writes the document plus its withdrawals-contract index entries. That insert has a real, GroveDB-metered cost of ≈110,085,900 credits, which is ~98% storage and is FLAT regardless of the bundle’s action count (the document and its indexes are the same size whether the withdrawal spends one note or sixteen).

compute_minimum_shielded_fee prices only the per-action note/nullifier storage and the per-bundle ZK compute, so it does NOT cover this document insert. We therefore add the document cost to the ShieldedWithdrawal fee as a flat BYTE-BASED component, sized at SHIELDED_WITHDRAWAL_DOCUMENT_STORAGE_BYTES effective bytes priced at the SAME per-byte storage rate the per-action note storage uses (disk + processing credits/byte). The measured ≈110M cost corresponds to ≈4017 effective bytes at that rate; 4100 covers it with a small (~2%) margin, and — because it is priced off the same rate — it tracks the storage rate as it evolves, exactly like the per-action note storage does. See compute_minimum_shielded_fee::compute_shielded_withdrawal_fee.