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

feat: add batch function #1070

Merged
merged 4 commits into from
Nov 1, 2024
Merged

feat: add batch function #1070

merged 4 commits into from
Nov 1, 2024

Conversation

andreivladbrg
Copy link
Member

@andreivladbrg andreivladbrg commented Oct 23, 2024

Closes #1053

@smol-ninja
Copy link
Member

smol-ninja commented Oct 23, 2024

Thank you for the PR Andrei.

I'd like to make a small suggestion. When a PR depends on another PR, can we please have the base branch set as the branch from another PR? This makes it easier to review and work with a child PR asynchronously. I know that by changing the URL I can see the diff but I use the "viewed checkbox" feature in Github UI to track which files have been reviewed and which are left to be reviewed.

To be more explicit, In the description, it can be mentioned that this PR requires this another PR to be merged first.

Does that make sense?

@andreivladbrg andreivladbrg force-pushed the feat/batch branch 2 times, most recently from d8ed354 to 0e35fc1 Compare October 25, 2024 14:42
@andreivladbrg andreivladbrg changed the base branch from staging to test/common-modifiers October 25, 2024 14:42
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.

Good work on this PR. Left a few comments below:

bytes[] memory calls = new bytes[](1);
calls[0] = abi.encodeCall(dai.balanceOf, (users.recipient));

Batch(address(lockup)).batch(calls);
Copy link
Member

@smol-ninja smol-ninja Oct 31, 2024

Choose a reason for hiding this comment

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

Missing expectRevert statement.

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, curious why the test isn't failing then, i guess the branch should say it should do nothing

Copy link
Member

Choose a reason for hiding this comment

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

Did you figure out why its not failing?

Copy link
Member

@smol-ninja smol-ninja Oct 31, 2024

Choose a reason for hiding this comment

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

It did not revert because dai.balanceOf encodes to balanceOf(address) selector which is a valid function in ERC721 contract. I fixed it in 5713f40.


I also want to mention that because the test was not failing, changing branch to it should do nothing should not be a solution. This is an example of white box testing where you tried to curve fit the test to made them pass. Referring to my discussion on white box testing vs black box testing, in a black box testing, we wont change the test but rather investigate the internal logic in such cases.

I look forward to see your comments on my discussion.

src/core/abstracts/Batch.sol Show resolved Hide resolved
test/core/integration/concrete/lockup/batch/batch.t.sol Outdated Show resolved Hide resolved
@andreivladbrg
Copy link
Member Author

@smol-ninja just pushed a commit to addres your feedback, lmk if it looks good

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.

Feel free to merge it after merging #1058.

Base automatically changed from test/common-modifiers to staging November 1, 2024 12:55
@smol-ninja smol-ninja merged commit ae2963d into staging Nov 1, 2024
9 checks passed
@smol-ninja smol-ninja deleted the feat/batch branch November 1, 2024 13:42
andreivladbrg added a commit that referenced this pull request Jan 27, 2025
* feat: add batch contract

test: add minimal tests for batch function

* shub feedback

* test: fix test for batch

* fix: correct import of Batch contract

---------

Co-authored-by: smol-ninja <[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.

2 participants