Repository navigation
feat(fees): tip within a proven fee - #1125
Conversation
26eb45f to
74268b5
Compare
Suggested reviewersThese code owners were requested because this pull request touches areas they know best (see
agureevIntegration tests ( LEE privacy-preserving circuit ( LEE state machine (
Indexer ( Built-in programs ( jonesmarvin8LEE privacy-preserving circuit ( LEE state machine (
moudyellazLEE privacy-preserving circuit ( LEE state machine (
Indexer ( Wallet ( schouhyLEE privacy-preserving circuit ( LEE state machine (
Chain state and storage ( Local deployment and devnet configs ( Indexer ( Wallet ( Test fixtures (
arjentixLocal deployment and devnet configs ( Indexer ( Wallet ( Test fixtures (
PravdyvyFFI bindings ( 6 filesIndexer ( Wallet ( Test fixtures (
Files without another code owner (2) |
f585a63 to
f35cc3f
Compare
jonesmarvin8
left a comment
There was a problem hiding this comment.
lgtm, left a minor nit.
…private settlement & bump `SHIELD_BYTES`, build artifacts
0826aa6 to
660186e
Compare
🎯 Purpose
A privacy-preserving transaction that pays its fee inside the proof (the proof credits a reserve to the fee inbox) has no explicit tip today.
FeeTxView::tip()returns 0 for these transactions. The only tip they pay is implicit: any surplus that is dust, or that can't be refunded, is kept as tip at settlement. The sequencer can't know that surplus before execution, so it can't rank these transactions by tip.This PR adds an explicit tip to the in-proof fee. The proof commits to it, so it can't be changed after proving. Once this lands, the tip-per-gas mempool ordering from #880 ranks in-proof private transactions too, without further changes. This PR doesn't depend on #880; either can merge first.
⚙️ Approach
FeeTransfer(prover input) andProvenFee(committed output) each gaintip: Fee. The circuit copies the tip into the output. The fee transfer itself is unchanged.FeeTxView::Privategainstip, andtip()returns it. Classify reads it fromproven_fee, or 0 when the proof commits no fee.validate_static_txnow requiresreserve ≥ flat fee + tipfor private transactions. Sequencer admission (screen) already calls it, so the head-state check (PrivateFeeBelowHead) covers the tip.settle_private_transaction):reserve − tip;actual + tip, otherwisePrivateFeeBelowRequired;revenue_tipand to the receipt;actual + tipfollows the existing rules: it is refunded if it is aboveMIN_PRIVATE_REFUNDand refundable, and otherwise added to the tip.The fee fallback goes through the same settlement path, so it pays the tip too.
FfiProvenFee(core_ffi, ffi_types, indexer_ffi) and the wallet'sFfiPrivateFeeeach gaintip. Both headers are updated.ProvenFeecarries the tip in both conversion directions.--tip/FeeParams.tipnow applies to in-proof fees as well: reserve pricing adds it, the proof commits it, and the dry-run report shows it.🧪 How to Test
New and updated tests:
a_private_transaction_pays_its_proven_tip_before_the_refund(chain_state): the tip is paid to the producer, the surplus beyond fee + tip is refunded, and a reserve one short of fee + tip is rejected.private_view_needs_its_verification_storage_and_tip_in_reserve(fee_core): the static check accounts for the tip.From the wallet,
--tip Non a private send now showstip Nin the dry-run report's reserve line.🔗 Dependencies
None, although this PR is independent of yet related to #880.
🔜 Future Work
PrivateFeeBelowHeadkeeps the user's tip fixed and only follows base fees. Raising the tip automatically was left out on purpose.📋 PR Completion Checklist