-
Notifications
You must be signed in to change notification settings - Fork 20
Feat/identity v4 #294
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
Open
sirpy
wants to merge
4
commits into
master
Choose a base branch
from
feat/identity-v4
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/identity v4 #294
+1,140
−328
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 2 issues, and left some high level feedback:
- In
IdentityV4.initializeyou call_setupRolewithavatarbefore DAO/nameService are initialized, so roles are being granted to the zero address; consider movingavatarrole setup entirely intoinitDAO(or passing the DAO ininitialize) to avoid granting admin/pauser/identity roles to an address that will never be used. - In
_setDIDyou requireisWhitelisted(account), which depends on the time‑based reverification logic; this prevents DID updates for users whose status is still1but whose authentication has expired—if you intend to allow updates for such accounts, consider checkingidentities[account].status == 1instead ofisWhitelisted.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `IdentityV4.initialize` you call `_setupRole` with `avatar` before DAO/nameService are initialized, so roles are being granted to the zero address; consider moving `avatar` role setup entirely into `initDAO` (or passing the DAO in `initialize`) to avoid granting admin/pauser/identity roles to an address that will never be used.
- In `_setDID` you require `isWhitelisted(account)`, which depends on the time‑based reverification logic; this prevents DID updates for users whose status is still `1` but whose authentication has expired—if you intend to allow updates for such accounts, consider checking `identities[account].status == 1` instead of `isWhitelisted`.
## Individual Comments
### Comment 1
<location> `test/helpers.ts:125` </location>
<code_context>
+ kind: "uups"
+ })) as IdentityV4;
+ // put reverify far in the future to avoid interference with tests
+ if (identity === "v4") await Identity.setReverifyDaysOptions([180]);
const daoCreator = await DAOCreatorFactory.deploy();
const FeeFormula = await FeeFormulaFactory.deploy(0);
</code_context>
<issue_to_address>
**issue (testing):** Global override of `reverifyDaysOptions` for v4 identities conflicts with tests that expect the default schedule
In `createDAO`, `reverifyDaysOptions([180])` is always set for `identity === "v4"`, but `IdentityV4.test.ts` relies on the contract’s default schedule (e.g. `[1,7,180]`) to exercise multi-step reverify behavior. Any test using `createDAO()` with the default `identity` will now see `[180]`, making those tests fail or give misleading coverage. Please either move this override into a dedicated fixture used only where a `[180]` schedule is required, or update the relevant tests to explicitly expect the overridden value instead of the initializer defaults.
</issue_to_address>
### Comment 2
<location> `test/identity/IdentityV4.test.ts:391-400` </location>
<code_context>
+ it("should follow reverify schedule and cycle authCount", async () => {
</code_context>
<issue_to_address>
**issue (testing):** Reverify schedule test assumes a specific default schedule that may not hold given the shared DAO fixture
This test assumes `reverifyDaysOptions` is `[1,7,180]`, but the shared `createDAO` fixture overrides v4 identities to `[180]`. So the asserted schedule may not match the actual contract state. To make this test reliable, either (a) use a dedicated IdentityV4 fixture that doesn’t override the defaults, (b) explicitly call `setReverifyDaysOptions([1,7,180])` in this test and assert those values, or (c) update the expectations to match the intended `[180]` override if that’s the true requirement.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Feat/identity v4
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description