Skip to main content

compute_minimum_shielded_fee

Function compute_minimum_shielded_fee 

Source
pub fn compute_minimum_shielded_fee(
    num_actions: usize,
    platform_version: &PlatformVersion,
) -> Result<Credits, ProtocolError>
Expand description

Computes the minimum flat fee (in credits) for a pool-paid / asset-lock shielded transition.

Dispatches on the platform-versioned dpp.methods.compute_minimum_shielded_fee so the fee formula can evolve across protocol versions without breaking older ones.

This is the base flat shielded fee for the pool-paid / asset-lock transitions whose storage cannot be metered against an address balance. ShieldedTransfer and ShieldFromAssetLock charge exactly this base (ShieldFromAssetLock adds the asset-lock base cost on the asset-lock side); the other two pool-paid transitions add one flat per-transition storage component on top of this base โ€” Unshield via compute_shielded_unshield_fee (the AddBalanceToAddress output write) and ShieldedWithdrawal via compute_shielded_withdrawal_fee (the Core withdrawal document). For each transition, its SDK builder, its transformer (for the fee actually carved from the pool), and the consensus gate validate_minimum_shielded_fee all call the SAME one of these functions, so the carved fee and the validation threshold can never drift.

The transparent Shield is the exception: it meters its note/nullifier storage via GroveDB and adds only the COMPUTE portion via the sibling compute_shielded_verification_fee (which carries no storage term). Both functions dispatch on the SAME version key, so the flat fee and the compute fee always evolve together and cannot drift.

ยงParameters

  • num_actions โ€” number of Orchard actions in the bundle
  • platform_version โ€” protocol version (determines the formula version and fee constants)