refactor: deepen architecture + efficiency optimizations#24
Conversation
Applied 9 unambiguous fixes from a 10-zone CLAUDE.md audit (~150 total findings). Only items with zero behavior change, zero parallel-work conflict (PR #20 lifi-intents, #21 mezo, #22 cleanup), and clear dead-code or surface-confusion signal were applied; the rest are deferred to the PR description as a backlog. Net: 12 files, -65 lines net. Surface confusion (P1): - structStorageDecoding.ts:484 — collapse identical-branches ternary 'const elementSize = elementType === 'address' ? 1 : 1' → '= 1' - storageSlotCalculator.ts:86 — parseSlotInput dropped redundant hex branch (both branches called BigInt(trimmed)) - edbTraceConverter.ts:55 — same redundant-hex-branch in parseTraceValue Speculative API surface (P2): - SolidityViewer.tsx — removed unused props highlightLine, scrollToLine, theme (sole caller never passes any) - PackingVisualizer.tsx — removed unused rawHex prop + caller's pass - api/{lifi-composer,lifi-earn,edb-proxy}.ts — dropped 'HEAD' from ALLOWED_METHODS (no caller issues HEAD) Dead exports (P3): - scripts/bridge-security.mjs — sanitizeForLogging (zero callers) - scripts/bridge-config.mjs — TRACE_DETAIL_COMPACT_ARTIFACTS env constant (zero readers) - eslint.config.js — ignore globs for nonexistent dirs (current_bundle, test-results, test-*, **/test-*.js, test-app-*)
Consolidate duplicated/scattered logic behind single seams and add measured, behaviour-preserving efficiency wins. Deepening: - trace decoder: createPcResolvers factory + single traceIdFromFrame - storage: placeField/elementsPerSlot + walkStorageEntries primitives; resolveAbiKeyType/buildScalarDescriptor (fixes silent string-key probe) - contract resolution: delete deprecated multiSource/comprehensive shims; facetAdapter over the resolver seam - debug eval: traceRowScoring + snapshotCacheStore (one eviction policy) - sim persistence: simulationStore coordinator; deleteDecodedTrace fixes orphaned OPFS traces on delete - integrations: evmRead provider helper Efficiency: - diamond loupe facets()-first reuses selectors (drops per-facet RPC) - bounded mapping-slot keccak cache - SelectorDecoder batched + chunked OpenChain lookup with circuit breaker - recomputeHierarchy O(n^2) -> O(n); skip redundant recompute on OPFS load - lazy-load Navigation, split framer-motion to an async chunk
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 214f89bd15
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const ALLOWED_METHODS = new Set(["GET", "POST", "OPTIONS"]); | ||
|
|
||
| // CORS allowlist — dev servers by default; extend via EDB_CORS_ALLOWED_ORIGINS (comma-separated). | ||
| const DEFAULT_ALLOWED_ORIGINS = new Set([ |
There was a problem hiding this comment.
Restore HEAD to the EDB method allowlist
When a client or health checker sends a HEAD request to /api/edb/*, this allowlist now rejects it with 405 before the proxy reaches the existing HEAD-specific path below (the CORS header still advertises HEAD, and the body handling explicitly skips bodies for HEAD). This makes HEAD probes fail even though the rest of the handler is still written to forward them safely.
Useful? React with 👍 / 👎.
Consolidates duplicated/scattered logic behind single seams and adds behaviour-preserving efficiency wins.
tscclean, production build green.Deepening
traceIdFromFrame(was duplicated across the decode files)Efficiency
facets()-first reuses selectors, dropping per-facet RPC callsrecomputeHierarchyO(n²)→O(n); skip a redundant recompute on history loadBehaviour
Behaviour-preserving except three intentional fixes: nested-struct storage layout, the string-keyed mapping probe, and orphaned OPFS traces on delete.