-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EIP-1706 Discussion #1
Comments
In the
It should be more precise as with such proposal a simple gas estimate call (with a big enough amount of gas provided) could return a too low amount of gas to pass the check As such existing application that relies on We could modify the logic behind |
Created an EIP for the general problem, Your proposal could use the same mechanism ( |
Sorry false alert, the issues was discovered in ganache and I assumed it was the case everywhere. Geth and parity use binary search to find the minimum gas amount and will work with 1706 keeping backward compatibility |
What I don't understand is, why the value was chosen to be 2300. This contract was not vulnerable to reentrancy before the EIP, but would be vulnerable afterwards:
Why did you pick 2300 as the boundary to raise an exception? |
Well, there is no strong reason to pick '2300' over '5000', but the 'call stipend' constant of 2300 is present in the Yellow Paper:
I get it this value was widely assumed to not be enough to change contract's state and is not related to actual storage write gas costs. And it was automatically hard-coded in many deployed contracts. '5000', on the other hand, comes from the cost of the SSTORE operation, and had to be given explicitly as a gas limit, so relying on it to protect your contract from reentrancy does seem like a mistake. So, introducing '5000' as a limit value seemed more like a legacy logic backward-compatible patch to me, while requiring the call to have more than Gcallstipend left to modify storage seemed like a right thing to do initially. |
A quick scan of this repo (which is not up-to-date): https://github.com/thec00n/etherscan_verified_contracts find 782 cases of explicit https://etherscan.io/address/0x8593F6028b5B6c4F7899f9cf2e0bA2750b7f6Ee2#contracts In that sense, I would like to challenge your assumptions. |
Well, it actually makes sense that someone would depend on explicitly setting gas to 4999. If there will be a consensus that this is the right thing to do, I will update the EIP. But in case this becomes a contentious issue, maybe it will make sense for it to have a different issue number? |
The security issue this EIP ties do mitigate is the case when a call starts with 5000/2300 gas and it is assumed that no state changes are able to be performed in such call. However, the scope of this EIP is bigger than required. It will also affect cases like:
This adds a "dynamic" effect that SSTORE depends on a parameter (current "gas left") that is not easy to estimate by developers. Alternative solutionWhen a call starts with less than 5000/2300 gas, enable "semi-static" execution mode where SSTORE is not allowed. The "semi-static" mode could also include restrict CALLs as in static mode. Including LOGs can also be considered (that would enable full static mode), but the main reason for the stipend was to provide minimum gas allowing the callee to make a LOG. This is one of the features probably nobody ever used, but we now have a big mess around it. |
No description provided.
The text was updated successfully, but these errors were encountered: