Assert successful token transfer results - #105
Open
Jim8y wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
🟡 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
TransferScripthelper that appendsASSERTto both NEP-17 and NEP-11 transfer scripts. - Updates
RpcClienttransfer 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The wallet's NEP-17 and NEP-11 transfer scripts discarded the contract's boolean return value. A contract returning
falsecould therefore leave the VM in HALT without completing a transfer.Change
Append
ASSERTto 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
RpcClientand Neo VM. Both token standards accepted true, rejected false/FAULT during simulation, and faulted on false/FAULT when executing an already-created script.Simulator screenshots, result JSON and test-only fixture code remain outside the repository.