fix: preserve ENS names on lookup failure, add debug logging (closes #22) #24

Merged
sneak merged 2 commits from fix/ens-reverse-lookup into main 2026-02-28 10:05:04 +01:00
Collaborator

Summary

Fixes #22: ENS reverse lookups appearing broken — addresses show bare hex even when they have a .eth reverse.

Root Cause

Two issues that could cause ENS names to disappear:

  1. refreshBalances (balances.js): On ENS lookup error (timeout, RPC failure, etc.), addr.ensName was set to null, wiping any previously resolved name. Since saveState() runs after refresh, this null gets persisted. Next popup open shows no ENS name, and if the error continues, it never recovers.

  2. ENS cache (ens.js): Failed lookups were cached as null with a 12-hour TTL. Even after the transient error resolved, resolveEnsName() would return the cached null without retrying the RPC call.

Fix

  1. refreshBalances: on error, keep the existing addr.ensName value instead of overwriting with null
  2. ens.js: don't cache failed lookups — let subsequent calls retry immediately
  3. Added debug logging to ENS reverse lookups for easier debugging

Testing

make check passes (14 tests + prettier).

## Summary Fixes #22: ENS reverse lookups appearing broken — addresses show bare hex even when they have a .eth reverse. ## Root Cause Two issues that could cause ENS names to disappear: 1. **`refreshBalances` (balances.js)**: On ENS lookup error (timeout, RPC failure, etc.), `addr.ensName` was set to `null`, wiping any previously resolved name. Since `saveState()` runs after refresh, this `null` gets persisted. Next popup open shows no ENS name, and if the error continues, it never recovers. 2. **ENS cache (ens.js)**: Failed lookups were cached as `null` with a 12-hour TTL. Even after the transient error resolved, `resolveEnsName()` would return the cached `null` without retrying the RPC call. ## Fix 1. `refreshBalances`: on error, keep the existing `addr.ensName` value instead of overwriting with `null` 2. `ens.js`: don't cache failed lookups — let subsequent calls retry immediately 3. Added debug logging to ENS reverse lookups for easier debugging ## Testing `make check` passes (14 tests + prettier).
sneak was assigned by clawbot 2026-02-27 23:24:48 +01:00
clawbot added 1 commit 2026-02-27 23:24:48 +01:00
fix: preserve ENS names on lookup failure, add debug logging (closes #22)
All checks were successful
check / check (push) Successful in 22s
da428a3815
Two issues that could cause ENS names to disappear:

1. refreshBalances: on ENS lookup error, addr.ensName was set to null,
   wiping any previously resolved name. Now keeps the existing value
   on error — only overwrites on successful lookup.

2. ens.js cache: failed lookups were cached as null for 12 hours,
   preventing retries even after transient errors resolved. Now skips
   caching on failure so subsequent lookups retry immediately.

Added debug logging to ENS reverse lookups in refreshBalances.
Author
Collaborator

Code Review

LGTM — fixes the root cause of ENS names disappearing:

  1. ens.js: no longer caches failures, so transient RPC errors don't block retries for 12h
  2. balances.js: catch block preserves existing addr.ensName instead of overwriting with null
  3. Added debug logging for ENS resolution

This should be merged before PR #25, which complements it by ensuring ENS lookups run for ALL addresses in tx lists (not just counterparties).

Formatting clean. Assigning to sneak.

## Code Review **LGTM** — fixes the root cause of ENS names disappearing: 1. `ens.js`: no longer caches failures, so transient RPC errors don't block retries for 12h 2. `balances.js`: `catch` block preserves existing `addr.ensName` instead of overwriting with `null` 3. Added debug logging for ENS resolution This should be merged before PR #25, which complements it by ensuring ENS lookups run for ALL addresses in tx lists (not just counterparties). Formatting clean. Assigning to sneak.
sneak added 1 commit 2026-02-28 10:04:29 +01:00
Merge branch 'main' into fix/ens-reverse-lookup
All checks were successful
check / check (push) Successful in 22s
cdb7f478e2
sneak merged commit 49c29f6bb3 into main 2026-02-28 10:05:04 +01:00
sneak deleted branch fix/ens-reverse-lookup 2026-02-28 10:05:04 +01:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#24