fix: native token should allow version field#420
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR extends ChangesSchema Validation Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds direct schema unit tests for FullnodeVersionSchema, two fullnode.version() tests, and a live-fullnode contract test that fails CI when the /version response stops matching the schema. Aligns FullNodeApiVersionResponse with the native_token.version field added in #420 and drops the type cast that was masking the drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wraps the three version()-related cases in a `describe('version', ...)`
block for readability. Adds a case asserting `fullnode.version()` still
parses successfully when the fullnode response omits the new
`native_token.version` field, mirroring older fullnodes that predate
#420.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Motivation
Fix the crash on the Wallet Service
testnetafter theversion fieldhas been added to the Fullnode/versionendpointA
joivalidation on the lambda side expects thenative_tokenobject to not have the newversionproperty, which it now has.Current fullnode response:
{ "version":"0.70.0-rc.1", "network":"testnet-india", "nano_contracts_enabled":true, "min_weight":8, "min_tx_weight":8, "min_tx_weight_coefficient":0.0, "min_tx_weight_k":0.0, "token_deposit_percentage":0.01, "reward_spend_min_blocks":300, "max_number_inputs":255, "max_number_outputs":255, "decimal_places":2, "genesis_block_hash":"000001b7d5abc44d3828529654e8d830eeca1cd0e313032be1b8e9dfe31052ee", "genesis_tx1_hash":"00768e4df506979bb14e0efc16748d9306fa176de54e86069d115e74b26957df", "genesis_tx2_hash":"00306abcedddfa21707e7920fe324a997e3a311a959a18724c7e8cfd0468c164", "native_token":{ "name":"Hathor", "symbol":"HTR", "version":0 } }Source:
hathor-wallet-service/packages/wallet-service/src/schemas.ts
Lines 35 to 38 in bb97797
This makes it break with
{ "level":"error", "message":"[wallet-service-india-getVersionData] Unhandled error on /version: Error: \"native_token.version\" is not allowed" }Acceptance Criteria
versionto the expected fullnodenative_tokenobjectChecklist
master, confirm this code is production-ready and can be included in future releases as soon as it gets mergedSummary by CodeRabbit