Skip to content

Commit 9e44f10

Browse files
authored
feat: emits RecordSet events on setRecords (#30)
Closes EFI-484
1 parent 5a6c8a8 commit 9e44f10

4 files changed

Lines changed: 9 additions & 17 deletions

File tree

src/contracts/L2Resolver.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ contract L2Resolver is IL2Resolver, IERC165 {
5858
/// @inheritdoc IL2Resolver
5959
function setRecord(bytes32 _node, string calldata _key, bytes calldata _value) external {
6060
_setRecord(_node, _key, _value);
61-
emit RecordSet(_node, _key, _value);
6261
}
6362

6463
/// @inheritdoc IL2Resolver
@@ -71,8 +70,6 @@ contract L2Resolver is IL2Resolver, IERC165 {
7170
for (uint256 i = 0; i < _length; i++) {
7271
_setRecord(_nodes[i], _keys[i], _values[i]);
7372
}
74-
75-
emit RecordsSet(_nodes, _keys, _values);
7673
}
7774

7875
/// @inheritdoc IL2Resolver
@@ -136,6 +133,7 @@ contract L2Resolver is IL2Resolver, IERC165 {
136133
}
137134

138135
records[_node][_key] = _value;
136+
emit RecordSet(_node, _key, _value);
139137
}
140138

141139
/**

src/interfaces/IL2Resolver.sol

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ interface IL2Resolver {
2121
*/
2222
event RecordSet(bytes32 indexed _node, string indexed _key, bytes _value);
2323

24-
/**
25-
* @notice Emitted when records are set in batch.
26-
* @param _nodes The ENS nodes to store the data for.
27-
* @param _keys The keys to store the data under.
28-
* @param _values The data to store under the keys.
29-
*/
30-
event RecordsSet(bytes32[] _nodes, string[] _keys, bytes[] _values);
31-
3224
/*///////////////////////////////////////////////////////////////
3325
ERRORS
3426
//////////////////////////////////////////////////////////////*/

test/unit/L2Resolver.t.sol

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,10 @@ contract UnitL2Resolver is Test {
904904
_mockAndExpect(address(_ensRegistry), abi.encodeWithSelector(IENS.owner.selector, _nodes[i]), abi.encode(_caller));
905905
}
906906

907-
// it emits the RecordsSet event
907+
// it emits the RecordSet event
908908
vm.prank(_caller);
909909
vm.expectEmit();
910-
emit IL2Resolver.RecordsSet(_nodes, _keys, _values);
910+
emit IL2Resolver.RecordSet(_nodes[0], _keys[0], _values[0]);
911911
_l2Resolver.setRecords(_nodes, _keys, _values);
912912

913913
// it sets the records
@@ -940,7 +940,7 @@ contract UnitL2Resolver is Test {
940940
// it emits the RecordsSet event
941941
vm.prank(_caller);
942942
vm.expectEmit();
943-
emit IL2Resolver.RecordsSet(_nodes, _keys, _values);
943+
emit IL2Resolver.RecordSet(_nodes[0], _keys[0], _values[0]);
944944
_l2Resolver.setRecords(_nodes, _keys, _values);
945945

946946
// it sets the records
@@ -958,7 +958,9 @@ contract UnitL2Resolver is Test {
958958
_keysLength = bound(_keysLength, 1, _BATCH_RECORDS);
959959
_valuesLength = bound(_valuesLength, 1, _BATCH_RECORDS);
960960

961-
vm.assume(_nodesLength != _keysLength && _nodesLength != _valuesLength && _keysLength != _valuesLength);
961+
vm.assume(_nodesLength != _keysLength);
962+
vm.assume(_nodesLength != _valuesLength);
963+
vm.assume(_keysLength != _valuesLength);
962964

963965
// it reverts
964966
vm.expectRevert(abi.encodeWithSelector(IL2Resolver.InvalidDataLength.selector));

test/unit/L2Resolver.tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ UnitL2Resolver::resolve
108108

109109
UnitL2Resolver::setRecords
110110
├── when setting multiple records in batch
111-
│ ├── it emits the RecordsSet event
111+
│ ├── it emits the RecordSet event
112112
│ └── it sets the records
113113
├── when setting multiple reverse lookup records in batch
114-
│ ├── it emits the RecordsSet event
114+
│ ├── it emits the RecordSet event
115115
│ └── it sets the records
116116
└── when the parameters length does not match the records length
117117
└── it reverts

0 commit comments

Comments
 (0)