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

Vault shares might become too big and cause overflow after many claims #389

Open
ben-kaufman opened this issue Oct 28, 2022 · 0 comments
Open
Labels
known-issue wontfix This will not be worked on

Comments

@ben-kaufman
Copy link
Collaborator

After many claims from the vault, depositing might reach a situation where even a small deposit mints too many shares, causing an overflow either in the RewardController (on deposit), or even eventually in the deposit function itself.

The scenario may look like this, and will revert after 62 iterations:

it("Overflow", async () => {
    await setUpGlobalVars(accounts);

    for (let i = 0; i < 100; i++) {
      var staker = accounts[4];

      await stakingToken.approve(vault.address, web3.utils.toWei("1"), {
        from: staker,
      });

      await stakingToken.mint(staker, web3.utils.toWei("1"));

      console.log(i);

      await vault.deposit(web3.utils.toWei("1"), staker, { from: staker });

      assert.equal(await hatToken.balanceOf(staker), 0);
      await utils.increaseTime(7 * 24 * 3600);
      await advanceToSafetyPeriod();
      let tx = await vault.submitClaim(
        accounts[2],
        8000,
        "description hash",
        {
          from: accounts[1],
        }
      );

      let claimId = tx.logs[0].args._claimId;
      await utils.increaseTime(60 * 60 * 24);
      await vault.approveClaim(claimId, 8000);
    }
  });
@jellegerbrandy jellegerbrandy added the wontfix This will not be worked on label Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
known-issue wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants