Skip to content

fix: recover transaction confirmation after transient failures - #115

Open
Jim8y wants to merge 1 commit into
neoorder:masterfrom
Jim8y:fix/audit-p2-04
Open

fix: recover transaction confirmation after transient failures#115
Jim8y wants to merge 1 commit into
neoorder:masterfrom
Jim8y:fix/audit-p2-04

Conversation

@Jim8y

@Jim8y Jim8y commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix audit P2-04: recover transaction-confirmation polling from transient network/status payload failures and allow a page to be left and reopened safely.

  • Extract the bounded confirmation poller; retry read-only status queries after offline/HTTP/RPC/timeout/malformed-result failures, without repeating a broadcast.
  • Treat missing/unknown execution status as pending; report success only for HALT and failure for FAULT.
  • Give each page appearance its own cancellation lifetime and prevent an old poll from replacing a new session's state.

Validation before commit

  • 8 local regression tests cover recovery, unknown/empty/null receipts, HALT/FAULT, cancellation and restarting a poll.
  • Actual iOS 26.5 and Android API 36 ARM64 app runs: 5/5 native assertions on each. Used production SendingPage, left/reentered the page and observed offline → HTTP 502 → malformed JSON → confirmed HALT using the real polling interval. Displayed time/state and zero broadcasts were asserted.
  • HTTP results and the transaction were synthetic; no real transfer, signing, or mainnet confirmation is claimed.
  • Removed the external fixture, then full product Rebuild, install, and native startup smoke passed on both. Validated source patch: 1285f401155afc80b1c2fd948fd861a7bb089a1b7daa000bc8424b69845adbd3.
  • Screenshots/logs stay outside the repository. No screenshot upload is claimed.

Independent branch based on master 623603d634f07eaead14745da87920a356159be0. Preserve the union of solution test projects when integrating other audit fixes, and revalidate any combined edits. This is not a claim of combined validation of all audit PRs.

Copilot AI lite review requested due to automatic review settings September 5, 2026 08:00

Copilot AI 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.

🟡 Changes recommended

Cancellation currently stops awaiting but doesn’t abort the underlying RPC/HTTP requests, which can leave in-flight work running after navigation and undermines the intended reliability guarantees.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR hardens transaction-confirmation polling so the Sending page can recover from transient network/payload failures and be safely left/reopened without an older poll corrupting a newer session’s UI state.

Changes:

  • Extracted a bounded TransactionConfirmation poller that retries read-only RPC status queries across transient failures and treats unknown execution status as pending.
  • Updated SendingPage to use the extracted poller and to scope cancellation to each page appearance to prevent stale polls from updating state.
  • Added a dedicated tests/p2-04 test project covering recovery, pending/unknown receipts, HALT/FAULT outcomes, and cancellation/restart behavior.
File summaries
File Description
tests/p2-04/TransactionConfirmationTests.cs Adds regression coverage for transient failures, pending vs HALT/FAULT, null results, and cancellation/restart.
tests/p2-04/TransactionConfirmation.Tests.csproj Introduces a focused xUnit test project for the poller logic.
OneGateApp/Services/RPC/TransactionConfirmation.cs New reusable confirmation poller with bounded retries and tolerant parsing/exception handling.
OneGateApp/Pages/SendingPage.xaml.cs Replaces inline polling with the new poller and introduces per-appearance cancellation handling.
OneGateApp.slnx Registers the new tests/p2-04 test project in the solution.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +18 to +22
JsonObject? tx = await read("getrawtransaction").WaitAsync(cancellationToken);
if (tx is null) continue;
blockTime = tx["blocktime"]?.GetValue<ulong>();
if (!blockTime.HasValue) continue;
JsonObject? log = await read("getapplicationlog").WaitAsync(cancellationToken);
Comment on lines +16 to +18
<ItemGroup>
<ProjectReference Include="../../OneGateApp/OneGateApp.csproj" ReferenceOutputAssembly="false" BuildReference="false" SkipGetTargetFrameworkProperties="true" />
</ItemGroup>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants