Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The mapper changes are narrow, match the stated requirements, and are backed by targeted regression tests that validate immutability, fee precision, and nested-transaction metadata behavior.
Pull request overview
This PR addresses audit item P2-13 by introducing a mapper that adapts verbose Neo node RPC JSON from dAPI getBlock / getTransaction into NEP-21-aligned field names and types (camelCase names; sender/next-consensus decoded to UInt160 script hashes) while preserving fee string precision and leaving the source RPC JSON unmodified.
Changes:
- Added
DapiQueryResponseMapperto deep-clone and transformgetblock/getrawtransactionverbose results into NEP-21 query shapes (including nested tx metadata propagation from enclosing blocks). - Wired the mapper into the dAPI surface in
LaunchDAppPageforGetBlockandGetTransaction. - Added a dedicated regression-test project (plus coverage runsettings and documentation) to validate field mapping, immutability, nested transaction behavior, and fee-string precision.
File summaries
| File | Description |
|---|---|
| tests/p2-13/README.md | Documents the mapping contract, invariants (immutability, fee precision), and validation steps for P2-13 regression tests. |
| tests/p2-13/OneGate.DapiQuery.Tests.csproj | Adds a focused test project that links the production mapper and uses Neo 3.10.0 for fixtures. |
| tests/p2-13/DapiQueryResponseMapperTests.cs | Introduces unit tests covering field renames, address decoding, nested tx metadata propagation, and non-mutation guarantees. |
| tests/p2-13/coverage.runsettings | Adds coverage configuration targeting the mapper for the new test project. |
| OneGateApp/Services/RPC/DapiQueryResponseMapper.cs | Implements the RPC-to-NEP-21 JSON adaptation while preserving fee string precision and avoiding mutation of the input JSON. |
| OneGateApp/Pages/LaunchDAppPage.xaml.dAPI.cs | Updates dAPI GetBlock / GetTransaction to return mapped NEP-21-shaped responses. |
| OneGateApp.slnx | Registers the new P2-13 test project in the solution. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Fix audit P2-13: adapt verbose node JSON returned by dAPI
getBlockandgetTransactionto the NEP-21 query field names and types.Validation
dotnet test tests/p2-13/OneGate.DapiQuery.Tests.csproj --no-restore --nologo: 11/11 passed. Fixtures use the application's Neo 3.10.0 serialization.479bae85c68333104a2ca1fffaa0a6d790872d940533765dd9e8b53f08ea785f; matched to both platform evidence sets before committing.Limitations and integration
No live-chain query, signing, approval or broadcast was performed. Clients relying on nonstandard lowercase node fields must use the NEP-21 names; screenshots and QA fixtures remain outside the repository and are not attached here, and no hosted CI pass is claimed.
Independently based and validated on
master@623603d; preserve solution project entries as a union and revalidate after integration rather than treating this as combined audit validation. This query-mapping change has no dependency on a bridge-origin authorization redesign.