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

[BLU-3626] replace start value of i when Regen Address is verified #55

Merged

Conversation

bezerrablockchain
Copy link
Collaborator

Replace for (uint64 i = 0; i < accountLen; i++) { with for (uint64 i = 6; i < accountLen; i++; Also added unchecked to reduce a bit more gas consumption

@bezerrablockchain bezerrablockchain changed the title fix(solidity): replace start value of i when Regen Address is verified [BLU-3626] replace start value of i when Regen Address is verified Feb 4, 2023
require(prefix[i] == account[i], "regen address must start with 'regen1'");

// verification: check address contains only alphanumeric characters
for (uint8 i = 6; i < accountLen; ++i) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: isn't it actually cheaper to use uint256 here and in the loop above instead of uint8? It'd be great to run these over gas-reporter.

Copy link
Collaborator Author

@bezerrablockchain bezerrablockchain Feb 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I conducted a small tests using remix and it seems that in newer compiler version using small sized types are using less gas. But I am running same test using gas-reporter as well

Copy link
Collaborator

@0xmichalis 0xmichalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment but not very related to your changes, LGTM

@0xmichalis 0xmichalis merged commit 5d681b0 into regen-network:master Feb 4, 2023
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.

None yet

2 participants