Skip to content

fix: recover transaction confirmation after transient failures - #115

Open
Jim8y wants to merge 2 commits into
neoorder:masterfrom
Jim8y:fix/audit-p2-04
Open

Jim8y wants to merge 2 commits 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: leaving the Sending page now cancels the underlying transaction-confirmation HTTP request instead of only cancelling an outer wait.

  • Add a cancellation-aware RpcSendAsync overload and pass the token to HttpClient.SendAsync and JSON body deserialization.
  • Thread the page cancellation token through TransactionConfirmation reads for both transaction and application-log polling.
  • Keep the existing no-argument RPC API and broadcast behavior unchanged.
  • Add regression coverage proving an in-flight read observes the cancellation token and terminates promptly.

Validation

  • dotnet test tests/p2-04/TransactionConfirmation.Tests.csproj --no-restore --nologo: 8/8 passed.
  • iOS simulator: OneGateApp rebuilt for net10.0-ios, installed and launched on the iPhone 17 simulator; normal welcome UI displayed.
  • Android API 36 onegate_api36 emulator: self-contained APK rebuilt with EmbedAssembliesIntoApk=true, installed and launched directly through the resolved MAUI MainActivity; normal welcome UI displayed.
  • Screenshots and device logs are outside the repository under /tmp.

The cancellation regression is covered by the focused test project; simulator validation exercised the resulting production app startup on both platforms. No wallet signing, game play, or chain submission was performed.

This PR remains independently based on master@623603d; no historical Erik-rejected approach or STOP item was changed.

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