fix: native token version defaulting to DEPOSIT#1054
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes expand native token versioning support by adding explicit Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1054 +/- ##
===========================================
+ Coverage 66.53% 87.86% +21.32%
===========================================
Files 114 114
Lines 8828 8828
Branches 2006 1996 -10
===========================================
+ Hits 5874 7757 +1883
+ Misses 2926 1043 -1883
Partials 28 28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* feat: export all types and utils from public API (#1034) * Test: Shared tests for `start` (#1032) * Merge pull request #1046 from HathorNetwork/refact/fee-test-suite refact: move fee test suite to the right folder * test: add new fee template integration tests (#1048) * refact: move fee test suite to the right folder * review changes * refact: keep only moved tests, remove new template tests * test: add new fee template integration tests * fix: native token version defaulting to deposit (#1054) * test: Shared tests for internal wallet methods (#1047) BREAKING CHANGE: HathorWallet.changeServer now returns Promise<void> instead of void, matching the service facade signature. Added changeServer to IHathorWallet. * fix: precalculated wallet address derivation bug (#1056) * feat: single address policy (#1038) * feat: single address policy * chore: improve CI integration test logs (#1049) --------- Co-authored-by: André Abadesso <andre.abadesso@gmail.com> Co-authored-by: Tulio Miranda <tulio.mir@gmail.com> Co-authored-by: André Carneiro <andreluizmrcarneiro@gmail.com>
Motivation
When the fullnode's
/versionendpoint returnsnative_tokenwithout aversionfield (e.g.{ "name": "Hathor", "symbol": "HTR" }),getNativeTokenData()was producing an object with noversionproperty. When this was later passed tomemory_store.saveToken(), its default spread ({ version: TokenVersion.DEPOSIT, ...tokenConfig }) kicked in, incorrectly tagging HTR asDEPOSIT(1) instead ofNATIVE(0).Acceptance Criteria
getNativeTokenData()always returnsversion: TokenVersion.NATIVEwhen the fullnode omits the version fieldgetNativeTokenData()forwards the fullnode-provided version as-is (including unknown values like99)getNativeTokenData()falls back toDEFAULT_NATIVE_TOKEN_CONFIGwhennative_tokenis null or version is not setsaveNativeToken()round-trip throughMemoryStorepersistsversion: NATIVE, notDEPOSITTokenVersion.DEPOSITinsaveToken()(no regression)Security Checklist
Summary by CodeRabbit
Tests
Bug Fixes