Skip to content

Assert successful token transfer results - #105

Open
Jim8y wants to merge 1 commit into
neoorder:masterfrom
Jim8y:fix/audit-p1-02
Open

Assert successful token transfer results#105
Jim8y wants to merge 1 commit into
neoorder:masterfrom
Jim8y:fix/audit-p1-02

Conversation

@Jim8y

@Jim8y Jim8y commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The wallet's NEP-17 and NEP-11 transfer scripts discarded the contract's boolean return value. A contract returning false could therefore leave the VM in HALT without completing a transfer.

Change

Append ASSERT to both emitted transfer scripts so failure is enforced in the transaction script itself, including when execution differs from preflight simulation. Add focused Neo VM regressions to the solution.

This independent PR addresses audit P1-02 only, based on master 623603d.

Validation

  • 6 regression tests passed, using the real emitted scripts and Neo VM. Four cases failed against the original implementation.
  • iOS 26.5 iPhone 17 simulator and Android API 36 arm64 emulator: each ran 11 native-app assertions through the production RpcClient and Neo VM. Both token standards accepted true, rejected false/FAULT during simulation, and faulted on false/FAULT when executing an already-created script.
  • The node HTTP responses and contract syscall outcomes were controlled local fixtures. No live chain transaction was signed or broadcast; this is not a live-token integration test.
  • Removed the local fixture, rebuilt and smoke-launched the normal product on both platforms. Both product builds had zero warnings/errors.

Simulator screenshots, result JSON and test-only fixture code remain outside the repository.

Copilot AI lite review requested due to automatic review settings September 5, 2026 06:58

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

The new test project includes an apparently-unused ProjectReference to the MAUI app project, which can unnecessarily couple unit test builds to MAUI evaluation/workloads.

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

Pull request overview

This PR hardens NEP-17 and NEP-11 transfer transaction scripts by asserting the contract’s boolean return value, ensuring a false result (or FAULT) causes the script/transaction to fault rather than HALT successfully while no transfer occurred.

Changes:

  • Introduces a shared TransferScript helper that appends ASSERT to both NEP-17 and NEP-11 transfer scripts.
  • Updates RpcClient transfer transaction creation to use the new asserted scripts.
  • Adds Neo VM regression tests that execute the real emitted scripts with a stubbed contract syscall.
File summaries
File Description
OneGateApp/Services/RPC/TransferScript.cs Centralizes NEP-17/NEP-11 transfer script emission and enforces success via ASSERT.
OneGateApp/Services/RPC/RpcClient.cs Switches transfer transaction scripts to the asserted variants.
tests/p1-02/TransferScriptTests.cs Adds VM-level regression coverage for true / false / FAULT outcomes.
tests/p1-02/TransferScript.Tests.csproj Introduces a dedicated test project for the audit regression suite.
OneGateApp.slnx Adds the new regression test project to the solution.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • 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 +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