Repository navigation
Conversation
Some users are unable to send transactions, receiving a "current network does not support EIP-1559" error on chains that in fact *do* support EIP-1559. When preparing a transaction for submission, TransactionController will ask NetworkController whether the transaction's chain supports EIP-1559. If it has not already done so, NetworkController will then fetch the latest block and look for the presence of a `baseFeePerGas` field. TransactionController then uses the result to 1) validate the transaction data relative to its type, 2) fill in the type of the transaction if it's missing, and 3) determine the estimated gas fees for that transaction. There are therefore two possible causes for the aforementioned bug: A. The request for the latest block fails (and continues to fail), so NetworkController is unable to determine whether a chain supports EIP-1559, leaving the status of that chain as unknown. Then, TransactionController re-interprets that status as `false`. As a result, transactions with EIP-1559 fees are rejected before any confirmation is shown, and transactions without a type are quietly downgraded to legacy (0x1). B. The latest block, when requested, is mysteriously missing a `baseFeePerGas` field. NetworkController then captures the status in state as `false`. Because the EIP-1559 status of a chain is "sticky" — once set it is never updated again — this causes transactions to be broken until the user uninstalls and reinstalls MetaMask. Taking the position that every chain really ought to support EIP-1559 by now, this commit makes two related changes: 1. If the latest block of a chain doesn't have `baseFeePerGas`, NetworkController will still record the chain as lacking EIP-1559 support, but this value will get cleared from state the next time NetworkController is initialized. This effectively means the next time the user restarts their wallet, the controller will check again (in case the chain really *does* support EIP-1559). 2. If NetworkController is unable to determine whether a chain supports EIP-1559, TransactionController will act as though it does, defaulting the transaction type to 0x2 and estimating gas fees using EIP-1559 limits. (If the chain doesn't *really* have support, then it should reject the transaction.)
Contributor
🛑 Files requiring codeowner reviewTo merge this PR, you'll need to get approvals from the following owner groups. (Note: For files with multiple owners, approval from one owner is sufficient.) @MetaMask/confirmations (3 files)
@MetaMask/core-platform or @MetaMask/metamask-assets or @MetaMask/networks (4 files)
ℹ️ Files co-owned by
|
This branch has not been deployed
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.
Explanation
Some users are unable to send transactions, receiving a "current network does not support EIP-1559" error on chains that in fact do support EIP-1559.
When preparing a transaction for submission, TransactionController will ask NetworkController whether the transaction's chain supports EIP-1559. If it has not already done so, NetworkController will then fetch the latest block and look for the presence of a
baseFeePerGasfield. TransactionController then uses the result to 1) validate the transaction data relative to its type, 2) fill in the type of the transaction if it's missing, and 3) determine the estimated gas fees for that transaction.There are therefore two possible causes for the aforementioned bug:
false. As a result, transactions with EIP-1559 fees are rejected before any confirmation is shown, and transactions without a type are quietly downgraded to legacy (0x1).baseFeePerGasfield. NetworkController then captures the status in state asfalse. Because the EIP-1559 status of a chain is "sticky" — once set it is never updated again — this causes transactions to be broken until the user uninstalls and reinstalls MetaMask.Taking the position that every chain really ought to support EIP-1559 by now, this commit makes two related changes:
baseFeePerGas, NetworkController will still record the chain as lacking EIP-1559 support, but this value will get cleared from state the next time NetworkController is initialized. This effectively means the next time the user restarts their wallet, the controller will check again (in case the chain really does support EIP-1559).References
(Will add a ticket)
Checklist