Comments (6)
It is correct but there is another thing to mention. Freeing space in smart contracts storage (delete) gives you extra gas to run in your transaction, this is useful for gas free transactions. As you said, I agree with the smart contract execution which can change the execution flow.
If a transaction reverts, also the delete will be reverted.
from burner-wallet.
Not sure how the extra gas you're mentioning adds to OP. Deleting is fine when you use destination.transfer()
which will revert on failure. When it doesn't revert, delete
frees some gas, yup.
But I'm curious, maybe I didn't understand your comment?
from burner-wallet.
I'll talk about 3 different cases:
- Send value to EOA - Probably this is the desired case for burner wallets. If a transaction gets to the delete instruction, it will get gas to run the call and send the value. It will be extremely hard (not impossible) to fail on sending the value with this extra boost.
- Send value/tx to a contract (Honest smart contract that reverts) - In this case all the transaction states will be reverted, including the delete. However if it gets out of gas on the external contract, the fund will be deleted without revert.
- Send value/tx to a contract (Bad smart contract actor) - Calling an external contract can change the execution flow by trying reentrancy attacks or calling functions in the original contract that can alter the storage state.
As you said, destination.transfer()
will revert in case of failure. Depending on the design, it could be or not the desired effect. destination.send()
has the same gas limitation as transfer but it doesn't reverts. It only returns a boolean status.
from burner-wallet.
Thanks for explaining!
- Do you have some numbers? How much gas is freed vs gas cost of simply sending ETH (2300gas?)
- According to this answer, you are not correct here. If an honest smart contract reverts, the tx will succeed.
- Agreed
from burner-wallet.
-
From Ethereum Yellow Paper p.25,7,8
15000 Refund given (added into refund counter) when the storage value is set to zero from
non-zero.
24000 Refund given (added into refund counter) for self-destructing an account.
Even with this numbers it is difficult to estimate. I added some measurements in the audit tests but they are not very consistent in every run.
If you find a better way to measure it, please let me know. -
You are right. External calls return a status value. It becomes an independent call which can revert without affecting the original call.
To revert the original transaction, some more checks should have been needed:
require(destination.call.value(value).gas(gasleft())())
from burner-wallet.
I'll get this changed in the contract. Thanks guys!
from burner-wallet.
Related Issues (20)
- Create a proposal on how the burner-wallet can prevent its private key from leaking when signing an external dapp's transactions HOT 1
- Improve burner-wallet development by using test or local networks
- Use estimateGas for gasLimit instead of arbitrary value HOT 1
- Support Light Clients
- Add Token Meta Transactions
- create continuous integration HOT 4
- Disable or hide the Metamask popoup HOT 1
- Create a Burner Wallet Web3 Provider for Web3connect HOT 3
- Retrieve xdai locked on the link contract
- send with link for large numbers failing
- Incorrect incognito detection
- Add Ethereum address to FUNDING.yml
- Upgrade contracts to GSN network HOT 2
- Using many deprecated dependencies
- scrypt dependency fails on node v12.12.0
- DAI doesn't show in BurnerWallet
- xDAI.io stuck when trying to convert Dai to xDai
- Transactions that are removed from blockchain are still shown in the DApp
- Robinsonwealth
- Top
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from burner-wallet.