MetaMask / MetaMask/eth-token-tracker
Randomly wrong order of magnitude in balance tests
- Dominant language
- JavaScript
- Stars
- 81
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
[This](https://github.com/MetaMask/eth-token-tracker/actions/runs/9216240510/job/25356133723#step:5:69) occurs randomly in CI, and has been for some time. I can not say I'm sure this was ever not happening:
```
# HumanStandardToken balance changes are emitted
eth_call
eth_call
eth_call
eth_blockNumber
eth_call
not ok 11 initial balance loaded from last test
---
operator: equal
expected: '8.9'
actual: '890'
at: TokenTracker. (/home/runner/work/eth-token-tracker/eth-token-tracker/test/integration/human-standard-token.js:143:16)
stack: |-
Error: initial balance loaded from last test
at Test.assert [as _assert] (/home/runner/work/eth-token-tracker/eth-token-tracker/node_modules/tape/lib/test.js:312:48)
at Test.bound [as _assert] (/home/runner/work/eth-token-tracker/eth-token-tracker/node_modules/tape/lib/test.js:95:17)
at Test.strictEqual (/home/runner/work/eth-token-tracker/eth-token-tracker/node_modules/tape/lib/test.js:476:7)
at Test.bound [as equal] (/home/runner/work/eth-token-tracker/eth-token-tracker/node_modules/tape/lib/test.js:95:17)
at TokenTracker. (/home/runner/work/eth-token-tracker/eth-token-tracker/test/integration/human-standard-token.js:143:16)
at safeApply (/home/runner/work/eth-token-tracker/eth-token-tracker/node_modules/@metamask/safe-event-emitter/index.js:6:17)
at TokenTracker.emit (/home/runner/work/eth-token-tracker/eth-token-tracker/node_modules/@metamask/safe-event-emitter/index.js:54:13)
at TokenTracker._update (/home/runner/work/eth-token-tracker/eth-token-tracker/lib/index.js:106:10)
at TokenTracker.updateBalances (/home/runner/work/eth-token-tracker/eth-token-tracker/lib/index.js:62:12)
...
```
As can be seen in that CI run, the same test that fail in the Node.js 18 run passes on both 16 and 20. If retried, it will usually pass. Not currently clear if this is an actual bug or just an issue with the test setup.
#### Related
- #128
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with test/integration/human-standard-token.js around line 143 and review the failing CI run across Node.js 16, 18, and 20. Trace the balance update through lib/index.js, especially updateBalances and _update, and determine whether the failure is caused by the test setup or token balance handling. Done means the cause is identified and the integration test reliably expects the correct balance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- blockchain, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100