Skip to content

Bug: Protocol Fees Charged on Unexecuted Limit Orders #124

@kml93

Description

@kml93

Summary

Post Only limit orders that are placed and canceled without any execution are incurring fees of 0.075%-0.137%. According to DeepBook V3 documentation, fees should only apply to executed trades.

Environment

  • Platform: deeptrade.io
  • Wallet: 0xa46617da774561178446eb08a91c422427a9b079c56304e6fbc8328a21862d89
  • Dates: October 30-31, 2025
  • DEEP Staking: None
  • Order Type: Post Only limit maker orders

Complete Transaction History

Transaction Hash Date (UTC) USDC Change Order ID Market Action
2kMfBFaZiCKYsQeLGcab1bUJWUtKsHgh3jHoiRRDDn7f Oct 31, 2025 20:19:00 +10,014.502500 922521671144661420389868722210 xBTC-USDC CANCEL
AxNBpirqGkAbgeYRPkqk2pmvKsAEw9XVsvocJsBZ2i4A Oct 31, 2025 20:18:27 -10,022.004000 - xBTC-USDC PLACE
9CD8Up2GEdp29dDCyBovkFa2t2fBy4QFVRqaDDVvfytK Oct 31, 2025 20:17:52 +9,993.695024 276885646993124443453501187 NS-USDC CANCEL
u2ypxcAsSvhX4ZbqYnHmaeSWhEHVJeRk4g5gRkisjnf Oct 31, 2025 20:17:12 +2,489.393798 224312407954754891724268725825 xBTC-USDC CANCEL
GyJG5F9wkvinrU91HNeDMCpUz22V4Vd9445gBDS27bCb Oct 31, 2025 14:02:10 -10,007.427740 - NS-USDC PLACE
4V6ryGtLbeHvyV13AMHC9dV9PAtYTME28nUU7EQ4N62J Oct 31, 2025 14:00:52 +10,007.800724 276885646993124443453506384 NS-USDC CANCEL
GdewvPDDHPMQAUrwhUA3JpM19of1y1d1QWcRZoZWFUTv Oct 31, 2025 14:00:15 -2,486.563265 - xBTC-USDC PLACE
HQJRFZ5rvbtppKYZpacHd4Qnq5sw5GptFmWRrUgFSsVS Oct 31, 2025 13:57:37 +2,496.230109 223943473073280700691948735502 xBTC-USDC CANCEL
3so5nheCyzztrFqWoRMq4K5Cq7nV91FHbP4rdpNfLmpM Oct 30, 2025 21:33:25 -2,489.689131 - WAL-USDC PLACE
5dJ5p8a5FG8DCDo9qCEvCwpLXNzjKYVHzsKuHmkzxJFY Oct 30, 2025 21:31:43 -2,498.105196 - xBTC-USDC PLACE
DqNzfAeyEtYr7Y3AbboyudBFzWpPVDDUdJq6if6cvyHF Oct 30, 2025 21:27:43 -10,019.999723 - NS-USDC PLACE

Confirmed Cases (5 orders with fee losses)

Case 1: xBTC-USDC (0.0748% loss)
  • PLACE: AxNBpirqGkAbgeYRPkqk2pmvKsAEw9XVsvocJsBZ2i4A → -10,022.004000 USDC
  • CANCEL: 2kMfBFaZiCKYsQeLGcab1bUJWUtKsHgh3jHoiRRDDn7f → +10,014.502500 USDC
  • Loss: 7.501500 USDC (0.0748%)
  • Order ID: 922521671144661420389868722210
Case 2: NS-USDC (0.1372% loss)
  • PLACE: GyJG5F9wkvinrU91HNeDMCpUz22V4Vd9445gBDS27bCb → -10,007.427740 USDC
  • CANCEL: 9CD8Up2GEdp29dDCyBovkFa2t2fBy4QFVRqaDDVvfytK → +9,993.695024 USDC
  • Loss: 13.732716 USDC (0.1372%)
  • Order ID: 276885646993124443453501187
Case 3: NS-USDC (0.1217% loss)
  • PLACE: DqNzfAeyEtYr7Y3AbboyudBFzWpPVDDUdJq6if6cvyHF → -10,019.999723 USDC
  • CANCEL: 4V6ryGtLbeHvyV13AMHC9dV9PAtYTME28nUU7EQ4N62J → +10,007.800724 USDC
  • Loss: 12.198999 USDC (0.1217%)
  • Order ID: 276885646993124443453506384
Case 4: xBTC-USDC (0.0751% loss)
  • PLACE: 5dJ5p8a5FG8DCDo9qCEvCwpLXNzjKYVHzsKuHmkzxJFY → -2,498.105196 USDC
  • CANCEL: HQJRFZ5rvbtppKYZpacHd4Qnq5sw5GptFmWRrUgFSsVS → +2,496.230109 USDC
  • Loss: 1.875087 USDC (0.0751%)
  • Order ID: 223943473073280700691948735502
Case 5: xBTC-USDC (+0.1138% gain - anomaly)
  • PLACE: GdewvPDDHPMQAUrwhUA3JpM19of1y1d1QWcRZoZWFUTv → -2,486.563265 USDC
  • CANCEL: u2ypxcAsSvhX4ZbqYnHmaeSWhEHVJeRk4g5gRkisjnf → +2,489.393798 USDC
  • Gain: +2.830533 USDC (+0.1138%)
  • Order ID: 224312407954754891724268725825
  • Note: This case resulted in a net gain. Reason unknown.

Case 6 (WAL-USDC): Order placed (3so5nheCyzztrFqWoRMq4K5Cq7nV91FHbP4rdpNfLmpM) but not yet canceled.

Summary Statistics

Total losses: 35.308302 USDC (excluding Case 5 anomaly)
Fee range: 0.0748% - 0.1372%
Trading pairs affected:

  • xBTC-USDC: ~0.075% average (Cases 1, 4)
  • NS-USDC: ~0.13% average (Cases 2, 3)

🔍 Additional Bug: Fee Variance May Correlate With Wallet Balance

The fee variance (0.0748% to 0.1372%) may be related to whether the wallet contained additional USDC beyond the order amount at placement time.

Observation:

  • Same pair (NS-USDC) shows different fees: 0.1217% vs 0.1372%
  • Wallet USDC balance varied across transactions
  • Unable to confirm exact balance state per transaction

Implication: If confirmed, this suggests fees are incorrectly calculated based on total wallet balance rather than order size alone. This would be a second distinct bug beyond charging fees on unexecuted orders.

Expected vs Actual Behavior

Expected (per DeepBook V3 docs)

"Fees are charged ONLY upon execution, not upon placement"

For Post Only orders:

  • Placement: No trading fees (only gas ~$0.002-0.003)
  • Cancellation: No trading fees (only gas)
  • No execution = No protocol fees

Actual (observed)

Orders that were:

  • ✅ Never matched (Post Only cannot take)
  • ✅ Never executed (0% fill confirmed)
  • ✅ Canceled by user

Are charged 0.075%-0.137% fees, which is:

  • 25x-45x higher than gas costs
  • 3x-5.5x higher than documented max taker fee (0.025%)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions