Skip to content

refactor: deepen architecture + efficiency optimizations#24

Open
Timidan wants to merge 3 commits into
masterfrom
feat/cleanup-v3
Open

refactor: deepen architecture + efficiency optimizations#24
Timidan wants to merge 3 commits into
masterfrom
feat/cleanup-v3

Conversation

@Timidan
Copy link
Copy Markdown
Owner

@Timidan Timidan commented May 30, 2026

Consolidates duplicated/scattered logic behind single seams and adds behaviour-preserving efficiency wins. tsc clean, production build green.

Deepening

  • Trace decoder: one PC-resolution factory + a single traceIdFromFrame (was duplicated across the decode files)
  • Storage: one EVM packing/layout-walk primitive + one canonical Solidity-type→ABI-key resolver (fixes a silent string-keyed mapping-probe failure)
  • Contract resolution: remove two deprecated fetcher shims; resolve diamond facets through the unified resolver seam
  • Debug eval: extract pure opcode scoring + a single snapshot-cache eviction policy
  • Sim persistence: a store coordinator; deleting a simulation now also purges its OPFS trace (was orphaned)
  • Integrations: one EVM read-provider helper for the token hooks

Efficiency

  • Diamond loupe facets()-first reuses selectors, dropping per-facet RPC calls
  • Bounded mapping-slot keccak cache
  • Selector decode: batched + chunked OpenChain lookup with a circuit breaker
  • recomputeHierarchy O(n²)→O(n); skip a redundant recompute on history load
  • Lazy-load Navigation, splitting framer-motion off the eager bundle (~47 KB gzip)

Behaviour

Behaviour-preserving except three intentional fixes: nested-struct storage layout, the string-keyed mapping probe, and orphaned OPFS traces on delete.

Timidan added 2 commits May 28, 2026 22:56
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
Copilot AI review requested due to automatic review settings May 30, 2026 14:47
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web3-toolkit Ready Ready Preview, Comment May 30, 2026 2:50pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread api/edb-proxy.ts
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([
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants