Skip to content

fix(dex): remove row_number() dedup from hyperevm base trades#9513

Open
dennisp42 wants to merge 4 commits intomainfrom
dennis/cur2-748-remove-hyperevm-dedup
Open

fix(dex): remove row_number() dedup from hyperevm base trades#9513
dennisp42 wants to merge 4 commits intomainfrom
dennis/cur2-748-remove-hyperevm-dedup

Conversation

@dennisp42
Copy link
Copy Markdown
Contributor

Removes the defensive row_number() dedup guard from 5 hyperevm models.
Was added as a precaution — verified all source tables are clean so it's
dead weight.

Verified 0 duplicates across all sources:

Also added unique_combination_of_columns test on dex_hyperevm_base_trades
(was missing, all platform models already had it). If sources ever produce
duplicates the MERGE will fail loudly in CI — intentional.

…move deduplication logic from SQL queries

- Added data tests for unique combinations of blockchain, project, version, tx_hash, and evt_index in the schema file for dex_hyperevm_base_trades.
- Removed deduplication logic from SQL queries in multiple platform models (hybra_v3, hyperswap_v2, hyperswap_v3, prjx_v3) as source tables have been verified to be duplicate-free.

This change enhances data integrity checks while simplifying the SQL logic.
@github-actions github-actions Bot added the WIP work in progress label Apr 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@github-actions github-actions Bot added the dbt: dex covers the DEX dbt subproject label Apr 1, 2026
@dennisp42 dennisp42 requested a review from 0xRobin April 1, 2026 12:36
@dennisp42 dennisp42 self-assigned this Apr 1, 2026
@dennisp42
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Apr 1, 2026
…ades

Old seed transactions no longer exist in source tables (likely removed
during a data reprocessing).
Replaced with recent, production-verified transactions to fix check_dex_base_trades_seed CI failures
@dennisp42 dennisp42 marked this pull request as ready for review April 1, 2026 13:08
@github-actions github-actions Bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Apr 1, 2026
Copy link
Copy Markdown
Collaborator

@0xRobin 0xRobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look good, but seeing that we have dropped the orginal seed trades is alarming.

Looking at the rowcounts between Dune and CI, we can't merge this as is and need to get to the bottom of why the models are suddenly dropping historical rows.
https://dune.com/queries/6935973/10842220

Image

@dennisp42
Copy link
Copy Markdown
Contributor Author

dennisp42 commented Apr 1, 2026

The row count diff is a source data issue, not from the dedup removal.

Both hyperswap_hyperevm.hyperswapv3pool_evt_swap and prjx_hyperevm.uniswapv3pool_evt_swap were reprocessed. They now start at block 9,700,042. Zero swaps exist before that block. CI pulls everything available and matches source exactly.

Production has more rows from incremental accumulation before the reprocessing. The original seeds were stale for the same reason.

Model Source rows CI rows Prod rows
hyperswap_v3 5,899,435 5,899,050 17,041,237
prjx_v3 17,467,655 17,466,093 22,442,155

Verification: source ranges · zero swaps below cutoff

Opened CUR2-1955 to track the source data investigation separately.

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

Labels

blocked dbt: dex covers the DEX dbt subproject ready-for-review this PR development is complete, please review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants