theseus/bundled-addons/aegis/lib
Local Dev 40683c84cf perf(aegis): stop freezing Theseus — a 7.4 MB store parsed on every read
Reported as "opening Aegis makes Theseus get stuck / not responding", and it
was Aegis's fault.

The host's add-on store is ONE JSON file per add-on, and storage.get() does a
readFileSync plus a JSON.parse of the whole thing on every call —
synchronously, on the Electron main thread, the thread that drives the entire
browser. storage.set() additionally stringifies and writes all of it.

That store had grown to 7.4 MB, 99.9% of it one wallet's txCache: getTx()
kept every transaction it ever fetched, with full vin/vout arrays, and a busy
chipnet test wallet had thousands. Measured on the real file: parse 59 ms,
stringify 39 ms. So one storage.get blocked the UI for ~60 ms, one set for
~99 ms, and fullState() — which reads the store seven times over
selectedWalletId, walletRoles, walletEntries, snapshotForSelected and the
server list — cost ~420 ms. emitState() runs on every adapter change, across
nine wallets, so the main thread was never given back.

Three changes:

- txCache is capped at 400 entries, pruned newest-first by block time
  (unconfirmed entries sort as newest — they are the current ones). Worst
  case ~0.3 MB per wallet instead of unbounded.
- TX_CACHE_VERSION 3, so existing oversized caches are discarded on first
  load rather than needing a manual clear.
- loadHistory() only persists when something actually changed; an idle wallet
  was rewriting the whole file on every poll for nothing.
- api.storage gains a write-through read cache, so repeated gets cost one
  parse per process instead of one per call. Writes still go to the host
  unchanged. Safe because this process is the only writer — Aegis's panel
  talks over addon messages and never touches addon storage; if that changes,
  the cache has to go.
2026-10-03 10:56:59 +02:00
..
dgb Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
sia chore(aegis): 0.8.2 — sectioned Settings tab 2026-09-22 20:37:28 +02:00
base58check.js Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
bcmr.js fix(aegis): 0.17.0 — both BCMR registries were dead, and self-minted tokens can now be named 2026-09-29 00:13:30 +02:00
cashaddr.js chore(aegis): 0.8.2 — sectioned Settings tab 2026-09-22 20:37:28 +02:00
cashtokens.js chore(aegis): 0.8.2 — sectioned Settings tab 2026-09-22 20:37:28 +02:00
chain-bch-imported.js fix(aegis): imported chipnet wallets linked to the dead web explorer 2026-10-02 20:45:53 +02:00
chain-bch.js feat(aegis): 0.13.1 — chipnet explorer links point at ours; explorer gains a tx view 2026-09-28 00:12:42 +02:00
chain-btc.js Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
chain-dgb.js Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
chain-eth.js Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
chain-generic-imported.js chore(aegis): 0.9.2 — Receive tab reorder, one balance, token history 2026-09-23 01:17:33 +02:00
chain-sia.js chore(aegis): 0.8.2 — sectioned Settings tab 2026-09-22 20:37:28 +02:00
chain-sol.js Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
chain-tron.js Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
chain-utxo-imported.js chore(aegis): 0.8.2 — sectioned Settings tab 2026-09-22 20:37:28 +02:00
eip712.js Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
electrum.js fix(aegis): 0.20.0 — the UTXO scan was 28k requests that always found nothing 2026-09-29 00:56:06 +02:00
import-derive.js chore(aegis): 0.8.2 — sectioned Settings tab 2026-09-22 20:37:28 +02:00
jsqr.js feat(aegis): 0.13.0 — read a seed phrase from a QR image 2026-09-28 00:05:04 +02:00
jsqr.LICENSE feat(aegis): 0.13.0 — read a seed phrase from a QR image 2026-09-28 00:05:04 +02:00
keys.js chore(aegis): 0.8.2 — sectioned Settings tab 2026-09-22 20:37:28 +02:00
prices.js chore(aegis): 0.8.5 — Coin-Spectrum price parser reads body.asset.price_usd 2026-09-22 21:31:43 +02:00
sol-spl.js Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons) 2026-09-08 18:17:25 +02:00
tx.js chore(aegis): 0.8.2 — sectioned Settings tab 2026-09-22 20:37:28 +02:00
wallet.js perf(aegis): stop freezing Theseus — a 7.4 MB store parsed on every read 2026-10-03 10:56:59 +02:00
wc-sign.js fix(aegis): 0.9.5 — WizardConnect signing actually works 2026-09-23 03:23:41 +02:00
wc.js fix(aegis): 0.9.5 — WizardConnect signing actually works 2026-09-23 03:23:41 +02:00