Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback from PRB on V2.2 #883

Merged
merged 28 commits into from
Apr 9, 2024
Merged

Feedback from PRB on V2.2 #883

merged 28 commits into from
Apr 9, 2024

Conversation

PaulRBerg
Copy link
Member

@PaulRBerg PaulRBerg commented Apr 5, 2024

I spent a few days reviewing the staging branch - good job @sablier-labs/solidity!

Closes #870, #871, #878, #879, and #880.

chore: improve wording comments
chore: misc improvements and renames
docs: capitalize ID
refactor: improve variable names
refactor: separate max segment and tranche counts
refactor: use for loop instead of while
perf: optimize "_update" by testing "_isTransferable" last
test: apply "inheritdoc"
test: define "withdrawAmount" once
test: improve function names
test: improve writing in comments
test: set the license to "UNLICENSED"
docs: improve writing in NatSpec
refactor: rename "sablierAddress" to "sablierStringified"
docs: improve writing in custom errors' NatSpec
docs: improve writing in NatSpec
test: apply "seconds" keyword
chore: improve writing in comments
test: bring back test in "createWithDurations"
test: close #880
test: fuzz cliff time as zero
test: improve BTs and associated modifiers
Copy link
Member

@smol-ninja smol-ninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic review 👏. Those are really good changes. I like using the term distribution instead of streaming.

I've added two new commits (e88ef6e and bda5c85) to address some minor changes.

src/SablierV2LockupDynamic.sol Outdated Show resolved Hide resolved
test/mocks/erc20/ERC20Mock.sol Outdated Show resolved Hide resolved
@andreivladbrg
Copy link
Member

andreivladbrg commented Apr 6, 2024

Thanks for the review PRB!

Haven't finished reviewing yet, but I want to point out one thing to get things move faster, I guess this was not intentional @PaulRBerg:

/// @dev Stream tranches mapped by stream IDs. This complements the `_streams` mapping in {SablierV2Lockup}.
mapping(uint256 id => uint40 cliff) internal _cliffs;
mapping(uint256 id => LockupTranched.Tranche[] tranches) internal _tranches;

Can you confirm, please, that cliffs mapping should not be Tranched contract?

Doing some changes locally, so I will push commit once I finish.

chore: fix segments reference
fix: mistaken "cliffs" array
@PaulRBerg
Copy link
Member Author

Thanks for the counter-review, guys.

Can you confirm, please, that cliffs mapping should not be Tranched contract?

Ofc not. I have accidentally copy-pasted it there. Good catch.

Copy link
Member

@andreivladbrg andreivladbrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great findings and suggestions PRB. Short form for _create is better, capitalizing the ID improves readability and also like more and prefer the naming of the functions in the Helpers library now. I remember using the same terminology when the checks were initially moved to a separate library.

script/Base.s.sol Show resolved Hide resolved
script/GenerateSVG.s.sol Show resolved Hide resolved
src/SablierV2LockupDynamic.sol Show resolved Hide resolved
src/SablierV2LockupDynamic.sol Outdated Show resolved Hide resolved
src/SablierV2LockupTranched.sol Outdated Show resolved Hide resolved
src/interfaces/ISablierV2LockupLinear.sol Outdated Show resolved Hide resolved
src/types/DataTypes.sol Outdated Show resolved Hide resolved
src/types/DataTypes.sol Outdated Show resolved Hide resolved
src/types/DataTypes.sol Outdated Show resolved Hide resolved
src/types/DataTypes.sol Outdated Show resolved Hide resolved
andreivladbrg and others added 2 commits April 8, 2024 13:39
docs: improve wording in comments
perf: use "unchecked" for tranche calculations
refactor: rename variables
@PaulRBerg
Copy link
Member Author

PaulRBerg commented Apr 8, 2024

Thanks for the kind words, @andreivladbrg.

I have addressed most of your feedback with my latest commit.

Are we good to merge now? edit: nevermind, I am due to review two more PRs.

The precompile tests are failing, but that's because of #886.

chore: update "filter_paths"
docs: improve writing in comments
refactor: include "streamId" in "SablierV2Lockup_WithdrawToZeroAddress"
refactor: alphabetical order
@PaulRBerg
Copy link
Member Author

PaulRBerg commented Apr 8, 2024

Ok guys, I reviewed everything.

Whenever you're ready, we can merge this.

P.S. let's squash before merging, please.

slither.config.json Outdated Show resolved Hide resolved
@PaulRBerg
Copy link
Member Author

@andreivladbrg @smol-ninja can you approve so we can merge?

@PaulRBerg
Copy link
Member Author

I've also bumped PRBMath (see context here: PaulRBerg/prb-math#225).

@andreivladbrg andreivladbrg merged commit e9fcd6d into staging Apr 9, 2024
9 checks passed
@PaulRBerg PaulRBerg deleted the prb-feedback branch April 10, 2024 14:14
andreivladbrg added a commit that referenced this pull request Jul 3, 2024
* docs: improve wording in NatSpec

chore: improve wording comments
chore: misc improvements and renames
docs: capitalize ID
refactor: improve variable names
refactor: separate max segment and tranche counts
refactor: use for loop instead of while

* build: bump OpenZeppelin to v5.0.2

* docs: improve writing in NatSpec

perf: optimize "_update" by testing "_isTransferable" last
test: apply "inheritdoc"
test: define "withdrawAmount" once
test: improve function names
test: improve writing in comments
test: set the license to "UNLICENSED"

* refactor: rename "streamingModel" to "sablierModel"

docs: improve writing in NatSpec
refactor: rename "sablierAddress" to "sablierStringified"

* refactor: rename internal create function

* chore: singular Check, Effect, Interaction

docs: improve writing in custom errors' NatSpec

* perf: close #878

docs: improve writing in NatSpec
test: apply "seconds" keyword

* refactor: reorder checks

chore: improve writing in comments
test: bring back test in "createWithDurations"
test: close #880
test: fuzz cliff time as zero
test: improve BTs and associated modifiers

* test: remove unused import

* test: include map symbol test for lockup tranched
docs: _create in NatSpec

* revert: bring back GPL V3 license in mocks

chore: fix segments reference
fix: mistaken "cliffs" array

* refactor: update precompiles

* test: reuse "createWithTimestamps" modifiers

* test: revert max counts to 500

* test: use lockup object

* style: correct bad formated natspec

* refactor: rename "currentTime" to "blockTimestamp"

docs: improve wording in comments
perf: use "unchecked" for tranche calculations
refactor: rename variables

* docs: improve writing in NatSpec

* refactor: order functions and fields alphabetically

* refactor: rename variable

* docs: capitalize IDs

chore: update "filter_paths"
docs: improve writing in comments
refactor: include "streamId" in "SablierV2Lockup_WithdrawToZeroAddress"
refactor: alphabetical order

* build: bump sphinx

* test: remove ERC721Mock and use forge mock

* test: update precompiles

* chore: say "block timestamp" in comments

* refactor: update gas snapshot

test: replace "maxUint40" with "maxOfThree"

* chore: add trailing slash

* build: bump PRBMath

---------

Co-authored-by: smol-ninja <[email protected]>
Co-authored-by: andreivladbrg <[email protected]>
andreivladbrg added a commit that referenced this pull request Jul 3, 2024
* docs: improve wording in NatSpec

chore: improve wording comments
chore: misc improvements and renames
docs: capitalize ID
refactor: improve variable names
refactor: separate max segment and tranche counts
refactor: use for loop instead of while

* build: bump OpenZeppelin to v5.0.2

* docs: improve writing in NatSpec

perf: optimize "_update" by testing "_isTransferable" last
test: apply "inheritdoc"
test: define "withdrawAmount" once
test: improve function names
test: improve writing in comments
test: set the license to "UNLICENSED"

* refactor: rename "streamingModel" to "sablierModel"

docs: improve writing in NatSpec
refactor: rename "sablierAddress" to "sablierStringified"

* refactor: rename internal create function

* chore: singular Check, Effect, Interaction

docs: improve writing in custom errors' NatSpec

* perf: close #878

docs: improve writing in NatSpec
test: apply "seconds" keyword

* refactor: reorder checks

chore: improve writing in comments
test: bring back test in "createWithDurations"
test: close #880
test: fuzz cliff time as zero
test: improve BTs and associated modifiers

* test: remove unused import

* test: include map symbol test for lockup tranched
docs: _create in NatSpec

* revert: bring back GPL V3 license in mocks

chore: fix segments reference
fix: mistaken "cliffs" array

* refactor: update precompiles

* test: reuse "createWithTimestamps" modifiers

* test: revert max counts to 500

* test: use lockup object

* style: correct bad formated natspec

* refactor: rename "currentTime" to "blockTimestamp"

docs: improve wording in comments
perf: use "unchecked" for tranche calculations
refactor: rename variables

* docs: improve writing in NatSpec

* refactor: order functions and fields alphabetically

* refactor: rename variable

* docs: capitalize IDs

chore: update "filter_paths"
docs: improve writing in comments
refactor: include "streamId" in "SablierV2Lockup_WithdrawToZeroAddress"
refactor: alphabetical order

* build: bump sphinx

* test: remove ERC721Mock and use forge mock

* test: update precompiles

* chore: say "block timestamp" in comments

* refactor: update gas snapshot

test: replace "maxUint40" with "maxOfThree"

* chore: add trailing slash

* build: bump PRBMath

---------

Co-authored-by: smol-ninja <[email protected]>
Co-authored-by: andreivladbrg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants