Skip to content

Commit 7623e4b

Browse files
committed
Improve VestingWallet's constructor and RSA.pkcs1Sha256 documentation (#5229)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
1 parent 6c73fcd commit 7623e4b

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

contracts/finance/VestingWallet.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ contract VestingWallet is Context, Ownable {
3737
uint64 private immutable _duration;
3838

3939
/**
40-
* @dev Sets the sender as the initial owner, the beneficiary as the pending owner, the start timestamp and the
41-
* vesting duration of the vesting wallet.
40+
* @dev Sets the beneficiary (owner), the start timestamp and the vesting duration (in seconds) of the vesting
41+
* wallet.
4242
*/
4343
constructor(address beneficiary, uint64 startTimestamp, uint64 durationSeconds) payable Ownable(beneficiary) {
4444
_start = startTimestamp;

contracts/finance/VestingWalletCliff.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ abstract contract VestingWalletCliff is VestingWallet {
1717
error InvalidCliffDuration(uint64 cliffSeconds, uint64 durationSeconds);
1818

1919
/**
20-
* @dev Set the start timestamp of the vesting wallet cliff.
20+
* @dev Set the duration of the cliff, in seconds. The cliff starts vesting schedule (see {VestingWallet}'s
21+
* constructor) and ends `cliffSeconds` later.
2122
*/
2223
constructor(uint64 cliffSeconds) {
2324
if (cliffSeconds > duration()) {

contracts/utils/cryptography/RSA.sol

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ library RSA {
2727

2828
/**
2929
* @dev Verifies a PKCSv1.5 signature given a digest according to the verification
30-
* method described in https://datatracker.ietf.org/doc/html/rfc8017#section-8.2.2[section 8.2.2 of RFC8017] with support
31-
* for explicit or implicit NULL parameters in the DigestInfo (no other optional parameters are supported).
30+
* method described in https://datatracker.ietf.org/doc/html/rfc8017#section-8.2.2[section 8.2.2 of RFC8017] with
31+
* support for explicit or implicit NULL parameters in the DigestInfo (no other optional parameters are supported).
3232
*
33-
* IMPORTANT: For security reason, this function requires the signature and modulus to have a length of at least 2048 bits.
34-
* If you use a smaller key, consider replacing it with a larger, more secure, one.
33+
* IMPORTANT: For security reason, this function requires the signature and modulus to have a length of at least
34+
* 2048 bits. If you use a smaller key, consider replacing it with a larger, more secure, one.
3535
*
36-
* WARNING: PKCS#1 v1.5 allows for replayability given the message may contain arbitrary optional parameters in the
37-
* DigestInfo. Consider using an onchain nonce or unique identifier to include in the message to prevent replay attacks.
36+
* WARNING: This verification algorithm doesn't prevent replayability. If called multiple times with the same
37+
* digest, public key and (valid signature), it will return true every time. Consider including an onchain nonce or
38+
* unique identifier in the message to prevent replay attacks.
3839
*
3940
* @param digest the digest to verify
4041
* @param s is a buffer containing the signature
@@ -79,7 +80,7 @@ library RSA {
7980
// - PS is padding filled with 0xFF
8081
// - DigestInfo ::= SEQUENCE {
8182
// digestAlgorithm AlgorithmIdentifier,
82-
// [optional algorithm parameters]
83+
// [optional algorithm parameters] -- not currently supported
8384
// digest OCTET STRING
8485
// }
8586

0 commit comments

Comments
 (0)