On September 27th, according to Etherscan, a major wallet on the Bitfinex exchange made a $100,000 USDT transfer at a Gas fee of 7676.62 ETH , and the final recipient was the non-custodial exchange DeversiFi, which was spun off from Bitfinex in 2019. . This huge miner’s fee was then transferred to the Binance Exchange by unknown miners.
On September 28, things came to a happy ending. After Bitfinex and currency security and miners negotiations, Ethernet Square block of 13,307,440 display, the miners returned 7626ETH Gas costs Bitfinex wallet last night misuse pay, DeversiFi to the miners retained 50 ETH as a thank fee.
On September 29, DeversiFi released a complete report of the incident.
- At 11.10.08 AM UTC +1, the user deposits 100,000 USDT to DeversiFi.
- The transaction was confirmed within 1 minute… The transaction fee for this transaction was as high as 7,676 ETH (approximately 23 million USD)
- Potential issues in the Ethereum JS library, coupled with changes in gas fees associated with the EIP-1559 upgrade in some cases, may result in extremely high transaction fees
- In another encounter, the Ledger hardware wallet may sometimes display the Gas fee in a non-human-readable way, missing the user’s visual security check
- Only wallets with a very large amount of ETH will be affected, and other users will see transaction failures
What does DeversiFi do
- By 12:30:00 PM UTC+1, the DeversiFi team realized the problem and started an investigation.
- Two main points of concern were quickly identified, and active testing began to try to reproduce and explain how erroneous transactions were created.
- Shared an explanation with the blockchain community and noticed this transaction https://twitter.com/deversifi/status/1442487743922286594
- Until 16:45 UTC+1, Ledger user deposits are disabled
- At night, find the possible culprit in the gas cost function and start to implement improvements
- Additional security and sanity checks have been added to ensure that transaction-related gas costs do not exceed unrealistic thresholds to prevent user errors, extreme network costs soaring, and as an additional layer of protection against any future coding errors
- Submit an issue to the EthereumJs maintainer, describing the flaws in the EthereumJs library
- Finally, I communicated with the Ledger team about the abnormalities found during the test, which may confuse any abnormally high fees of Ethereum transactions.
- Security improvements and reopen deposits were introduced before 15:30 on 28/09/21
- An unknown miner packed a huge gas fee in the 13307440 block, and then discovered that the miner had deposited the ETH he dug into Binance, and DeversiFi immediately contacted Binance.
- Binance agrees to pass DeversiFi’s email address to miners
- UTC + 1 time 20:36, received an email from the miner, and reached a process for safe return of funds
- Within an hour, the miner completed the refund transaction, refunding a total of 7,626 ETH
- DeversiFi reserved 50 ETH for miners as a thank you fee
In the end what happened
Let’s review how EIP-1559 changes the way Ethereum transaction fees are handled.
- The EIP-1559 transaction consists of three parts:
- Basic fee-determined by the network and destroyed
- Max Fee Per Gas-The maximum amount paid per unit of Gas to obtain block packaging
- Max Priority Fee-User-selectable tip paid directly to miners
EIP-1559 transactions include these new fields, called Type 2, while legacy transactions that provide the original Gas Price field are still supported, called Type 0. We will not discuss what happened to Type 1.
A common misconception is that the EIP-1559 transaction completely eliminates the possibility of users paying excessive gas fees for the transaction. However, when the priority fee and the maximum fee are both set too high, accidental overpayment cannot be prevented.
DeversiFi is a layer 2 protocol for DeFi on Ethereum. It has a front end that provides a simple interface to access protocols from various wallets, including Metamask and Ledger. About a month ago, DeversiFi updated the front end to use the EIP-1559 transaction provided by the London hard fork activation, and implemented the new features with the latest version of the Ethereum library and in accordance with the documentation.
Metamask performs a lot of heavy work when generating messages and signatures, but for other wallets such as Ledger, DeversiFi uses the @ethereumjs/tx npm package (https://github.com/ethereumjs/ethereumjs-monorepo) to generate transactions by itself.
Specifically, an EIP1559 transaction subject was created, and message injection parameters and fees were generated before interfacing with the Ledger wallet library to prompt users to sign on their hardware devices.
This is the first problem in this process, especially when calculating gas and priority fees and then converting them into a large digital object. Since the last few blocks are used to predict the priority fee, the calculation result may be a decimal value (MyCrypto’s Tay has been warning for a while)
When the generated gas value is an integer, the underlying ethereumjs library code works perfectly, but it becomes strange when the gas value is a decimal value. The BN library used by the Ethereum library code threw an error indicating that an invalid value was passed, but because the value was first converted to a buffer, no error handling was triggered.
For example, passing the value 33974230439.550003 will result in an integer 35624562649959629, which may be six orders of magnitude higher than expected.
When this wrong digital interpretation occurs, it either fails because the amount of priority gas is higher than the maximum fee per gas, or because the amount of ETH the user has in the wallet is almost always impossible to be high enough to pay this huge amount Gas fee overspend.
This means that, except for a few hardware wallet users who have encountered this problem, almost everyone will not understand the reason for their transaction failure.
When signing a transaction on Ledger, the user will be shown the highest fee so that they can verify the transaction that will be authorized. What makes things worse is that currently Ledger displays very large fees as hexadecimal values.
While trying to reproduce the problem, DeversiFi encountered the cost prompt shown above. In the example transaction showing the problem, the hexadecimal value of B526167CF91FECE4 is equal to 13053145295991336164, which is equivalent to 13053145295991.336164 Gwei or 13.05 ETH as an astronomy fee.
If this transaction is accepted (and there are funds to pay for it in the wallet), the user will sign a fee of up to 216,564 ETH.
DeversiFi doubts whether this may be the case for block 13307440, where the highest fee paid exceeds the authorized ETH fee by 2 times.
Posted by:CoinYuppie，Reprinted with attribution to:https://coinyuppie.com/read-and-understand-7676-eth-huge-miners-fees-in-one-article/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.