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

(nameRegistry): check short name is not zero #60

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions src/errors/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,6 @@ interface INameRegistryErrors {
error CirclesNamesAvatarAlreadyHasCustomNameOrSymbol(address avatar, string nameOrSymbol, uint8 code);

error CirclesNamesOrganizationHasNoSymbol(address organization, uint8 code);

error CirclesNamesShortNameZero(address avatar, uint256 nonce);
}
5 changes: 5 additions & 0 deletions src/names/NameRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ contract NameRegistry is Base58Converter, INameRegistry, INameRegistryErrors, IC
}

function _storeShortName(address _avatar, uint72 _shortName, uint256 _nonce) internal {
if (_shortName == uint72(0)) {
// short name cannot be zero (but congrats if you got it!)
// this would break the reverse lookup
revert CirclesNamesShortNameZero(_avatar, _nonce);
}
// assign the name to the address
shortNames[_avatar] = _shortName;
// assign the address to the name
Expand Down
Loading