Skip to content

fix(examples): skip simulateContract for bid to avoid stale RPC allowance error#73

Draft
EByrdS wants to merge 2 commits into
mainfrom
simulation-block-number
Draft

fix(examples): skip simulateContract for bid to avoid stale RPC allowance error#73
EByrdS wants to merge 2 commits into
mainfrom
simulation-block-number

Conversation

@EByrdS
Copy link
Copy Markdown
Contributor

@EByrdS EByrdS commented Apr 17, 2026

Jira ticket: ECHO-152

Summary

  • After the ERC20 approve tx is confirmed, calling simulateContract for the subsequent replaceBidWithApproval bid was failing intermittently with ERC20: transfer amount exceeds allowance.
  • Root cause: simulateContract issues an eth_call against block="latest", but on load-balanced public RPCs (e.g. sepolia.base.org) the node handling the call may lag behind and not yet have the block containing the approval — so it sees allowance = 0 and reverts.
  • Fix: call writeContractAsync directly for the bid, bypassing the pre-flight simulation. The actual on-chain execution always reads confirmed state, so the approval is guaranteed to be visible by the time the transaction is mined.

🤖 Generated with Claude Code

EByrdS and others added 2 commits April 17, 2026 14:46
…roval

After the ERC20 approval is confirmed, calling simulateContract for the
bid (an eth_call) on a load-balanced RPC can hit a node that hasn't yet
synced the approval block, causing a false "transfer amount exceeds
allowance" revert. Calling writeContractAsync directly bypasses the
simulation; the actual on-chain execution always sees confirmed state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@EByrdS EByrdS marked this pull request as ready for review April 17, 2026 14:02
@EByrdS EByrdS marked this pull request as draft April 17, 2026 19:00
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