ERC20 transfer reports "Transferred" when the transaction reverts (receipt status ignored)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 65/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Inizia in ERC20ActionProvider.transfer e verifica come viene gestita la ricevuta restituita da waitForTransactionReceipt; l’issue dice che il percorso standard di trasferimento la scarta e che approve e gasless transfer potrebbero fare lo stesso. Aggiungi test per una ricevuta con esito reverted e verifica che l’action segnali un errore invece di dichiarare che il trasferimento è riuscito. L’issue offre un archivio per la riproduzione, ma non indica file di test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: @coinbase/agentkit 0.10.4 (latest on npm); same code on main at 2e6dbaf.
What happens. ERC20ActionProvider.transfer sends the transaction, awaits the receipt and then always returns a success message:
const hash = await walletProvider.sendTransaction({ ... functionName: "transfer" ... });
await walletProvider.waitForTransactionReceipt(hash); // receipt discarded
return Transferred ${args.amount} of ${tokenDetails?.name} ...;
With ViemWalletProvider, waitForTransactionReceipt resolves with status: "reverted" for a mined, failed transaction; it does not throw. So a transfer that reverts after AgentKit's pre-checks pass is reported to the agent as "Transferred …", with the hash. No tokens moved.
This happens whenever the token's state changes between gas estimation and inclusion: an issuer pause or blacklist (as USDC supports), a balance or allowance used by a concurrent transaction, or a token with conditional transfer logic.
Reproduction. Attached agentkit-reverted-transfer-poc.zip: npm install && node poc.mjs. It runs on a local Ganache chain with throwaway keys, using the unmodified AgentKit, ViemWalletProvider and erc20ActionProvider; the only test hook pauses the token immediately before the signed transfer is broadcast.
== Control: normal transfer
AgentKit output : Transferred 100 of PoC Token (0x…) to 0x….
Receipt status : success
Transfer events : 1
Payee received : 100 POC
== Bug: token paused after signing, before inclusion
AgentKit output : Transferred 100 of PoC Token (0x…) to 0x….
Receipt status : reverted
Transfer events : 0
Payee received : 0 POC
The same behaviour on public Base Sepolia with our own test token and wallet: https://sepolia.basescan.org/tx/0x844bfcd961a4422ce050bef365f1274b480db60504b55311c1a97287ae839a82 (reverted, no Transfer event; AgentKit returned "Transferred 200 … Transaction hash for the transfer: 0x844bfcd9…").
Why it matters. An agent is told a payment succeeded, with a valid hash, when nothing moved. It then marks the invoice paid or confirms the order. No funds are taken from the wallet; the problem is a false payment confirmation.
Suggested fix.
const receipt = await walletProvider.waitForTransactionReceipt(hash);
if (receipt.status !== "success") {
return Error: transfer transaction ${hash} was mined but reverted; no tokens were transferred.;
}
By code inspection (not separately reproduced), approve and the gasless-transfer path of transfer in the published 0.10.4 build follow the same pattern.
Related: #1547 is the opposite case (a sent transfer reported as failed because the receipt lookup throws). A fix for both could wait for the receipt in its own try, return the hash with "sent, not confirmed" when the wait throws, and return an explicit revert error when status is "reverted".
Happy to open a PR with the fix and tests.
Found with EmberTail (https://embertail.xyz/), which tests payment correctness of AI agents.
- Lingua principale
- TypeScript
- Stelle
- 1.3k
- Fork
- 857
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di coinbase/agentkit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
coinbase-agentkit 0.7.x fails on fresh install: imports solana.rpc.api, which solana>=0.37 removedForse già presa @JulienKervarrec l’ha presa 22 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
I maintainer di solito rispondono entro 1 giorno
-
Automated contract verdict as a middleware step before HITL approval in the guardrails exampleAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di coinbase/agentkit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/rocketmq-dashboard#6872 ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
fab-geocommuns/RNB-site#539 ·
I maintainer di solito rispondono entro 2 giorni
-
Guest multiview tile label leaks raw virtual-source-id "Whip" instead of the guest name / slot labelAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Eyevinn/open-live-studio#211 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
sujithputta02/Esapay#13 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
ehmpathy/rhachet-roles-bhuild#468 ·
I maintainer di solito rispondono entro 1 giorno