Skip to content

Commit b795d93

Browse files
committed
fix: not allow set registry to false, update event
1 parent 0c59c89 commit b795d93

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

contracts/interfaces/IProfile.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface IProfile {
3131
/// @dev Event emitted when a address in a profile is changed.
3232
event ProfileAddressChanged(address indexed id, RoleAccess indexed addressType);
3333
/// @dev Event emitted when the pubkey of the `id` is changed.
34-
event PubkeyChanged(address indexed id);
34+
event PubkeyChanged(address indexed id, bytes pubkey);
3535

3636
/// @dev Error of already existed profile.
3737
error ErrExistentProfile();

contracts/ronin/profile/Profile.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ contract Profile is IProfile, ProfileStorage, Initializable {
5757
if (msg.sender != _profile.admin) revert ErrUnauthorized(msg.sig, RoleAccess.ADMIN);
5858
_checkDuplicatedPubkey(pubkey);
5959

60-
_registry[_hashPubkey(_profile.pubkey)] = false;
61-
6260
_profile.pubkey = pubkey;
6361
_registry[_hashPubkey(pubkey)] = true;
6462

65-
emit PubkeyChanged(id);
63+
emit PubkeyChanged(id, pubkey);
6664
}
6765
}

contracts/ronin/profile/ProfileStorage.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import { IProfile } from "../../interfaces/IProfile.sol";
88
abstract contract ProfileStorage is IProfile, HasContracts {
99
/// @dev Mapping from id address => candidate profile.
1010
mapping(address => CandidateProfile) internal _id2Profile;
11-
/// @dev Mapping from any address or keccak256(pubkey) => whether it is already registered.
11+
/**
12+
* @dev Mapping from any address or keccak256(pubkey) => whether it is already registered.
13+
* This registry can only be toggled to `true` and NOT vice verse. All registered values
14+
* cannot be reused.
15+
*/
1216
mapping(uint256 => bool) internal _registry;
1317
/// @dev Upgradeable gap.
1418
bytes32[49] __gap;

logs/contract_code_sizes.log

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
············································|···························|·················
134134
| PauseEnforcer · 4.441 · │
135135
············································|···························|·················
136-
| Profile · 4.359 · │
136+
| Profile · 4.357 · │
137137
············································|···························|·················
138138
| Proposal · 0.162 · │
139139
············································|···························|·················

0 commit comments

Comments
 (0)