solidstate-solidity
solidstate-solidity copied to clipboard
added AccessControl
Test need to be done
btw where can I change the @solidstate/spec? I would like to add describeBehaviorOfAccessControl
That package is located in the spec
directory of this repository.
please add describeBehaviorOfAccessControl to @solidstate/spec
please add describeBehaviorOfAccessControl to @solidstate/spec
I don't think I have access to your branch. You can add it by importing it into spec/access/index.ts
.
Love that this is seeing progress, going to be watching this
I will review again soon. Not much time at the moment. It appears to be nearly finished, though.
@iam-dev Merge conflict fixed, pull changes.
please check and merge
+1 for having this support for the access control functions!
Please forgive the delay, will get back to this as soon as I can.
+1 Looking forward to seeing it in the next version
Any update on when this will be merged or is there still work that needs to be done?
Once again, I apologize for the delay. I've made some changes, and I believe this is almost ready to merge.
One outstanding question: why shouldn't grantRole
revert if a user already has a role, and why shouldn't revokeRoke
revert if a user doesn't have a role? I'd like to make one of the following changes:
- Revert if either of these functions is called but has no effect.
- Add a
bool
return argument to these functions to indicate whether the call had an effect. - Remove the internal success checks and emit the events in every case (consistent with
OwnableInternal#_transferOwnership
).
Any opinions? I will merge once this is decided.
OpenZeppelin's implementation doesn't revert on those things, so I guess that's just how it was ported. I'm wondering why they made the decision not to revert if it wouldn't do anything. Maybe there's an edge case I'm not seeing. Returning a bool
would still give feedback but not be a "breaking" change compared to OpenZeppelin. So maybe change 2 would be my vote.
Yeah, the PR matches the original OZ implementation, but the same question could also be asked there. AccessControl
isn't based on an EIP, so it's okay to make improvements.
Thought of a third option which I'm leaning towards - see my edited comment above.
For both grantRole
and revokeRole
checks can be performed ahead of time if a bool or revert is desirable. I like the third option or leaving it as is.
Implemented option 3.