Skip to content

Add debug scenarios for ethui MCP demo - #106

Open
DavideSilva wants to merge 13 commits into
mainfrom
demo/mcp-debug-scenarios
Open

Add debug scenarios for ethui MCP demo#106
DavideSilva wants to merge 13 commits into
mainfrom
demo/mcp-debug-scenarios

Conversation

@DavideSilva

Copy link
Copy Markdown
Contributor

Adds a /bugs route group with deliberately broken pages, each backed by a real
contract on anvil. Purpose: demo an agent connected to ethui over MCP diagnosing
failures from live chain state — not from reading source.

Governing constraint: no scenario is diagnosable from source alone. Where the bug
does live in source (decimals, allowance), the code reads as idiomatic and a
competing explanation exists that only on-chain state rules out.

Scenarios

Route Bug lives in Symptom Agent path
/bugs/stale-address environment reads return empty, no revert reason eth_getCode returns 0x
/bugs/access-control wallet write reverts active account is alice, OwnedRegistry owner is bob
/bugs/decimals frontend ERC20InsufficientBalance with absurd numbers token is 6-decimal, UI uses parseEther
/bugs/allowance contract/frontend Vault.deposit reverts no approve before transferFrom

Also in here

  • contracts/bugs/DepositToken, OwnedRegistry, SixDecimalToken, Vault
  • contracts/scripts/BugsDeploy.s.sol + scripts/eth-deploy.sh wiring
  • RawError component: renders the raw error and walks .cause, so pages show
    what failed without explaining why. Handles non-Error terminal causes and
    synchronous parseEther throws.
  • Forge tests per contract. Every inverted revert test pins the specific error —
    no bare vm.expectRevert().
  • Design doc + implementation plan under docs/superpowers/

…verts

Rename VaultToken -> DepositToken (on-chain ERC20 name/symbol unchanged) so
Vault.token()'s generated hook no longer collides with the token contract's
own base hook, eliminating the need for a custom getHookName policy in
wagmi.config.ts. Re-deployed and re-pinned DepositToken/Vault addresses.

Also tighten the three inverted revert tests (Vault, OwnedRegistry,
SixDecimalToken) to assert the specific revert error instead of a bare
vm.expectRevert(), so a scenario silently turning into a different bug would
be caught.
@DavideSilva
DavideSilva requested a review from naps62 as a code owner July 25, 2026 13:34
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ethui-demo Ready Ready Preview, Comment Jul 25, 2026 3:55pm

Request Review

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.

1 participant