[SC-1387] Remove gas usage limitation by using all available gas #176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Static Code Analysis (readability, compactness):
The removal of the fixed gas limitation. The logic remains straightforward and functional while improving compatibility with L2 solutions such as zkSync, where gas requirements can be unpredictable.
Dynamic Code Analysis (external APIs, interaction flows):
The previous fixed gas limit of 5000 units posed challenges in zkSync environments, where certain operations require more gas than initially anticipated. Although the contracts compiled successfully, runtime failures occurred in production due to insufficient gas allocation. By removing the arbitrary gas cap, the contract can now better handle interactions with zkSync and other L2 solutions, ensuring more reliable and adaptable execution.
Efficiency (gas costs, computational complexity, memory requirements):
Allowing the call to use the full available gas improves the reliability of transactions by reducing the likelihood of failures caused by gas constraints. However, this change may lead to higher gas consumption if the recipient contract is inefficient. It is important to monitor the gas usage in production and optimize interactions where possible to avoid unnecessary costs.
Opinion, trade-offs and other thoughts (optional):
Opinion, trade-offs and other thoughts (optional):
The removal of the gas limit increases compatibility with zkSync and future-proofs the contract against evolving gas dynamics. However, it introduces a potential risk of reentrancy attacks if the called contract contains malicious or complex logic. Proper precautions, such as reentrancy guards and adherence to the checks-effects-interactions pattern, should be considered to mitigate these risks. The change aligns with the practical deployment experience and improves overall robustness.