Skip to content

fix: fair fee model (tx.fee + tip)#36

Open
paolino wants to merge 3 commits intomainfrom
fix/fair-fee-model
Open

fix: fair fee model (tx.fee + tip)#36
paolino wants to merge 3 commits intomainfrom
fix/fair-fee-model

Conversation

@paolino
Copy link
Copy Markdown
Collaborator

@paolino paolino commented Apr 8, 2026

Summary

  • Replace fixed max_fee with fair fee model: requesters pay share of actual tx fee + oracle tip
  • State.max_feeState.tip, Request.feeRequest.tip
  • Conservation equation: sum(refunds) == sum(inputs) - tx.fee - N * tip
  • Uses Plutus V3 Transaction.fee for actual tx cost

Changes

  • spec/CageDatum.lean: Updated formal spec with conservation equation
  • validators/types.ak: Field renames in State and Request
  • validators/cage.ak: mkUpdate, mkReject, validRootUpdate, validReject rewritten
  • validators/cage.tests.ak: All tests updated + 4 new tests (91 total, all passing)

Closes #35

State.max_fee → State.tip, Request.fee → Request.tip.
Conservation: sum(refunds) == sum(inputs) - tx.fee - N * tip.

Closes #35
@paolino paolino added the bug Something isn't working label Apr 8, 2026
@paolino paolino self-assigned this Apr 8, 2026
@paolino paolino added the bug Something isn't working label Apr 8, 2026
paolino added 2 commits April 8, 2026 15:40
Rename max_fee/fee → tip in codec and cage builder.
Add two-pass tx building to satisfy conservation equation.
Set fee overestimate in tx body via setMinFee() so scripts see
the correct fee during evaluation. Ledger accepts because
fee >= min_fee. Excess goes to treasury.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: fee model overcharges requesters

1 participant