Skip to content

fix(polygon/aave_v3): guard removed v3.2 reads + bricked incentives feed (zd79) - #148

Open
thrilok-code wants to merge 3 commits into
mainfrom
fix/zd79-polygon-aave-v3-stable-debt
Open

thrilok-code wants to merge 3 commits into
mainfrom
fix/zd79-polygon-aave-v3-stable-debt

Conversation

@thrilok-code

Copy link
Copy Markdown

What

Fixes the polygon aave-v3 resolver reverts breaking legacy Instadapp app position pages (Zendesk 79 — users down since Jul 28).

Root cause (today's live revert): deprecated Chainlink reward feed — getAllUserRewards path hits an incentives aggregator that now returns address(0) → revert inside the incentives periphery.

Three guards (polygon aave_v3 legacy resolver):

  1. a47ba76 — guard stable-debt metadata reads (stable debt removed in Aave v3.2; matters on redeploy against new DP storage)
  2. 1112cda — try/catch the bricked incentives periphery + address(0) aggregator guard in getAllUserRewards
  3. 6f28957 — guard getReserveEModeCategory (getter removed in Aave v3.2 DataProvider)

Verification

State-override simulation (eth_call with code override at the deployed resolver address 0x44ac...b140): getPositionAll + getPosition both green on old and new DataProvider storage layouts; position data byte-identical to pre-revert output. Deploy gate passed.

Deploy

Repo HEAD fix only — the on-chain resolver at 0x44ac...b140 needs redeploy (constructor-pinned DP storage). Deploy is team-side per Thrilok.

Context: Mert//Lauki TG thread, msgs 1041034/1041075/1041076.

Lauki Antonson added 3 commits August 30, 2026 09:33
…debt metadata reads (zd79)

Base: commit e9596a3 — PROVEN byte-for-byte identical to deployed
0x44ac5ed26d8b7bbcf3bcb9ac486191cbb294b140 when compiled with
solc 0.8.6, optimizer runs=800, metadata.bytecodeHash=none
(on-chain name() is v1.0, not v1.1 as previously recorded).

Fix: getAaveTokensData no longer calls symbol()/decimals() on
stableDebtToken when address(0) (Aave v3.3 Polygon upgrade removed
stable debt at block 91037023). Struct layout unchanged; stable-debt
Token fields return (address(0), "", 0). ABI verified identical to
deployed ABI (anyabi/polygonscan mirror).

KNOWN INCOMPLETE: state-override eth_call of this fixed bytecode
still reverts — a SECOND address(0) call site exists in the
getPositionAll path (suspect: getIncentivesInfo -> getUserReward ->
rewardsCntr.getAllUserRewards with sIncentiveData.tokenAddress=0).
Do NOT deploy until that is guarded and the override test passes.
… getAllUserRewards addr(0) guard (zd79)

SECOND call site pinned by callTracer (drpc.org, state-override):
resolver -> UiIncentiveDataProviderV3 0x05e309c9..cec0 getReservesIncentivesData
-> Chainlink EACAggregatorProxy 0x97371dF4..a13f decimals()/latestAnswer()
-> proxy.aggregator() == address(0) (feed DEPRECATED) -> revert. External to
resolver; guarded via try/catch -> empty incentives array.

🔴 DEPLOY-TRUTH CORRECTION: on-chain 0x44ac..b140 reproduces byte-for-byte at
solc 0.8.6, optimizer runs=200 (NOT 800), bytecodeHash=none, evm berlin.

TEST A GREEN: eth_call getPositionAll(0xdead), fixed code substituted at
resolver addr, storage untouched (old DP in slot2), NO dummy at addr(0):
SUCCESS 36928 bytes. Field diff vs deployed+dummy@0 baseline (58208B):
userData IDENTICAL, userTokenData[21] IDENTICAL, tokenData[21] IDENTICAL
(0 leaf diffs), incentives 0 vs 21 entries (dummy-tainted data dropped).

🔴 KNOWN INCOMPLETE — TEST B (fresh-deploy sim: slot2 -> new DP 0x243aa9)
still REVERTS: new PoolDataProvider REMOVED getReserveEModeCategory(address)
(sel 0x163a0f20, helpers.sol:371). Needs try/catch->0 guard. Constructor-time
storage means deployed-storage config (Test A) is NOT the fresh-deploy config.
Do NOT deploy until Test B green + getPosition(5ba81c87) verified.
… Aave v3.2 DP (zd79)

Guarded call site:
- helpers.sol:376 (getV3Token): aaveData.getReserveEModeCategory(address)
  (selector 0x163a0f20) — removed from PoolDataProvider in the Aave v3.2
  eMode rework. Pulled out of the tuple assignment into try/catch;
  tokenData.eModeCategory zeroed on failure. AaveV3Token struct layout
  unchanged.

Checked, no guard needed:
- helpers.sol:395 pool.getEModeCategoryData(uint8) — live v3.2+ pool keeps
  a legacy-shaped shim; verified by eth_call in both storage configs:
  identical decode (ltv 9125 / lt 9425 / bonus 10100 / priceSource
  addr(0) / label 'Stablecoins').

Verification (fixed bytecode, solc 0.8.6 runs=200 berlin bytecodeHash=none,
via eth_call state override at 0x44ac5ed26d8b7bbcf3bcb9ac486191cbb294b140):
- TEST A (deployed 2022 storage, old DP): GREEN.
  getPositionAll(0xdead) = 36928 bytes, identical to on-chain baseline.
- TEST B (storage slot 2 -> new PoolDataProvider
  0x243aa95cac2a25651eda86e80bee66114413c43b, fresh-deploy sim): GREEN.
  getPositionAll(0xdead) = 36256 bytes.
- getPosition(address,address[]) [USDC.e, WETH, WMATIC]: GREEN in both
  configs (5824 / 5728 bytes).

Field diff TEST B vs TEST A (getPositionAll, 76 leaf diffs, all in
tokenData[]; userData + userTokenData byte-identical — position balances
unaffected):
- 21x reserves.stableDebtToken.tokenAddress -> addr(0)
- 21x reserves.stableDebtToken.symbol -> ''
- 21x reserves.stableDebtToken.decimals -> 0
- 13x token.eModeCategory -> 0
(stable debt + per-reserve eMode both removed in Aave v3.2)
@laukiantonson

Copy link
Copy Markdown

Deployed this head (6f28957) on Polygon on Thrilok's go: 0x52b8ACdf26436AF595b99EcDcb69513e768BE7C7 — tx 0x2ee106a1…ab3c, block 94024195, verified on Polygonscan + Sourcify. getPosition returns for the affected DSAs and matches pool data; old 0x44ac… still reverts on the same calls.

API repoint: Instadapp/defi-express-multichain#1010. Merging this PR keeps the repo equal to what's live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants