Round up batched withdrawal miner fee splits#608
Open
QiLOL wants to merge 1 commit into
Open
Conversation
bmwill
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes rounding up the per-request miner fee deduction for batched withdrawals.
Previously,
new_withdrawal_txnused floor division when validating each withdrawal output: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
per_user_miner_feeinwithdrawal_queue::new_withdrawal_txn.Note: This is a conservative fix: it prevents protocol value from covering fee remainders, but it can overcharge users by up to
request_count - 1sats per batch. An alternative is to keep the base floor split and assign the remainder deterministically to one request, for example the last request paysfloor(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.