fix: transfer() rejected a fee exactly equal to transferMaxFee, unlike sendTransaction() - #125
Open
ayushsingh82 wants to merge 1 commit into
Open
Conversation
…e sendTransaction()
transfer()'s max-fee check used `prepared.fee >= transferMaxFee`, rejecting a
fee exactly equal to the configured cap. sendTransaction()/signTransaction()
use `> transactionMaxFee`, allowing a fee exactly equal to the cap. Git blame
shows the `>` boundary was a deliberate fix applied to transactionMaxFee
(commit "updated max fee checks, testing") that was never mirrored to
transferMaxFee, left behind with the original `>=`.
Changed transfer()'s check to `>` to match. Updated the existing test that
had codified the old behavior ('should throw if the fee equals the transfer
max fee configuration') to assert the corrected, consistent behavior instead
('should allow a fee exactly equal to the transfer max fee configuration'),
mirroring the equivalent sendTransaction test.
Author
|
@jonathunne could you take a look when you have a chance? Thanks! Summary of the fix: `transfer()`'s max-fee check used `prepared.fee >= transferMaxFee`, rejecting a fee exactly equal to the configured cap — while `sendTransaction()`/`signTransaction()` use `> transactionMaxFee`, allowing an exactly-equal fee. Git blame shows the `>` boundary was a deliberate fix applied to `transactionMaxFee` (commit "updated max fee checks, testing") that was never mirrored to `transferMaxFee`. Fixed `transfer()`'s check to `>` to match, and updated the existing test that had codified the old behavior. Flagging as a behavior change per repo convention: a transfer whose fee exactly equals `transferMaxFee` now succeeds instead of throwing. |
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
transfer()'s max-fee check usedprepared.fee >= transferMaxFee, rejecting a fee exactly equal to the configured cap.sendTransaction()/signTransaction()use> transactionMaxFee, allowing a fee exactly equal to the cap.git blameshows the>boundary was a deliberate fix applied totransactionMaxFee(commit "updated max fee checks, testing") that was never mirrored totransferMaxFee, which was left behind with the original>=.quoteTransfer(), pass its returnedfeestraight back in astransferMaxFee, andtransfer()throws'Exceeded maximum fee cost for transfer operation.'even though the fee didn't exceed the cap — it equaled it. The identical scenario throughsendTransaction()/transactionMaxFeesucceeds.Change
src/wallet-account-evm-erc-4337.js:transfer()'s check changed from>=to>, matchingsendTransaction()/signTransaction().tests/wallet-account-evm-erc-4337.test.js: updated the existing test that had codified the old (inconsistent) behavior —'should throw if the fee equals the transfer max fee configuration'— to assert the corrected, consistent behavior instead:'should allow a fee exactly equal to the transfer max fee configuration', mirroring the equivalentsendTransactiontest already in the suite.Breaking change note
Per repo convention, flagging explicitly: this changes observable behavior of
transfer()— a transfer whose fee exactly equalstransferMaxFeewill now succeed instead of throwing. No other public API surface changes.Test plan
npm run lint(standard) passesnpm testpasses — 92/92 unit tests (3 suites)npm run build:typespasses (generated.d.tsdiff not included — it's drift from a different localtscversion across unrelated files, not caused by this change)>=implementation (i.e. the old behavior was real, not a flaky test) before flipping it to assert the fixed behavior