Skip to content

Skip bad withdrawals#29

Merged
dapplion merged 2 commits intoib-withdrawal-contract-partfrom
withdrawals-skip-bad
Mar 16, 2023
Merged

Skip bad withdrawals#29
dapplion merged 2 commits intoib-withdrawal-contract-partfrom
withdrawals-skip-bad

Conversation

@dapplion
Copy link
Copy Markdown
Member

@dapplion dapplion commented Feb 25, 2023

Skip bad withdrawals to ensure that a revert can only be triggered by insolvency of stake tokens

@dapplion dapplion requested a review from Barichek February 25, 2023 03:48
) internal returns (bool success) {
// Skip withdrawal that burns tokens to avoid a revert condition
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/dad73159df3d3053c72b5e430fa8164330f18068/contracts/token/ERC20/ERC20.sol#L278
if (_receiver == address(0)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why this is necessary? Burn of mGNO token will be done with account equal to address of withdrawals contract.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

}

// Skip withdrawal for 0 tokens
if (_amount == 0) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it cause the process to revert? If not, possibly we should process it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

With current tokens there's no condition that can cause a revert. However what's the point of processing a withdrawal for 0 value? A system transaction does not have any other result than a change in state which won't happen

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree that no state changes will happen.
My suggestion was only that we can remove this extra conditions if they do not change anything (except of burned gas).

@dapplion dapplion merged commit 1df67a1 into ib-withdrawal-contract-part Mar 16, 2023
@dapplion dapplion deleted the withdrawals-skip-bad branch March 30, 2023 01:47
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