Canonicalize wallet JSON unicode keys#561
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWallet.js updates ChangesCanonical JSON Serialization
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
Reviewed PR #561 at head No blocker found in this reviewed scope. Evidence checked:
Validation run locally:
This looks mergeable from my reviewed slice. |
|
Current-head review for PR #561 at I do not see a blocker in the wallet JSON canonicalization slice. The implementation changes the browser signing path from native Additional evidence I checked beyond the existing focused regression: I also ran an ad hoc Node/Python canonicalization probe with escaped non-BMP keys and values ( That covers the key UTF-16-vs-code-point ordering edge this PR is meant to fix. No private keys, wallet material, cookies, tokens, signatures, private data, price/liquidity/exchange/off-ramp claims, or fabricated payout claims were used. |
eliasx45
left a comment
There was a problem hiding this comment.
No blocker found on this head.
I checked the browser/server canonicalization boundary because this is the risky part of the change. The new stableJson() path now sorts object keys by Unicode code point rather than UTF-16 unit order, and asciiJson() emits non-ASCII values/keys in the same escaped form the Python server signs through canonical_wallet_json(). That covers the important astral-key case where default JS sorting would otherwise disagree with Python.
Validated locally:
git diff --check origin/main...HEADPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_wallet_api.py::test_wallet_js_canonicalizes_unicode_like_server tests\test_wallet_api.py::test_wallet_api_register_lookup_and_transfer tests\test_wallet_api.py::test_github_session_can_link_and_claim_wallet -q-> 3 passedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_wallet_api.py -q-> 33 passednode --check app\static\wallet.js.\.venv\Scripts\python.exe -m ruff check tests\test_wallet_api.py.\.venv\Scripts\python.exe -m ruff format --check tests\test_wallet_api.pyPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m mypy app\wallets.py app\ledger\service.pyPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_wallet_api.py tests\test_ledger.py -q-> 55 passedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest -q-> 415 passedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe scripts\docs_smoke.py-> docs smoke ok
Bounty #406
Summary:
wallet.jscanonical JSON with servercanonical_wallet_json()for Unicode strings and object keysjson.dumps(..., ensure_ascii=True)sort_keys=TrueEvidence:
wallet.jsuses nativeJSON.stringifyplus default JavaScript.sort(), so non-ASCII values are not escaped like the server and keys such as"\\ue000"and"😀"are ordered by UTF-16 code units instead of Python Unicode code pointsValidation:
Summary by CodeRabbit
Bug Fixes
Tests