fix: estimate a request even when the site sends its gas limit (closes #554)
ethers asks the node for a gas estimate only when the request has no gas limit, and that estimate is the wallet's only check that a transaction does not revert. Since a site's `gas` became the gas limit, a reverting request carrying one opened the approval window and could be signed and mined to fail. Such a request is now estimated first, with the site's limit and under the same timeout; a failure goes back to the site with no window, and the site's gas limit is still the one shown and signed. A limit too low for the call now fails the same way. Model: opus-5-5
This commit was merged in pull request #557.
This commit is contained in:
@@ -2100,8 +2100,10 @@ view would leave a wallet one click from deletion.
|
||||
artifact can be compared with it field for field. A nonce the site supplies is
|
||||
ignored: the nonce is always the account's next nonce from the node, so a site
|
||||
cannot replace one of the user's pending transactions or leave this one stuck
|
||||
behind a gap. A gas limit the site supplies, as `gas` or `gasLimit`, is used
|
||||
in place of the node's estimate; a request giving both with different values
|
||||
behind a gap. A gas limit the site supplies, as `gas` or `gasLimit`, is the
|
||||
one shown and signed in place of the node's estimate, but the node still
|
||||
estimates the transaction with that limit, as the check that it neither
|
||||
reverts nor runs out of gas; a request that gives both with different values
|
||||
is refused. A request that cannot be populated — unreachable node, reverting
|
||||
gas estimate — opens no window and is failed back to the site. Only one
|
||||
transaction approval exists at a time: populating fixes the nonce, so a second
|
||||
|
||||
Reference in New Issue
Block a user