Skip to content

Commit f697e79

Browse files
authored
Merge pull request #422 from ensdomains/chore/triple-slash-natspec
chore: use triple slash natspec
2 parents f130873 + 8687146 commit f697e79

File tree

71 files changed

+893
-1382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+893
-1382
lines changed

bun.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/dnsregistrar/DNSRegistrar.sol

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ import "./DNSClaimChecker.sol";
1414
import "./PublicSuffixList.sol";
1515
import "./IDNSRegistrar.sol";
1616

17-
/**
18-
* @dev An ENS registrar that allows the owner of a DNS name to claim the
19-
* corresponding name in ENS.
20-
*/
17+
/// @dev An ENS registrar that allows the owner of a DNS name to claim the
18+
/// corresponding name in ENS.
2119
contract DNSRegistrar is IDNSRegistrar, IERC165 {
2220
using BytesUtils for bytes;
2321
using Buffer for Buffer.buffer;
@@ -67,9 +65,7 @@ contract DNSRegistrar is IDNSRegistrar, IERC165 {
6765
ens = _ens;
6866
}
6967

70-
/**
71-
* @dev This contract's owner-only functions can be invoked by the owner of the ENS root.
72-
*/
68+
/// @dev This contract's owner-only functions can be invoked by the owner of the ENS root.
7369
modifier onlyOwner() {
7470
Root root = Root(ens.owner(bytes32(0)));
7571
address owner = root.owner();
@@ -82,11 +78,9 @@ contract DNSRegistrar is IDNSRegistrar, IERC165 {
8278
emit NewPublicSuffixList(address(suffixes));
8379
}
8480

85-
/**
86-
* @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.
87-
* @param name The name to claim, in DNS wire format.
88-
* @param input A chain of signed DNS RRSETs ending with a text record.
89-
*/
81+
/// @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.
82+
/// @param name The name to claim, in DNS wire format.
83+
/// @param input A chain of signed DNS RRSETs ending with a text record.
9084
function proveAndClaim(
9185
bytes memory name,
9286
DNSSEC.RRSetWithSignature[] memory input

contracts/dnsregistrar/OffchainDNSResolver.sol

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,10 @@ contract OffchainDNSResolver is IExtendedResolver, IERC165 {
234234
return IAddrResolver(resolver).addr(node);
235235
}
236236

237-
/**
238-
* @dev Namehash function that operates on dot-separated names (not dns-encoded names)
239-
* @param name Name to hash
240-
* @param idx Index to start at
241-
* @param lastIdx Index to end at
242-
*/
237+
/// @dev Namehash function that operates on dot-separated names (not dns-encoded names)
238+
/// @param name Name to hash
239+
/// @param idx Index to start at
240+
/// @param lastIdx Index to end at
243241
function textNamehash(
244242
bytes memory name,
245243
uint256 idx,

contracts/dnsregistrar/RecordParser.sol

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import "../utils/BytesUtils.sol";
66
library RecordParser {
77
using BytesUtils for bytes;
88

9-
/**
10-
* @dev Parses a key-value record into a key and value.
11-
* @param input The input string
12-
* @param offset The offset to start reading at
13-
*/
9+
/// @dev Parses a key-value record into a key and value.
10+
/// @param input The input string
11+
/// @param offset The offset to start reading at
1412
function readKeyValue(
1513
bytes memory input,
1614
uint256 offset,

contracts/dnsregistrar/TLDPublicSuffixList.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ pragma solidity ^0.8.4;
33
import "../utils/BytesUtils.sol";
44
import "./PublicSuffixList.sol";
55

6-
/**
7-
* @dev A public suffix list that treats all TLDs as public suffixes.
8-
*/
6+
/// @dev A public suffix list that treats all TLDs as public suffixes.
97
contract TLDPublicSuffixList is PublicSuffixList {
108
using BytesUtils for bytes;
119

contracts/dnssec-oracle/DNSSECImpl.sol

Lines changed: 64 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -45,45 +45,37 @@ contract DNSSECImpl is DNSSEC, Owned {
4545
mapping(uint8 => Algorithm) public algorithms;
4646
mapping(uint8 => Digest) public digests;
4747

48-
/**
49-
* @dev Constructor.
50-
* @param _anchors The binary format RR entries for the root DS records.
51-
*/
48+
/// @dev Constructor.
49+
/// @param _anchors The binary format RR entries for the root DS records.
5250
constructor(bytes memory _anchors) {
5351
// Insert the 'trust anchors' - the key hashes that start the chain
5452
// of trust for all other records.
5553
anchors = _anchors;
5654
}
5755

58-
/**
59-
* @dev Sets the contract address for a signature verification algorithm.
60-
* Callable only by the owner.
61-
* @param id The algorithm ID
62-
* @param algo The address of the algorithm contract.
63-
*/
56+
/// @dev Sets the contract address for a signature verification algorithm.
57+
/// Callable only by the owner.
58+
/// @param id The algorithm ID
59+
/// @param algo The address of the algorithm contract.
6460
function setAlgorithm(uint8 id, Algorithm algo) public owner_only {
6561
algorithms[id] = algo;
6662
emit AlgorithmUpdated(id, address(algo));
6763
}
6864

69-
/**
70-
* @dev Sets the contract address for a digest verification algorithm.
71-
* Callable only by the owner.
72-
* @param id The digest ID
73-
* @param digest The address of the digest contract.
74-
*/
65+
/// @dev Sets the contract address for a digest verification algorithm.
66+
/// Callable only by the owner.
67+
/// @param id The digest ID
68+
/// @param digest The address of the digest contract.
7569
function setDigest(uint8 id, Digest digest) public owner_only {
7670
digests[id] = digest;
7771
emit DigestUpdated(id, address(digest));
7872
}
7973

80-
/**
81-
* @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.
82-
* Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.
83-
* @param input A list of signed RRSets.
84-
* @return rrs The RRData from the last RRSet in the chain.
85-
* @return inception The inception time of the signed record set.
86-
*/
74+
/// @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.
75+
/// Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.
76+
/// @param input A list of signed RRSets.
77+
/// @return rrs The RRData from the last RRSet in the chain.
78+
/// @return inception The inception time of the signed record set.
8779
function verifyRRSet(
8880
RRSetWithSignature[] memory input
8981
)
@@ -96,14 +88,12 @@ contract DNSSECImpl is DNSSEC, Owned {
9688
return verifyRRSet(input, block.timestamp);
9789
}
9890

99-
/**
100-
* @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.
101-
* Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.
102-
* @param input A list of signed RRSets.
103-
* @param now The Unix timestamp to validate the records at.
104-
* @return rrs The RRData from the last RRSet in the chain.
105-
* @return inception The inception time of the signed record set.
106-
*/
91+
/// @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.
92+
/// Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.
93+
/// @param input A list of signed RRSets.
94+
/// @param now The Unix timestamp to validate the records at.
95+
/// @return rrs The RRData from the last RRSet in the chain.
96+
/// @return inception The inception time of the signed record set.
10797
function verifyRRSet(
10898
RRSetWithSignature[] memory input,
10999
uint256 now
@@ -127,16 +117,14 @@ contract DNSSECImpl is DNSSEC, Owned {
127117
return (proof, inception);
128118
}
129119

130-
/**
131-
* @dev Validates an RRSet against the already trusted RR provided in `proof`.
132-
*
133-
* @param input The signed RR set. This is in the format described in section
134-
* 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature
135-
* data, followed by a series of canonicalised RR records that the signature
136-
* applies to.
137-
* @param proof The DNSKEY or DS to validate the signature against.
138-
* @param now The current timestamp.
139-
*/
120+
/// @dev Validates an RRSet against the already trusted RR provided in `proof`.
121+
///
122+
/// @param input The signed RR set. This is in the format described in section
123+
/// 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature
124+
/// data, followed by a series of canonicalised RR records that the signature
125+
/// applies to.
126+
/// @param proof The DNSKEY or DS to validate the signature against.
127+
/// @param now The current timestamp.
140128
function validateSignedSet(
141129
RRSetWithSignature memory input,
142130
bytes memory proof,
@@ -173,11 +161,9 @@ contract DNSSECImpl is DNSSEC, Owned {
173161
return rrset;
174162
}
175163

176-
/**
177-
* @dev Validates a set of RRs.
178-
* @param rrset The RR set.
179-
* @param typecovered The type covered by the RRSIG record.
180-
*/
164+
/// @dev Validates a set of RRs.
165+
/// @param rrset The RR set.
166+
/// @param typecovered The type covered by the RRSIG record.
181167
function validateRRs(
182168
RRUtils.SignedSet memory rrset,
183169
uint16 typecovered
@@ -213,15 +199,13 @@ contract DNSSECImpl is DNSSEC, Owned {
213199
}
214200
}
215201

216-
/**
217-
* @dev Performs signature verification.
218-
*
219-
* Throws or reverts if unable to verify the record.
220-
*
221-
* @param name The name of the RRSIG record, in DNS label-sequence format.
222-
* @param data The original data to verify.
223-
* @param proof A DS or DNSKEY record that's already verified by the oracle.
224-
*/
202+
/// @dev Performs signature verification.
203+
///
204+
/// Throws or reverts if unable to verify the record.
205+
///
206+
/// @param name The name of the RRSIG record, in DNS label-sequence format.
207+
/// @param data The original data to verify.
208+
/// @param proof A DS or DNSKEY record that's already verified by the oracle.
225209
function verifySignature(
226210
bytes memory name,
227211
RRUtils.SignedSet memory rrset,
@@ -245,12 +229,10 @@ contract DNSSECImpl is DNSSEC, Owned {
245229
}
246230
}
247231

248-
/**
249-
* @dev Attempts to verify a signed RRSET against an already known public key.
250-
* @param rrset The signed set to verify.
251-
* @param data The original data the signed set was read from.
252-
* @param proof The serialized DS or DNSKEY record to use as proof.
253-
*/
232+
/// @dev Attempts to verify a signed RRSET against an already known public key.
233+
/// @param rrset The signed set to verify.
234+
/// @param data The original data the signed set was read from.
235+
/// @param proof The serialized DS or DNSKEY record to use as proof.
254236
function verifyWithKnownKey(
255237
RRUtils.SignedSet memory rrset,
256238
RRSetWithSignature memory data,
@@ -275,13 +257,11 @@ contract DNSSECImpl is DNSSEC, Owned {
275257
revert NoMatchingProof(rrset.signerName);
276258
}
277259

278-
/**
279-
* @dev Attempts to verify some data using a provided key and a signature.
280-
* @param dnskey The dns key record to verify the signature with.
281-
* @param rrset The signed RRSET being verified.
282-
* @param data The original data `rrset` was decoded from.
283-
* @return True iff the key verifies the signature.
284-
*/
260+
/// @dev Attempts to verify some data using a provided key and a signature.
261+
/// @param dnskey The dns key record to verify the signature with.
262+
/// @param rrset The signed RRSET being verified.
263+
/// @param data The original data `rrset` was decoded from.
264+
/// @return True iff the key verifies the signature.
285265
function verifySignatureWithKey(
286266
RRUtils.DNSKEY memory dnskey,
287267
bytes memory keyrdata,
@@ -320,13 +300,11 @@ contract DNSSECImpl is DNSSEC, Owned {
320300
return algorithm.verify(keyrdata, data.rrset, data.sig);
321301
}
322302

323-
/**
324-
* @dev Attempts to verify a signed RRSET against an already known hash. This function assumes
325-
* that the record
326-
* @param rrset The signed set to verify.
327-
* @param data The original data the signed set was read from.
328-
* @param proof The serialized DS or DNSKEY record to use as proof.
329-
*/
303+
/// @dev Attempts to verify a signed RRSET against an already known hash. This function assumes
304+
/// that the record
305+
/// @param rrset The signed set to verify.
306+
/// @param data The original data the signed set was read from.
307+
/// @param proof The serialized DS or DNSKEY record to use as proof.
330308
function verifyWithDS(
331309
RRUtils.SignedSet memory rrset,
332310
RRSetWithSignature memory data,
@@ -362,14 +340,12 @@ contract DNSSECImpl is DNSSEC, Owned {
362340
revert NoMatchingProof(rrset.signerName);
363341
}
364342

365-
/**
366-
* @dev Attempts to verify a key using DS records.
367-
* @param keyname The DNS name of the key, in DNS label-sequence format.
368-
* @param dsrrs The DS records to use in verification.
369-
* @param dnskey The dnskey to verify.
370-
* @param keyrdata The RDATA section of the key.
371-
* @return True if a DS record verifies this key.
372-
*/
343+
/// @dev Attempts to verify a key using DS records.
344+
/// @param keyname The DNS name of the key, in DNS label-sequence format.
345+
/// @param dsrrs The DS records to use in verification.
346+
/// @param dnskey The dnskey to verify.
347+
/// @param keyrdata The RDATA section of the key.
348+
/// @return True if a DS record verifies this key.
373349
function verifyKeyWithDS(
374350
bytes memory keyname,
375351
RRUtils.RRIterator memory dsrrs,
@@ -405,13 +381,11 @@ contract DNSSECImpl is DNSSEC, Owned {
405381
return false;
406382
}
407383

408-
/**
409-
* @dev Attempts to verify a DS record's hash value against some data.
410-
* @param digesttype The digest ID from the DS record.
411-
* @param data The data to digest.
412-
* @param digest The digest data to check against.
413-
* @return True iff the digest matches.
414-
*/
384+
/// @dev Attempts to verify a DS record's hash value against some data.
385+
/// @param digesttype The digest ID from the DS record.
386+
/// @param data The data to digest.
387+
/// @param digest The digest data to check against.
388+
/// @return True if the digest matches.
415389
function verifyDSHash(
416390
uint8 digesttype,
417391
bytes memory data,

contracts/dnssec-oracle/Owned.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
pragma solidity ^0.8.4;
22

3-
/**
4-
* @dev Contract mixin for 'owned' contracts.
5-
*/
3+
/// @dev Contract mixin for 'owned' contracts.
64
contract Owned {
75
address public owner;
86

0 commit comments

Comments
 (0)