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

Fix integration tests after v1.1.0 release #718

Merged
merged 8 commits into from
Sep 4, 2024

Conversation

nkuba
Copy link
Member

@nkuba nkuba commented Aug 28, 2024

Depends on: #717

In this PR we fix integration tests by updating the forked blocked number to reflect the latest version of deployed contracts.

We update the integration tests fixture function to upgrade the contracts on the forked network to the latest code from the development branch, so the tests are testing the code we are implementing.

Copy link

netlify bot commented Aug 28, 2024

Deploy Preview for acre-dapp-testnet canceled.

Name Link
🔨 Latest commit 3a25346
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp-testnet/deploys/66d6f1978ce86d000868f2b3

Copy link

netlify bot commented Aug 28, 2024

Deploy Preview for acre-dapp canceled.

Name Link
🔨 Latest commit 3a25346
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp/deploys/66d6f196fabff2000876e824

@nkuba nkuba changed the base branch from main to mezo-allocator-withdraw-improvements August 28, 2024 13:46
@nkuba nkuba changed the title Solidity 1.1.0 fix integration tests Fix integration tests after v1.1.0 release Aug 28, 2024
@nkuba nkuba self-assigned this Aug 28, 2024
r-czajkowski
r-czajkowski previously approved these changes Aug 29, 2024
The allowance was set to 1000 stBTC in the initial deployment to mainnet.
We update block number for mainnet fork to the block after the latest
version of contracts deployment.
We also update the details of tBTC redemption transaction to reflect the
current state of the mainnet tBTC redemption wallets.
These are the latest artifacts of MezoPortal for the mainnet and sepolia networks.
Since we're developing changes to the stBTC and MezoAllocator contracts,
we need to upgrade them in the forked network to reflect the latest
development changes on the forked network, to simulate the upgrade that
will take place in the future.
We update the integration tests to reflect the latest changes to the MezoAllocator
contract from 1b95419
@nkuba nkuba force-pushed the solidity-1.1.0-fix-integration-tests branch from c74f22e to fd3a768 Compare August 30, 2024 12:25
The tests were updated to reflect the changes in the MezoAllocator contract
introduced in 1b9ba17 and 1b95419.
r-czajkowski added a commit that referenced this pull request Sep 3, 2024
Depends on: #716

In this PR we introduce a couple of improvements to the MezoAllocator
contract related to withdrawals from the Mezo Portal.

### Check if the withdrawal amount exceeds the deposit balance
(1b95419)

Here we improve the withdrawal function to check if the withdrawal
amount exceeds the deposit balance.
If the withdrawal amount exceeds the deposit balance, the function will
revert with a custom error message.
Before these changes, since the Portal contract changed the handling of
partial and full withdrawals the withdrawal function reverted on
`depositBalance -= uint96(amount);` with:
```
panic code 0x11 (Arithmetic operation overflowed outside of an unchecked block)
```

### Include unallocated MezoAllocator balance in `withdraw` and
`releaseDeposit` (1b9ba17,
0440580)

In bb42bce we included the current
balance of the MezoAllocator contract in the `totalAssets` function
result. The balance can come from a rewards transfer or any donation.

We haven't considered this balance in the `withdraw` function, which
could lead to blocking the last user withdrawing the funds, as the
balance of assets owned by them calculated based on `totalAssets`
function, couldn't be fully withdraw due to unallocated balance being
stuck in the `MezoAllocator` contract. In
1b9ba17 we introduce possibility to
withdraw funds from the unallocated contract balance.

For the `releaseDeposit` function we could face a problem when the Mezo
Portal deposit is already released but some tokens were donated to the
MezoAllocator contract, since the `Porta.withdraw` function would be
reverting as there is no deposit, we won't be able to transfer the
unallocated funds in the same call. We fixed it in
0440580.

> [!IMPORTANT]  
> Please ignore failing integration tests, as these will be fixed in
#718
Base automatically changed from mezo-allocator-withdraw-improvements to main September 3, 2024 09:55
@r-czajkowski r-czajkowski dismissed their stale review September 3, 2024 09:55

The base branch was changed.

@nkuba nkuba marked this pull request as ready for review September 3, 2024 11:22
@r-czajkowski r-czajkowski merged commit 40ef7cc into main Sep 4, 2024
28 checks passed
@r-czajkowski r-czajkowski deleted the solidity-1.1.0-fix-integration-tests branch September 4, 2024 06:51
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