OriginProtocol / OriginProtocol/origin-dollar

Fix rounding issue in OUSD redeemAll unit test

Open
#1,495 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug contracts
Dominant language
Solidity
Stars
152
Forks
115
Avg merge
3d 20h
Merged PRs (30d)
17

Description

To get the unit test passing, the last assertion in the redeemAll unit tests has been commented out. This issue is to get to the bottom of the following error.

  1) Vault Redeem
       Should have redeemAll result in zero balance:

      AssertionError: Expected "1" to be equal 0
      + expected - actual

       {
      -  "_hex": "0x00"
      +  "_hex": "0x01"
         "_isBigNumber": true
       }
      
      at Proxy.<anonymous> (test/helpers.js:56:28)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at runNextTicks (node:internal/process/task_queues:64:3)
      at listOnTimeout (node:internal/timers:538:9)
      at processTimers (node:internal/timers:512:7)
      at Context.<anonymous> (test/vault/redeem.js:431:5)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test/vault/redeem.js around line 431 and inspect the assertion helper at test/helpers.js:56. Run the redeemAll unit test and trace why the final balance is 1 instead of 0. Done means the underlying rounding issue is addressed and the final assertion can be restored and passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.