Skip to content

Fix silent mainnet funding preflight - #9

Open
dolepee wants to merge 4 commits into
review/openbell-funding-preflight-basefrom
review/openbell-funding-preflight-fix
Open

Fix silent mainnet funding preflight#9
dolepee wants to merge 4 commits into
review/openbell-funding-preflight-basefrom
review/openbell-funding-preflight-fix

Conversation

@dolepee

@dolepee dolepee commented Aug 17, 2026

Copy link
Copy Markdown
Owner

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.

@dolepee

dolepee commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread web/src/fund-app.mjs Outdated
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]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@dolepee

dolepee commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread web/src/fund-app.mjs Outdated
Comment on lines 175 to 176
pendingHash = undefined;
await refreshState();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread web/src/fund-app.mjs Outdated
Comment on lines +174 to +175
if (receipt.status !== "0x1") throw new Error("The X Layer receipt reports failure.");
pendingHash = undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@dolepee

dolepee commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread web/src/fund-app.mjs Outdated
Comment on lines +180 to +182
await refreshState();
pendingHash = undefined;
render();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@dolepee

dolepee commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: d452a15017

ℹ️ 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".

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