Remove GAS_CAP to support smart contract wallet reward distribution#38
Open
daatsuka wants to merge 1 commit intolayer3xyz:mainfrom
Open
Remove GAS_CAP to support smart contract wallet reward distribution#38daatsuka wants to merge 1 commit intolayer3xyz:mainfrom
daatsuka wants to merge 1 commit intolayer3xyz:mainfrom
Conversation
…Contract Wallets
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.
The native ETH payout path in
Escrow.sol::withdrawNative(line 230) and the identical path inTaskEscrow.sol::_distributeNative(line 188) both forwarded a hardcodedGAS_CAPof 35,000 with the low-level.call{value: …, gas: GAS_CAP}(""). That cap is too tight for any smart-contract wallet whosereceive()touches storage — a single coldSSTOREcosts 20,000 gas, so a wallet doing even modest bookkeeping on receive blows the budget and the call reverts withEscrow__NativePayoutError. Because the contract treats that revert as fatal, legitimate claimants using multisigs or account-abstraction wallets are permanently locked out of their native rewards. Removing thegas:parameter lets the EVM forward all available gas (minus the 1/64 retention), which is the standard Solidity pattern for value transfers that must support arbitrary receivers.The change itself is intentionally narrow: delete the
GAS_CAPconstant declaration, and drop thegas: GAS_CAPargument from both.callsites — nothing else in the contract logic changes, and the existingif (!rewardSuccess) revertguard still protects against actual transfer failures. On the test side,test/unit/Escrow.t.solgains aGasHeavyReceiverhelper contract whosereceive()burns well over 35,000 gas via a storage-write loop, paired with three new test cases: a zero-rake withdrawal to the heavy receiver, a 5 % rake split verifying both receiver and treasury balances, and a 100 % rake edge case where the receiver gets zero but the transaction still completes without revert.The design deliberately avoids a pull-based (withdrawal-pattern) refactor or a configurable gas limit — both would widen the surface area and require migration work on Factory, while the root cause is simply that the cap is unnecessary given the existing revert guard. I ran
forge testlocally against the full suite; all 26 tests pass (including the three new smart-contract-wallet scenarios), and theGasHeavyReceivercontract confirms the old 35k cap would have reverted whereas the uncapped call succeeds cleanly.Closes #37