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

[Certora][M-07] Vaibhav/certora/fix steth swap #163

Merged
merged 11 commits into from
Nov 19, 2024

Conversation

vvalecha519
Copy link
Contributor

No description provided.

@vvalecha519 vvalecha519 changed the base branch from master to staging-2.5 September 11, 2024 06:00
Copy link
Contributor

@jtfirek jtfirek left a comment

Choose a reason for hiding this comment

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

Did you check the size of the contract after the additions? This contract is right on the cusp of being oversized

@jtfirek
Copy link
Contributor

jtfirek commented Sep 11, 2024

It also looks like your changes have causes some liquifier unit tests to fail:

[FAIL. Reason: assertion failed: 156654501206475822684323 !~= 156654858297908075184322 (max delta: 1, real delta: 357091432252499999)] test_swapEEthForStEth_mainnet() (gas: 60206895)
[FAIL. Reason: assertion failed: 156654501206475822684323 !~= 156654858297908075184322 (max delta: 1, real delta: 357091432252499999)] test_withdrawEEth() (gas: 60206911)

if (_amount > liquidityPool.eETH().balanceOf(msg.sender)) revert NotEnoughBalance();

IERC20(address(liquidityPool.eETH())).safeTransferFrom(msg.sender, address(this), _amount);
bool isWhitelistedSwapper = roleRegistry.hasRole(EETH_STETH_SWAPPER, msg.sender);
Copy link
Contributor

@jtfirek jtfirek Sep 11, 2024

Choose a reason for hiding this comment

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

Can you remove this line and include the hasRole check in the if statement like so:

if (!roleRegistry.hasRole(EETH_STETH_SWAPPER, msg.sender)) {
            fees = _amount * feeSwappingEETHToSTETH / 10**18;
}

This removes an unnecessary line of code and is consistent with the pattern we have already established in the codebase

src/Liquifier.sol Outdated Show resolved Hide resolved
@vvalecha519
Copy link
Contributor Author

Did you check the size of the contract after the additions? This contract is right on the cusp of being oversized

Yes met the requirement

@@ -242,7 +245,7 @@ contract Liquifier is Initializable, UUPSUpgradeable, OwnableUpgradeable, Pausab
}

// Swap Liquifier's eETH for ETH from the liquidity pool and send it back to the liquidity pool
function withdrawEEth(uint256 amount) external {
function withdrawEEth(uint256 amount) public {
Copy link
Contributor

Choose a reason for hiding this comment

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

why public? i think you can leave it as external? :)


IERC20(address(liquidityPool.eETH())).safeTransferFrom(msg.sender, address(this), _amount);
IERC20(address(lido)).safeTransfer(msg.sender, _amount);
liquidityPool.withdraw(address(liquidityPool), _amount-1);
Copy link
Contributor

Choose a reason for hiding this comment

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

what would be the clean way to handle -1?
We can do diff of stETH balance before/after its transfer and transfer that amount

Comment on lines +471 to +472
vm.startPrank(superAdmin);
roleRegistry.grantRole(liquifierInstance.EETH_STETH_SWAPPER(), bob);
Copy link
Contributor

Choose a reason for hiding this comment

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

need to test the case where it reverts without the role

@vvalecha519 vvalecha519 changed the title Vaibhav/certora/fix steth swap [M-07] Vaibhav/certora/fix steth swap Oct 15, 2024
@seongyun-ko seongyun-ko changed the title [M-07] Vaibhav/certora/fix steth swap [Certora][M-07] Vaibhav/certora/fix steth swap Nov 4, 2024
Copy link
Contributor

@seongyun-ko seongyun-ko left a comment

Choose a reason for hiding this comment

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

lgtm

@jtfirek jtfirek merged commit aff0349 into staging-2.5 Nov 19, 2024
1 check failed
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