Skip to content
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

Use unchecked in DepositContract.sol #366

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

floor-licker
Copy link

Use unchecked in the _deposit function to skip Solidity's built-in overflow checks for the ++depositCount operation since the preceding condition (if (depositCount >= _MAX_DEPOSIT_COUNT))
already ensures that an overflow is impossible. This eliminates unnecessary runtime checks, reducing gas costs.

zkronos73 and others added 3 commits October 17, 2024 23:38
Use unchecked in the _deposit function to skip Solidity's built-in overflow checks for the ++depositCount operation since the preceding condition 
(if (depositCount >= _MAX_DEPOSIT_COUNT))
already ensures that an overflow is impossible. This eliminates unnecessary runtime checks, reducing gas costs.
Copy link

cla-bot bot commented Dec 7, 2024

We require contributors/corporates @floor-licker to read our Contributor License Agreement, please check the Individual CLA document/Corporate CLA document

Copy link

sonarqubecloud bot commented Dec 7, 2024

@invocamanman
Copy link
Collaborator

Hey ^^

this is a nice optimization. We might add it into future iterations of the code.
Can u make this PR on develop tho?¿
If we add it will be on th next iteration with other changes and a proper audit, so will take a while ( sorry)

@invocamanman invocamanman marked this pull request as draft December 12, 2024 15:26
@floor-licker floor-licker changed the base branch from main to develop December 12, 2024 21:11
@floor-licker
Copy link
Author

@invocamanman Sounds good, I just changed base to the develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants