From 1529de750fdaa171a3897ab8f53a0d8b1642d7c7 Mon Sep 17 00:00:00 2001 From: SatoshiQaziMuhammed Date: Thu, 9 Jul 2026 12:12:12 -0700 Subject: [PATCH] test: add per-asset balance fixture covering full Pezkuwi ecosystem (#44) chains_for_testBalance.json only has one entry per chain (native balance via a raw RPC query, bypassing the app's real sync pipeline entirely - this is why it couldn't catch the 2026-07-09 HEZ-on-Asset-Hub silent sync failure). This new fixture covers individual assets (HEZ/PEZ/USDT/ DOT/ETH/BTC across Pezkuwi's 3 chains) and is meant to drive a test that goes through the real BalancesUpdateSystem -> AssetCache pipeline, which is what actually caught that bug. --- .../tests/pezkuwi_assets_for_testBalance.json | 55 +++++++++++++++++++ scripts/sync_from_nova.py | 9 +++ tests/pezkuwi_assets_for_testBalance.json | 55 +++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 pezkuwi-overlay/tests/pezkuwi_assets_for_testBalance.json create mode 100644 tests/pezkuwi_assets_for_testBalance.json diff --git a/pezkuwi-overlay/tests/pezkuwi_assets_for_testBalance.json b/pezkuwi-overlay/tests/pezkuwi_assets_for_testBalance.json new file mode 100644 index 0000000..883861b --- /dev/null +++ b/pezkuwi-overlay/tests/pezkuwi_assets_for_testBalance.json @@ -0,0 +1,55 @@ +{ + "description": "Per-asset fixture for exercising the REAL BalancesUpdateSystem -> AssetCache/AssetDao pipeline (not a raw low-level RPC query like chains_for_testBalance.json/BalancesIntegrationTest uses). Each entry asserts an `assets` DB row eventually gets written for that (chainId, assetId) pair for the mainnet Founder account - this is what actually caught the 2026-07-09 HEZ-on-Asset-Hub silent sync failure, which chains_for_testBalance.json's raw-query test could NOT have caught since it bypasses BalancesUpdateSystem entirely. The assertion is 'a row exists', not 'balance is non-zero' - a written zero-balance row is still valid proof the sync pipeline completed for that asset.", + "last_updated": "2026-07-09", + "account": "5CyuFfbF95rzBxru7c9yEsX4XmQXUxpLUcbj9RLg9K1cGiiF", + "assets": [ + { + "chainId": "1aa94987791a5544e9667ec249d2cef1b8fdd6083c85b93fc37892d54a1156ca", + "chainName": "Pezkuwi", + "assetId": 0, + "symbol": "HEZ" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 0, + "symbol": "HEZ" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1, + "symbol": "PEZ" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1000, + "symbol": "USDT" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1001, + "symbol": "DOT" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1002, + "symbol": "ETH" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1003, + "symbol": "BTC" + }, + { + "chainId": "69a8d025ab7b63363935d7d9397e0f652826c94271c1bc55c4fdfe72cccf1cfa", + "chainName": "Pezkuwi People", + "assetId": 0, + "symbol": "HEZ" + } + ] +} diff --git a/scripts/sync_from_nova.py b/scripts/sync_from_nova.py index 4133b3f..44be423 100644 --- a/scripts/sync_from_nova.py +++ b/scripts/sync_from_nova.py @@ -349,6 +349,15 @@ def sync_tests(): save_json(OUTPUT_TESTS / "chains_for_testBalance.json", filtered) print(f" chains_for_testBalance.json: {len(fixture)} - {dropped} not in {latest_version.name} + {added} Pezkuwi = {len(filtered)}") + # Per-asset fixture (pezkuwi_assets_for_testBalance.json) - unlike chains_for_testBalance.json above, + # this drives a test that goes through the REAL BalancesUpdateSystem/AssetCache pipeline rather than a + # raw RPC query, and covers individual assets (HEZ/PEZ/USDT/DOT/ETH/BTC) rather than just one native + # balance per chain. It's Pezkuwi's own curated list, published as-is - no Nova fixture to filter against. + pezkuwi_assets_file = PEZKUWI_OVERLAY / "tests" / "pezkuwi_assets_for_testBalance.json" + if pezkuwi_assets_file.exists(): + save_json(OUTPUT_TESTS / "pezkuwi_assets_for_testBalance.json", load_json(pezkuwi_assets_file)) + print(f" pezkuwi_assets_for_testBalance.json: {len(load_json(pezkuwi_assets_file)['assets'])} asset(s)") + def main(): print("=" * 60) diff --git a/tests/pezkuwi_assets_for_testBalance.json b/tests/pezkuwi_assets_for_testBalance.json new file mode 100644 index 0000000..883861b --- /dev/null +++ b/tests/pezkuwi_assets_for_testBalance.json @@ -0,0 +1,55 @@ +{ + "description": "Per-asset fixture for exercising the REAL BalancesUpdateSystem -> AssetCache/AssetDao pipeline (not a raw low-level RPC query like chains_for_testBalance.json/BalancesIntegrationTest uses). Each entry asserts an `assets` DB row eventually gets written for that (chainId, assetId) pair for the mainnet Founder account - this is what actually caught the 2026-07-09 HEZ-on-Asset-Hub silent sync failure, which chains_for_testBalance.json's raw-query test could NOT have caught since it bypasses BalancesUpdateSystem entirely. The assertion is 'a row exists', not 'balance is non-zero' - a written zero-balance row is still valid proof the sync pipeline completed for that asset.", + "last_updated": "2026-07-09", + "account": "5CyuFfbF95rzBxru7c9yEsX4XmQXUxpLUcbj9RLg9K1cGiiF", + "assets": [ + { + "chainId": "1aa94987791a5544e9667ec249d2cef1b8fdd6083c85b93fc37892d54a1156ca", + "chainName": "Pezkuwi", + "assetId": 0, + "symbol": "HEZ" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 0, + "symbol": "HEZ" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1, + "symbol": "PEZ" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1000, + "symbol": "USDT" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1001, + "symbol": "DOT" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1002, + "symbol": "ETH" + }, + { + "chainId": "e7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949", + "chainName": "Pezkuwi Asset Hub", + "assetId": 1003, + "symbol": "BTC" + }, + { + "chainId": "69a8d025ab7b63363935d7d9397e0f652826c94271c1bc55c4fdfe72cccf1cfa", + "chainName": "Pezkuwi People", + "assetId": 0, + "symbol": "HEZ" + } + ] +}