chore(sdk): update address HRP prefix and encoding#3069
chore(sdk): update address HRP prefix and encoding#3069QuantumExplorer merged 1 commit intov3.1-devfrom
Conversation
📝 WalkthroughWalkthroughUpdates platform address byte prefix scheme across TypeScript and Rust test files and documentation, replacing legacy address type indicators (0xb0 for P2PKH, 0x80 for P2SH) with variant indices (0x00, 0x01), and updating bech32m prefixes from "tevo1"/"evo1" to "tdash1"/"dash1". Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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 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 |
Issue being fixed or feature implemented
Fixes test failures in
wasm-dpp2andjs-evo-sdkcaused by #3059 which updated PlatformAddress encoding and HRP constants.Tests were failing with:
This occurred because
from_bytes()/to_bytes()now use bincode serialization with variant indices (0x00= P2PKH,0x01= P2SH) instead of the previous bech32m type bytes (0xb0= P2PKH,0x80= P2SH). Value 176 (0xb0) is no longer a valid variant index.What was done?
Test byte format updates
Updated all test files to use the new bincode storage format variant indices:
0xb0→0x00for P2PKH addresses0x80→0x01for P2SH addressesHRP prefix updates
Updated all bech32m address references to use the new Human-Readable Parts:
evo1→dash1(mainnet)tevo1→tdash1(testnet)Files changed
packages/wasm-dpp2:tests/unit/PlatformAddress.spec.ts— byte prefixes, HRP assertions, invalid variant testtests/unit/PlatformAddressInput.spec.ts— byte prefixes and commentstests/unit/PlatformAddressOutput.spec.ts— byte prefixes and commentstests/unit/PlatformAddressSigner.spec.ts— byte prefixes and commentssrc/platform_address/address.rs— doc comment examplespackages/js-evo-sdk:tests/unit/facades/addresses.spec.ts— byte prefixes and bech32m stringssrc/addresses/facade.ts— doc comment examplesHow Has This Been Tested?
cargo fmt --all— passes cleancargo clippy -p wasm-dpp2— passes cleanBreaking Changes
None. This PR only updates tests and doc comments to align with the breaking changes already introduced in
2d7ccf749.Checklist
cargo clippyandcargo fmtSummary by CodeRabbit
Documentation
Tests