@@ -260,6 +260,30 @@ contract IntegrationL2Resolver is IntegrationBase {
260260 }
261261 }
262262
263+ function test_setRecords_NotAuthorized () public {
264+ bytes32 [] memory _nodes = new bytes32 [](_BATCH_RECORDS);
265+ string [] memory _keys = new string [](_BATCH_RECORDS);
266+ bytes [] memory _values = new bytes [](_BATCH_RECORDS);
267+
268+ for (uint256 i = 0 ; i < _BATCH_RECORDS; i++ ) {
269+ string memory _subDomain = Strings.toString (i);
270+ string memory _ensDomain = string .concat (_subDomain, _L2_ETH_SUFFIX);
271+ _nodes[i] = ENSHash.namehash (ENSHash.subDomainLabelHash (_ensDomain), _parentNodeNamehash);
272+ if (i != _BATCH_RECORDS - 1 ) {
273+ _registerSubDomain (_subDomain, _parentNodeOwner, _subDomainOwner);
274+ }
275+ _nodes[i] = ENSHash.namehash (keccak256 (bytes (_subDomain)), _parentNodeNamehash);
276+ _keys[i] = _key;
277+ _values[i] = abi.encode (i);
278+ }
279+
280+ vm.prank (_subDomainOwner);
281+ vm.expectRevert (
282+ abi.encodeWithSelector (IL2Resolver.NotAuthorized.selector , _subDomainOwner, _nodes[_BATCH_RECORDS - 1 ])
283+ );
284+ _l2Resolver.setRecords (_nodes, _keys, _values);
285+ }
286+
263287 function test_setRecords_Reverse () public {
264288 bytes32 [] memory _nodes = new bytes32 [](_BATCH_RECORDS);
265289 string [] memory _keys = new string [](_BATCH_RECORDS);
@@ -281,4 +305,33 @@ contract IntegrationL2Resolver is IntegrationBase {
281305 assertEq (_l2Resolver.getRecord (_nodes[i], _keys[i]), _values[i]);
282306 }
283307 }
308+
309+ function test_setRecords_Reverse_UnAuthorized () public {
310+ bytes32 [] memory _nodes = new bytes32 [](_BATCH_RECORDS);
311+ string [] memory _keys = new string [](_BATCH_RECORDS);
312+ bytes [] memory _values = new bytes [](_BATCH_RECORDS);
313+
314+ for (uint256 i = 0 ; i < _BATCH_RECORDS; i++ ) {
315+ string memory _subDomain = Strings.toString (i);
316+ string memory _ensDomain = string .concat (_subDomain, _L2_ETH_SUFFIX);
317+ if (i != _BATCH_RECORDS - 1 ) {
318+ _registerSubDomain (_subDomain, _parentNodeOwner, _subDomainOwner);
319+ }
320+ _nodes[i] = _reverseLookupNode;
321+ _keys[i] = string .concat (_key, Strings.toHexString (uint256 (keccak256 (abi.encode (i))), 32 ));
322+ _values[i] = abi.encode (_ensDomain);
323+ }
324+
325+ vm.prank (_subDomainOwner);
326+ vm.expectRevert (
327+ abi.encodeWithSelector (
328+ IL2Resolver.NotAuthorized.selector ,
329+ _subDomainOwner,
330+ ENSHash.namehash (
331+ ENSHash.subDomainLabelHash (abi.decode (_values[_BATCH_RECORDS - 1 ], (string ))), _parentNodeNamehash
332+ )
333+ )
334+ );
335+ _l2Resolver.setRecords (_nodes, _keys, _values);
336+ }
284337}
0 commit comments