Skip to content

docs(use-arc): add Common Pitfalls section with empirical gotchas#24

Open
Ccheh wants to merge 1 commit into
circlefin:masterfrom
Ccheh:use-arc-common-pitfalls
Open

docs(use-arc): add Common Pitfalls section with empirical gotchas#24
Ccheh wants to merge 1 commit into
circlefin:masterfrom
Ccheh:use-arc-common-pitfalls

Conversation

@Ccheh
Copy link
Copy Markdown

@Ccheh Ccheh commented May 13, 2026

Adds a new "Common Pitfalls" section to the `use-arc` skill capturing four real gotchas hit while building production-grade contracts and clients against Arc Testnet:

  1. Native USDC vs ERC-20 USDC decimals — the most common bug. Agents default to `parseUnits(amount, 6)` because USDC is 6 decimals on every other chain. For native gas on Arc it must be 18. Includes wrong/right code examples + symptom description.
  2. `eth_getLogs` is capped at 10,000 blocks per call — RPC error `-32614: eth_getLogs is limited to a 10,000 range`. Includes a chunked-backward enumeration pattern.
  3. `waitForTransactionReceipt` frequently times out — Arc Testnet's RPC drops receipt-query connections for 30-60s windows. Treating timeouts as failures causes false-negative reports. Includes a poll-with-tolerance pattern + the "pre-compute deterministic IDs" trick.
  4. Avoid `--private-key` for long-running scripts — the keystore-via-`cast wallet import` pattern. The current skill mentions this rule in passing in the Foundry block; this version adds the concrete `cast wallet import deployer --interactive` + `forge script --account` flow.

Why this matters

The `use-arc` skill is the single piece of documentation an AI agent reads when generating Arc code. Currently it correctly states the rule "use 18 decimals for native gas amounts and 6 decimals for ERC-20 USDC amounts" — but doesn't give code examples showing what the wrong pattern looks like, or what symptoms it produces. Agents that read the rule still consistently produce `parseUnits(amount, 6)` because the prior "USDC is 6 decimals everywhere" is reinforced by ~8 chains of correct-elsewhere training data. Showing the wrong code → right code transition makes the skill behaviorally effective, not just descriptively correct.

The other three pitfalls (`eth_getLogs` cap, receipt timeout pattern, keystore over CLI flag) are operational realities of Arc Testnet that aren't documented anywhere agent-readable but bite every team building real applications.

Source of these pitfalls

Encountered while building Plinth — a capital layer for AI trading agents on Arc — over the Agora Agents Hackathon (May 2026). All four patterns were debugged against the live testnet RPC; the code examples come from the working production codebase.

Diff size

+4,382 chars added in a single new section between "Implementation Patterns" and "Next Steps". No existing content modified.

Happy to iterate on placement, depth, or wording. If maintainers prefer this as a separate `arc-pitfalls` skill rather than an inline section, I'm equally happy to split it.

From production experience building on Arc Testnet: native vs ERC-20
decimal mixing, eth_getLogs 10k cap, receipt-timeout pattern, and
Foundry keystore vs --private-key.
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