Skip to content

Commit

Permalink
feat(wallet): disable EIP-1559 on Polygon and Avalanche
Browse files Browse the repository at this point in the history
Our current EIP-1559 gas oracle queries the Etherscan API, which only
supports Ethereum mainnet. As a result, priority fee estimations on
custom networks use results for Ethereum mainnet, which can either
result in transactions being stuck in the mempool forever, or in
over-payment of gas fees.

This commit will be reverted in brave/brave-browser#20469.
  • Loading branch information
onyb committed Jan 24, 2022
1 parent 00cb041 commit d0e6bac
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions components/brave_wallet/browser/json_rpc_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,21 @@ void JsonRpcService::UpdateIsEip1559(const std::string& chain_id,
if (!id || *id != chain_id)
continue;

// Disable EIP-1559 on selected networks.
//
// This list needs to be updated until we have a generic EIP-1559 gas
// oracle. See: https://github.com/brave/brave-browser/issues/20469.
if (chain_id == "0x13881" || // Polygon Mumbai Testnet
chain_id == "0x89" || // Polygon Mainnet
chain_id == "0xa86a" || // Avalanche Mainnet
chain_id == "0xa869" // Avalanche Fuji Testnet
) {
changed =
custom_network.FindBoolKey("is_eip1559").value_or(false) != false;
custom_network.SetBoolKey("is_eip1559", false);
break;
}

changed = custom_network.FindBoolKey("is_eip1559").value_or(false) !=
is_eip1559;
custom_network.SetBoolKey("is_eip1559", is_eip1559);
Expand Down

0 comments on commit d0e6bac

Please sign in to comment.