Commit 6466ada
authored
docs: add NatSpec to StdMath and StdError (#845)
Part of #653. Two more of the files listed in the NatSpec docs
checklist.
## StdMath.sol
Added \`@notice\`, \`@param\`, and \`@return\` tags to the library and
all five internal functions:
- \`abs(int256)\`
- \`delta(uint256, uint256)\`
- \`delta(int256, int256)\`
- \`percentDelta(uint256, uint256)\`
- \`percentDelta(int256, int256)\`
I did not rename \`INT256_MIN\` to \`_INT256_MIN\` even though the issue
mentions the underscore-prefix convention for private variables. The
already-merged StdAssertions.sol work (PR #666 / StdInvariant) left its
private constants without the underscore prefix (for example
\`FAILED_SLOT\`), so I matched that pattern to keep this PR purely
additive. Happy to apply the rename in a follow-up or in this PR if you
prefer the underscore convention going forward. Let me know which way
you want to settle it.
## StdError.sol
Added \`@notice\` to each of the nine public panic-code constants
describing what Solidity panic it corresponds to. Panic codes
cross-checked against the Solidity docs.
## What is not in this PR
- No logic changes
- No interface changes
- No file reordering (internal up, private down was also listed in #653
- can do that in a follow-up if you want)
- No tests touched
## Testing
I do not have Foundry set up on this machine so I have not run \`forge
fmt --check\` or \`forge test\` locally. The diff is 38 insertions and 0
deletions, all inside NatSpec comment blocks above existing
declarations, so behavior is unchanged. CI should cover the formatting
and test pass. If CI flags anything I will fix it in this branch.
Happy to split this into two PRs (one per file) if that is easier to
review.1 parent f494b0c commit 6466ada
2 files changed
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
| 12 | + | |
| 13 | + | |
8 | 14 | | |
| 15 | + | |
| 16 | + | |
9 | 17 | | |
| 18 | + | |
| 19 | + | |
10 | 20 | | |
| 21 | + | |
| 22 | + | |
11 | 23 | | |
| 24 | + | |
| 25 | + | |
12 | 26 | | |
| 27 | + | |
| 28 | + | |
13 | 29 | | |
| 30 | + | |
| 31 | + | |
14 | 32 | | |
15 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
19 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
20 | 32 | | |
21 | 33 | | |
22 | 34 | | |
| |||
28 | 40 | | |
29 | 41 | | |
30 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
31 | 47 | | |
32 | 48 | | |
33 | 49 | | |
| |||
36 | 52 | | |
37 | 53 | | |
38 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
39 | 59 | | |
40 | 60 | | |
41 | 61 | | |
| |||
0 commit comments