feat: implements setRecord function and unit tests - #6
Conversation
EFI-426 setRecord
Authorization ModelWrite operations via
The |
| ├── when the caller is an ENSregistry approved operator of the parent | ||
| │ ├── it emits the RecordSet event | ||
| │ └── it sets the record | ||
| ├── when the caller is a NameWrapper approved operator of the parent |
There was a problem hiding this comment.
This branch is probably not realistic for our use case, but it is still a possible option
| assertEq(_l2Resolver.PARENT_NODE(), _parentNodeNameHash); | ||
| } | ||
|
|
||
| modifier whenTheNodeIsTheReverseLookupNode() { |
There was a problem hiding this comment.
this one was generated by bulloak and I don't really need it. Not sure if it is better to leave it or run it with the option that doesn't generate modifiers. What do you think?
0xAustrian
left a comment
There was a problem hiding this comment.
Very good job. I want to double check the tests again, but looks good.
There was a problem hiding this comment.
I think we can import this repo as a package and use ENS and INameWrapper, wdyt?
There was a problem hiding this comment.
is it worth it when we just need a few lines of code for the interfaces? wouldn't it make the contract bigger by importing all those additional functions?
There was a problem hiding this comment.
You are right, lets do it your way
| */ | ||
| function _getOwner(bytes32 _node) private view returns (address _owner) { | ||
| _owner = ENS_REGISTRY.owner(_node); | ||
| if (_owner == address(0)) return address(0); |
There was a problem hiding this comment.
You can safely remove this line, the behaviour will be the same.
There was a problem hiding this comment.
I think it would revert if the NAME_WRAPPER is not set since it would try to do NAME_WRAPPER.ownerOf(uint256(_node));, right?
Maybe we should validate that none of those addresses are zero in the constructor?
There was a problem hiding this comment.
I agree, do you mind adding that to another linear task?
There was a problem hiding this comment.
done. I removed the validation in this PR
| function test_SetRecordWhenTheCallerIsTheReverseAdmin() external { | ||
| // it emits the RecordSet event | ||
| vm.prank(_reverseAdmin); | ||
| vm.expectEmit(true, true, false, true); |
There was a problem hiding this comment.
vm.expectEmit(); also works
There was a problem hiding this comment.
but that wouldn't be testing if the arguments are indexed, right? Or it doesn't matter since I am emitting that same event that I expect?
There was a problem hiding this comment.
I think vm.expectEmit() checks all the topics and data.
0xAustrian
left a comment
There was a problem hiding this comment.
Everything looks good, will approve once vm.expectEmit is fixed
🤖 Linear
Closes EFI-435, EFI-426