Skip to content

POC: Update / indexed db account ops integration#2513

Draft
gergana95 wants to merge 7 commits into
v2from
update/indexedDB-accountOps-integration
Draft

POC: Update / indexed db account ops integration#2513
gergana95 wants to merge 7 commits into
v2from
update/indexedDB-accountOps-integration

Conversation

@gergana95

@gergana95 gergana95 commented Jun 30, 2026

Copy link
Copy Markdown
Member

Issue is https://github.com/AmbireTech/ambire-app/issues/7264

In order to test properly with storage of accounOps please use a new browser instance and refer to the script mentioned here and load accountOps in your storage #2412

Testing Summary

  1. Startup Performance (IDB with cursor-based early stopping)

Benchmarked Activity startup with 21,000 operations (3 accounts × 7 chains × 1,000 ops).

The implementation uses a timestamp index cursor per (account, chainId) group that stops reading after 20 finalized ops — only 525 out of 21,000 rows are touched at startup (2.5%). This replaces the previous load-all-then-trim approach.

The previous version (load all records → trim in JS) loaded startup data in ~1.0s. With cursor-based early stopping, the same 21,000-op dataset loads ~525 rows instead of 21,000 — a ~40× reduction in rows read — which should yield a proportionally faster startup in a real browser environment. The ~1.0s figure is no longer representative and should be re-benchmarked in the extension.

  1. Lazy Pagination
  • Stress-tested pagination with 21,000 operations.
  • Startup and page navigation remained effectively instant, with only a one-time ~70ms fetch when expanding a chain for the first time.
  • Identified and fixed issues related to redundant IDB fetches, incorrect page counts after chain switching, an IndexedDB cursor error, and a migration issue affecting chainId.
  • After the fixes, pagination behaves correctly and scales well.
  1. External/Internal Operation Deduplication
  • Verified that external and internal operations cannot appear as duplicates in the Activity UI.
  • Found a deduplication gap affecting operations outside the startup window, reproduced the issue, and fixed it by adding a merge-time deduplication filter.
  • This provides a safety net even when the polling-based deduplication hasn’t run.

Overall

  • ✅ IndexedDB provides significantly better startup performance than chrome.storage.local.
  • ✅ Lazy pagination performs well on large datasets after the implemented fixes.
  • ✅ Duplicate activity entries caused by internal/external operation overlap have been resolved.

@gergana95 gergana95 self-assigned this Jun 30, 2026
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedfake-indexeddb@​6.2.510010010084100

View full report

Comment thread src/services/storage/baseIdbStore.ts
Comment thread src/services/storage/activityIdb.ts Outdated
Comment thread src/services/storage/activityIdb.ts Outdated
Comment thread src/services/storage/activityIdb.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants