-
Notifications
You must be signed in to change notification settings - Fork 14
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
Hardcoding gas costs should be avoided #428
Comments
gzeon-c4 marked the issue as primary issue |
I think the risk is low and the suggested solution will significantly increase gas cost. |
livingrockrises marked the issue as disagree with severity |
21000 is ok but as per other issues msg.data.length should not be there! |
livingrockrises marked the issue as sponsor acknowledged |
gzeon-c4 changed the severity to QA (Quality Assurance) |
gzeon-c4 marked the issue as grade-b |
Lines of code
https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L200
Vulnerability details
Impact
The
execTransaction
function inSmartAccount.sol
has some hard coded gas cost values like for example 21000 (the base cost of an EVM transaction). We have seen previous EVM forks changing the gas cost of some key things, for example the SSTORE opcode. This can happen again and in this case the hardcoded values might not be correct anymore which will lead to wrong accounting for incurred gas costs. Also if the project is deployed on a different EVM-compatible chain, the gas costs there might be different.Proof of Concept
In SmartAccount.sol:
Tools Used
Visual Studio Code
Recommended Mitigation Steps
Initialize the expected gas costs and add setter functions to be able to update them in case of an EVM fork.
The text was updated successfully, but these errors were encountered: