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

Address L2/Q4 #112

Merged
merged 6 commits into from
Dec 6, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/QuarkStateManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ contract QuarkStateManager {
* @dev Any unset nonce is valid to use, but using this method
* increases the likelihood that the nonce you use will be in a bucket that
* has already been written to, which costs less gas
* @param wallet Address of the wallet to find the next nonce
* @param wallet Address of the wallet to find the next nonce for
* @return The next unused nonce
*/
function nextNonce(address wallet) external view returns (uint96) {
for (uint256 bucket = 0; bucket < type(uint256).max;) {
// Exclude bucket==uint88.max out to prevent from overlfowing, as favor in using unchecked for gas optimization
cwang25 marked this conversation as resolved.
Show resolved Hide resolved
for (uint256 bucket = 0; bucket < type(uint88).max;) {
cwang25 marked this conversation as resolved.
Show resolved Hide resolved
uint256 bucketNonces = nonces[wallet][bucket];
uint96 bucketValue = uint96(bucket << 8);
cwang25 marked this conversation as resolved.
Show resolved Hide resolved
for (uint256 maskOffset = 0; maskOffset < 256;) {
Expand Down