fix: gas fee is excluded from the insufficient-balance check, so max-value ETH sends fail at broadcast #154
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
ConfirmTx estimates and displays the network fee correctly
(
src/popup/views/confirmTx.js:227-265), but the validation that enables ordisables the Send button compares amount against balance only and ignores
gas entirely (
src/popup/views/confirmTx.js:157-183).Consequence: a user sending their full ETH balance (or anything within one
gas-cost of it) sees no error, the Send button stays enabled, they enter their
password, and the transaction fails at broadcast — after committing to it. For
a wallet whose whole design premise is "verify everything on the confirmation
screen before signing", surfacing this only as an RPC error is the wrong
behaviour.
Implementation requirements
amount + estimatedFee <= balance. For ERC-20 transfers, the tokenamount is checked against the token balance as today, but the ETH balance
must separately cover
estimatedFee, and an insufficient-ETH-for-gascondition must be its own distinct, clearly worded error.
confirmTx.js:223). Handle the orderingproperly: re-run validation when the estimate resolves. Until it resolves,
do not show a spurious error and do not let a known-bad send through — pick
the conservative behaviour and describe it in the PR.
confirmTx.js:261-264, "Unable toestimate"). Decide and document whether Send stays enabled when the fee is
unknown; do not silently treat unknown as zero.
rules — e.g. "Your balance does not cover this amount plus the network fee."
README No Layout Shift policy. Re-validating when the async estimate lands
must not move anything on screen.
naturally; otherwise leave it out of scope and note it.
Definition of done
shows an error and disables the Send button.
for gas shows a distinct error naming the gas shortfall, and disables
Send.
shift.
the ETH and ERC-20 cases.
TODO.mdupdated in the same commit.make checkpasses.