fix(oneinch): resolve AR v6 trace-decoded token details via calldata fallback#9769
fix(oneinch): resolve AR v6 trace-decoded token details via calldata fallback#9769bh2smith wants to merge 1 commit into
Conversation
…fallback Trace-decoded AR rows (evt_index = -2) shipped with '' token symbols and NULL amounts when the transfer-graph resolution found no matches - typical for internally-called router swaps (wallet proxies) and PancakeSwap Infinity / v4-style vault fills, ~10% of AR v6 rows/day, 98% on bnb. - executions macro: fall back to the calldata-decoded token address, symbol, decimals (via tokens lookup, native sentinels mapped to the chain's wrapped native) and amounts when transfer-derived values are absent; transfer-derived values still take precedence. - ar trades model: stop coalescing unresolved symbols to '' - they stay NULL so gaps are detectable and token_pair stays NULL, consistent with enrich_dex_aggregator_trades.
a54247c to
7cd9791
Compare
PR SummaryMedium Risk Overview
Reviewer note: rows that previously had Reviewed by Cursor Bugbot for commit 7cd9791. Configure here. |
Description:
Fix: 1inch AR v6 trace-decoded trades ship with empty-string symbols and NULL amounts (~10%/day)
Problem.
dex_aggregator.tradesrows forproject = '1inch', version = 'AR v6'that come from the trace-decoding path (evt_index = -2) systematically ship with''(empty-string) token symbols and NULL token amounts: 22,816 rows June 1–12 2026 (8–13% of AR v6 rows per day, 98% on bnb), carrying ~$4.6M/week of measuredamount_usdon rows with no token detail. Because the symbols are''rather than NULL,IS NULL-based quality checks report these rows as 0% incomplete.0x463b95a76eb82b6fda8e8a51f96291fef9714c550f9de17f14a37544a89ecfa9Root cause. The AR executions macro resolves token metadata and amounts from the transfer graph around the router call. When the router is invoked internally (e.g. wallet-proxy → AR v6
0x111111125421ca6dc452d289314280a0f8842a65, selector0x07ed2379) and/or the fill settles through PancakeSwap-Infinity / v4-style flash-accounting vaults, the transfer-matching filters find no rows, so src/dst amounts and symbols resolve to nothing — even though the swap's token addresses and amounts are present in the decoded call parameters. The trades model then coalesced unresolved symbols to''.Fix (two files, no restructuring):
oneinch_ar_executions_macro.sql— add calldata-decoded amounts as the final fallback in the existing coalesce chains, and aLEFT JOINto the tokens lookup on the calldata token address (native sentinels0x0…0/0xeee…emapped viablockchain.wrapped_native_token_address/native_token_symbol) so symbol/decimals resolve when transfer-based resolution is empty. Transfer-derived values still take precedence — event-decoded AR v4/v5 output is unchanged.oneinch_ar_trades.sql— stop coalescing unresolved symbols to''; they now stay NULL so gaps are detectable, andtoken_paircorrespondingly stays NULL (matchingenrich_dex_aggregator_tradesbehavior).Behavior change note for reviewers: previously-
''symbols become NULL. Anyone filteringtoken_sold_symbol != ''on 1inch rows sees a difference; this aligns 1inch with how every other dex_aggregator project represents unknown symbols.Validation: bnb model compiled locally and rendered SQL inspected (fallback chains and tokens join render correctly); relying on CI for the full per-chain compile and tests. Post-merge check: re-run https://dune.com/queries/7709025 — the AR v6 daily blank rate should drop from ~10% to ~0, and the anchor tx's spell row should carry full token details.