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

Merge "SablierV2Linear" and "SablierV2Cliff" #87

Merged
merged 4 commits into from
Jun 26, 2022

Conversation

PaulRBerg
Copy link
Member

Merges the two contracts by keeping the SablierV2Linear nomenclature.

Closes #86.

Depends upon #75, #78, #79, #82 and #83 being merged first.

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.

When contract.create is used in the test function, that should be createdStream. When the streamId from the setUp function is used in the test function, that should be actualStream.

src/SablierV2Linear.sol Outdated Show resolved Hide resolved
src/interfaces/ISablierV2Linear.sol Outdated Show resolved Hide resolved
src/interfaces/ISablierV2Linear.sol Outdated Show resolved Hide resolved
test/unit/sablier-v2-linear/create/create.t.sol Outdated Show resolved Hide resolved
test/unit/sablier-v2-linear/create/create.t.sol Outdated Show resolved Hide resolved
test/unit/sablier-v2-pro/SablierV2ProUnitTest.t.sol Outdated Show resolved Hide resolved
@andreivladbrg
Copy link
Member

andreivladbrg commented Jun 23, 2022

Issue

The actual SablierV2Linear contract is basically the former SablierV2Cliff. Comparing the gas report from this PR with the one I did here #47 (comment), I am surprised to find out that the gas cost for the create and withdraw functions has increased, but for the cancel function has decreased, as you can see:

Gas cost

Linear Avg Median Max
cancel 33184 47612 55987
create 188803 202149 209449
createWithDuration 209407 209407 209407
withdraw 46043 59229 63579

@PaulRBerg
Copy link
Member Author

When contract.create is used in the test function, that should be createdStream. When the streamId from the setUp function is used in the test function, that should be actualStream.

I see where you're coming from, but I suggest sticking with actualStream, because that would mean more consistency across the board. Even if the stream is created, in the context of running a test with assertEq, that is still an "actual" stream.

@PaulRBerg
Copy link
Member Author

I was surprised to find out that the gas cost for the create and withdraw functions has increased, but for the cancel function has decreased.

This is why I suggested to you to reference the commit that you had used for generating the gas table. The best way to ascertain if the gas costs really increased is to reapply the changes made in this PR on top of that commit specifically - but of course this would be a hassle so not worth it to do.

There's a host of reasons for why the gas cost may have increased in the meantime - we may have added more tests, or we may have increased the complexity of the tests, or the REVM might have changes some of its operational gas costs.

I wouldn't dwell on this. There's a lot of benefits in merging the two contracts.

@andreivladbrg
Copy link
Member

There's a host of reasons for why the gas cost may have increased in the meantime - we may have added more tests, or we may have increased the complexity of the tests, or the REVM might have changes some of its operational gas costs.

I haven't checked anything, but I am pretty sure it's about the complexity of the tests.

PaulRBerg and others added 4 commits June 26, 2022 13:21
test: rename actualStream to createdStream
test: swap order of expected + actual/created args
@PaulRBerg PaulRBerg force-pushed the refactor/merge-linear-cliff branch from 4da6791 to 2bb526c Compare June 26, 2022 10:22
@PaulRBerg PaulRBerg merged commit 9b08305 into main Jun 26, 2022
@PaulRBerg PaulRBerg deleted the refactor/merge-linear-cliff branch June 26, 2022 10:23
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.

Merge "SablierV2Linear" and "SablierV2Cliff"
2 participants