Skip to content

Round up batched withdrawal miner fee splits#608

Open
QiLOL wants to merge 1 commit into
MystenLabs:mainfrom
QiLOL:fix-fee-remainder
Open

Round up batched withdrawal miner fee splits#608
QiLOL wants to merge 1 commit into
MystenLabs:mainfrom
QiLOL:fix-fee-remainder

Conversation

@QiLOL

@QiLOL QiLOL commented May 27, 2026

Copy link
Copy Markdown

Summary

Fixes rounding up the per-request miner fee deduction for batched withdrawals.

Previously, new_withdrawal_txn used floor division when validating each withdrawal output:

miner_fee / request_count

For a 1001 sat miner fee split across 3 requests, this charged each user 333 sats, so users only covered 999 sats total. The remaining 2 sats were implicitly absorbed by the bridge-controlled value.

This PR changes the Move-side validation to round up the per-request fee whenever the miner fee is not evenly divisible by the request count. This matches the conservative off-chain construction behavior and ensures users cover the fee remainder instead of the bridge subsidizing it.

Changes

  • Round up per_user_miner_fee in withdrawal_queue::new_withdrawal_txn.
  • Update the batched-with-remainder withdrawal queue test to use the ceil fee split.

Note: This is a conservative fix: it prevents protocol value from covering fee remainders, but it can overcharge users by up to request_count - 1 sats per batch. An alternative is to keep the base floor split and assign the remainder deterministically to one request, for example the last request pays floor(miner_fee / request_count) + remainder. That would make the total user-paid fee exactly match the miner fee. Feedback welcome on which policy is preferred.

@QiLOL
QiLOL requested a review from bmwill as a code owner May 27, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants