Skip to content

fix(starknet): enforce strict fee equality in StarkNetBitcoinDepositor#937

Open
Mavline wants to merge 1 commit intothreshold-network:mainfrom
Mavline:fix/starknet-strict-fee-check
Open

fix(starknet): enforce strict fee equality in StarkNetBitcoinDepositor#937
Mavline wants to merge 1 commit intothreshold-network:mainfrom
Mavline:fix/starknet-strict-fee-check

Conversation

@Mavline
Copy link
Copy Markdown

@Mavline Mavline commented Mar 20, 2026

Summary

Replace the weak fee check (>=) with strict equality (==) in StarkNetBitcoinDepositor._transferTbtc() to prevent callers from accidentally losing excess ETH sent above the required StarkGate bridge fee.

Problem

StarkNetBitcoinDepositor._transferTbtc() uses require(msg.value >= fee) (line 113), then forwards all msg.value to StarkGate via starkGateBridge.deposit{value: msg.value}(...). StarkGate does not refund excess ETH — any amount above the estimated fee is permanently lost.

All Wormhole-based depositors in the same codebase already use strict equality:

  • L1BTCDepositorWormhole.sol:193require(msg.value == cost)
  • BTCDepositorWormhole.sol:114require(msg.value == wormholeMessageFee)

The StarkNet depositor is the only implementation using >=, creating an inconsistent and unsafe pattern.

Fix

Single-line change: require(msg.value >= fee)require(msg.value == fee, "Incorrect L1->L2 message fee").

This ensures callers send exactly the required fee, consistent with all other depositor implementations. Callers that already send the exact fee are unaffected; callers that overpay will now get a clear revert instead of silent ETH loss.

Replace weak fee check (>=) with strict equality (==) to prevent
callers from accidentally losing excess ETH. StarkGate bridge does not
refund excess ETH, so any overpayment is permanently lost.

This aligns StarkNet depositor with all Wormhole-based depositors in the
same codebase which already use require(msg.value == cost).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant