Skip to content

bug(StdCheats): deal fails on tokens with computed balanceOf (aTokens, rebasing) #140

Description

@sourabhmarathe

Component

forge-std

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (4b720c2 2022-07-28T00:04:25.986568Z)

What command(s) is the bug in?

forge test

Operating System

macOS (Intel)

Describe the bug

I have not been able to call deal on Aave's aToken (address: 0xBcca60bB61934080951369a648Fb03DF4F96263C). I have shared the stacktrace for the deal call below.

This happens in a test where the first line of the function is deal(token, msg.sender, amount);. The error message is [FAIL. Reason: stdStorage find(StdStorage): Slot(s) not found.].

In addition, it appears that aTokens are ERC20 compliant (their website states that aTokens support basic EIP20 functions).

Stack trace:

    ├─ [23586] InitializableImmutableAdminUpgradeabilityProxy::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) 
    │   ├─ [18475] AToken::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) [delegatecall]
    │   │   ├─ [12856] InitializableImmutableAdminUpgradeabilityProxy::getReserveNormalizedIncome(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) [staticcall]
    │   │   │   ├─ [7745] LendingPool::getReserveNormalizedIncome(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) [delegatecall]
    │   │   │   │   └─ ← 1076877460561699683403779143
    │   │   │   └─ ← 1076877460561699683403779143
    │   │   └─ ← 0
    │   └─ ← 0
    ├─ [0] VM::record() 
    │   └─ ← ()
    ├─ [4086] InitializableImmutableAdminUpgradeabilityProxy::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) [staticcall]
    │   ├─ [3475] AToken::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) [delegatecall]
    │   │   ├─ [2356] InitializableImmutableAdminUpgradeabilityProxy::getReserveNormalizedIncome(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) [staticcall]
    │   │   │   ├─ [1745] LendingPool::getReserveNormalizedIncome(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) [delegatecall]
    │   │   │   │   └─ ← 1076877460561699683403779143
    │   │   │   └─ ← 1076877460561699683403779143
    │   │   └─ ← 0
    │   └─ ← 0
    ├─ [0] VM::accesses(InitializableImmutableAdminUpgradeabilityProxy: [0xbcca60bb61934080951369a648fb03df4f96263c]) 
    │   └─ ← [0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc, 0x7db14a3e80dc3d3973ac59ab9dd6e51be0941d8302f988ebabbd9d9f72c15b36], []
    ├─ [0] VM::load(InitializableImmutableAdminUpgradeabilityProxy: [0xbcca60bb61934080951369a648fb03df4f96263c], 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc) 
    │   └─ ← 0x0000000000000000000000001c050bca8babe53ef769d0d2e411f556e1a27e7b
    ├─ [0] VM::store(InitializableImmutableAdminUpgradeabilityProxy: [0xbcca60bb61934080951369a648fb03df4f96263c], 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc, 0x1337000000000000000000000000000000000000000000000000000000000000) 
    │   └─ ← ()
    ├─ [3108] InitializableImmutableAdminUpgradeabilityProxy::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) [staticcall]
    │   ├─ [0] 0x00000000::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) [delegatecall]
    │   │   └─ ← ()
    │   └─ ← ()
    ├─ [0] VM::store(InitializableImmutableAdminUpgradeabilityProxy: [0xbcca60bb61934080951369a648fb03df4f96263c], 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc, 0x0000000000000000000000001c050bca8babe53ef769d0d2e411f556e1a27e7b) 
    │   └─ ← ()
    ├─ [0] VM::load(InitializableImmutableAdminUpgradeabilityProxy: [0xbcca60bb61934080951369a648fb03df4f96263c], 0x7db14a3e80dc3d3973ac59ab9dd6e51be0941d8302f988ebabbd9d9f72c15b36) 
    │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000000
    ├─ emit WARNING_UninitedSlot(who: InitializableImmutableAdminUpgradeabilityProxy: [0xbcca60bb61934080951369a648fb03df4f96263c], slot: 56852350417691002906141485739722008029934276939945103568888814915257509174070)
    ├─ [0] VM::store(InitializableImmutableAdminUpgradeabilityProxy: [0xbcca60bb61934080951369a648fb03df4f96263c], 0x7db14a3e80dc3d3973ac59ab9dd6e51be0941d8302f988ebabbd9d9f72c15b36, 0x1337000000000000000000000000000000000000000000000000000000000000) 
    │   └─ ← ()
    ├─ [4535] InitializableImmutableAdminUpgradeabilityProxy::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) [staticcall]
    │   ├─ [3911] AToken::balanceOf(0x00a329c0648769a73afac7f9381e08fb43dbea72) [delegatecall]
    │   │   ├─ [2356] InitializableImmutableAdminUpgradeabilityProxy::getReserveNormalizedIncome(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) [staticcall]
    │   │   │   ├─ [1745] LendingPool::getReserveNormalizedIncome(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) [delegatecall]
    │   │   │   │   └─ ← 1076877460561699683403779143
    │   │   │   └─ ← 1076877460561699683403779143
    │   │   └─ ← "48"
    │   └─ ← "48"
    ├─ [0] VM::store(InitializableImmutableAdminUpgradeabilityProxy: [0xbcca60bb61934080951369a648fb03df4f96263c], 0x7db14a3e80dc3d3973ac59ab9dd6e51be0941d8302f988ebabbd9d9f72c15b36, 0x0000000000000000000000000000000000000000000000000000000000000000) 
    │   └─ ← ()
    └─ ← "stdStorage find(StdStorage): Slot(s) not found."

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions