Fix silent mainnet funding preflight - #9
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 045aca6328
ℹ️ 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".
| const waitForReceipt = async (hash) => { | ||
| for (let attempt = 0; attempt < 90; attempt += 1) { | ||
| const receipt = await rpc("eth_getTransactionReceipt", [hash]); | ||
| const receipt = await publicRpc("eth_getTransactionReceipt", [hash]); |
There was a problem hiding this comment.
Keep polling after post-broadcast RPC timeouts
When the public RPC times out or returns a transient error after eth_sendTransaction succeeds, this call rejects immediately instead of consuming another polling attempt. execute then loses the transaction hash, reports that the action was not executed, and re-enables the button using stale state; a user can consequently broadcast the real-value action again while the first transaction is still pending. Preserve and expose the pending hash and continue polling after transient receipt-read failures rather than treating them as transaction failure.
Useful? React with 👍 / 👎.
|
@codex review\n\nAddressed the P1: preserve the pending transaction hash immediately after broadcast, disable repeat actions while pending, continue receipt polling through transient RPC failures, and surface the hash if confirmation remains pending. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 069e2802b9
ℹ️ 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".
| pendingHash = undefined; | ||
| await refreshState(); |
There was a problem hiding this comment.
Keep the pending guard until confirmed state refreshes
When a receipt succeeds but any of the three refreshState() reads times out or fails, clearing pendingHash before that await sends control to the handler's catch/finally with cached pre-transaction state. After an approval, the final render() therefore re-enables Approve, and a timeout explicitly tells the user to retry even though the transaction already confirmed, inviting a redundant mainnet transaction and gas spend. Keep the guard until refresh succeeds or report confirmation independently from the refresh failure.
Useful? React with 👍 / 👎.
| if (receipt.status !== "0x1") throw new Error("The X Layer receipt reports failure."); | ||
| pendingHash = undefined; |
There was a problem hiding this comment.
Clear the pending guard after a failed receipt
When the terminal receipt has status 0x0, this throw occurs before pendingHash is cleared, so the handler's final render() leaves both buttons disabled indefinitely even though the transaction is finalized and cannot later succeed. A reverted approval or funding action cannot be corrected and retried without reloading the page; clear the guard for any terminal receipt while retaining it when receipt polling merely exhausts.
Useful? React with 👍 / 👎.
|
@codex review\n\nAddressed both P2 findings: terminal reverts clear the pending guard; confirmed success keeps the guard through state refresh and reports confirmation independently if refresh is delayed. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e805467269
ℹ️ 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".
| await refreshState(); | ||
| pendingHash = undefined; | ||
| render(); |
There was a problem hiding this comment.
Keep the guard until refreshed state includes the receipt
When the public RPC returns the receipt from a newer block but the immediately following "latest" calls are served by a lagging backend, refreshState() completes normally with pre-transaction invoice or allowance values, yet these lines clear pendingHash. This can re-enable Approve after a confirmed approval, or Fund after confirmed funding, allowing another mainnet transaction and unnecessary gas spend. Fresh evidence in the addressed revision is that the guard is cleared after any successful read rather than verifying that the state reflects receipt.blockNumber or the expected postcondition; refresh against that block or retain the guard until the transition is observed.
Useful? React with 👍 / 👎.
|
@codex review Addressed the receipt/state race: refresh reads now target the exact receipt block and the pending guard clears only after the expected allowance or funded-state postcondition is observed. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Exact-diff review of the urgent funding-path fix before production deployment. Replaces unbounded injected-wallet read/simulation calls with bounded X Layer public-RPC checks while retaining the wallet exclusively for account, chain, and transaction authorization.\n\nValidation: npm run web:check; npm run site:check.