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(contracts): remove withdrawal threshold and add withdrawToL2 #232

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

0xHansLee
Copy link
Contributor

@0xHansLee 0xHansLee commented Dec 8, 2023

This is based on v1.0.2.

2 changes have been made:

  • remove threshold of reward withdrawal
  • withdraw reward to L2

I made withdrawToL2 as virtual function to make compatible with the existing ValidatorRewardVault contract.

Let's keep in mind that after merging, the commits in this PR should be cherry-picked to v1.1.0 as well.

@0xHansLee 0xHansLee requested a review from a team December 8, 2023 02:31
@0xHansLee 0xHansLee self-assigned this Dec 8, 2023
function withdrawToL2() external virtual {
uint256 amount = _processWithdrawal();

bool success = SafeCall.call(msg.sender, gasleft(), amount, bytes(""));
Copy link
Contributor

@kangsorang kangsorang Dec 8, 2023

Choose a reason for hiding this comment

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

This is just a curiosity. It doesn't seem to require any modification.
Can't we just use call instead of safecall?
It seems like it would be cheaper on gas, even though regular call is marginal.
I'm just wondering if it's more codewise meaningful or what your intentions are.

Suggested change
bool success = SafeCall.call(msg.sender, gasleft(), amount, bytes(""));
(bool success,) = RECIPIENT.call{ value: amount }(hex"");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, but assembly call is better in that it does not copy return data as written in SafeCall.sol.
Maybe @Pangssu can answer this?

Copy link
Contributor

Choose a reason for hiding this comment

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

In this project, transfer is also using SafeCall, so it makes sense to unify them.

@@ -134,7 +134,7 @@ contract ValidatorRewardVault is FeeVault, Semver {
* @notice Withdraws all of the sender's balance to L2.
* Reverts if the balance is less than the minimum withdrawal amount.
*/
function withdrawToL2() external {
function withdrawToL2() external override {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you change the function name processWithdrawal to _processWithdrawal because it's internal function?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well,, we don't use underscore in the internal function name, only private function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that underscore is used in internal function in general. So i'll keep this way.

@0xHansLee 0xHansLee force-pushed the feat/remote-vault-threshold branch from a1fd885 to 3229930 Compare December 8, 2023 05:26
@0xHansLee 0xHansLee requested a review from seolaoh December 8, 2023 05:26
Copy link
Contributor

@seolaoh seolaoh left a comment

Choose a reason for hiding this comment

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

LGTM

@0xHansLee 0xHansLee merged commit d094ac6 into release/v1.0.3-base Dec 11, 2023
@0xHansLee 0xHansLee deleted the feat/remote-vault-threshold branch December 11, 2023 03:19
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.

4 participants