Skip to content

chore(sdk): update address HRP prefix and encoding#3069

Merged
QuantumExplorer merged 1 commit intov3.1-devfrom
fix/sdk/hrp-an-serialization
Feb 8, 2026
Merged

chore(sdk): update address HRP prefix and encoding#3069
QuantumExplorer merged 1 commit intov3.1-devfrom
fix/sdk/hrp-an-serialization

Conversation

@shumkov
Copy link
Collaborator

@shumkov shumkov commented Feb 6, 2026

Issue being fixed or feature implemented

Fixes test failures in wasm-dpp2 and js-evo-sdk caused by #3059 which updated PlatformAddress encoding and HRP constants.

Tests were failing with:

Decoding Error - cannot decode PlatformAddress: UnexpectedVariant {
type_name: "PlatformAddress", allowed: Range { min: 0, max: 1 }, found: 176
}

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:

  • 0xb00x00 for P2PKH addresses
  • 0x800x01 for P2SH addresses

HRP prefix updates

Updated all bech32m address references to use the new Human-Readable Parts:

  • evo1dash1 (mainnet)
  • tevo1tdash1 (testnet)

Files changed

packages/wasm-dpp2:

  • tests/unit/PlatformAddress.spec.ts — byte prefixes, HRP assertions, invalid variant test
  • tests/unit/PlatformAddressInput.spec.ts — byte prefixes and comments
  • tests/unit/PlatformAddressOutput.spec.ts — byte prefixes and comments
  • tests/unit/PlatformAddressSigner.spec.ts — byte prefixes and comments
  • src/platform_address/address.rs — doc comment examples

packages/js-evo-sdk:

  • tests/unit/facades/addresses.spec.ts — byte prefixes and bech32m strings
  • src/addresses/facade.ts — doc comment examples

How Has This Been Tested?

  • cargo fmt --all — passes clean
  • cargo clippy -p wasm-dpp2 — passes clean

Breaking Changes

None. This PR only updates tests and doc comments to align with the breaking changes already introduced in 2d7ccf749.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional tests
  • I have made corresponding changes to the documentation
  • I have checked the codebase with cargo clippy and cargo fmt

Summary by CodeRabbit

  • Documentation

    • Updated address format examples and documentation to reflect new address naming conventions.
  • Tests

    • Updated test data to align with new address format specifications.

@github-actions github-actions bot added this to the v3.1.0 milestone Feb 6, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Updates 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

Cohort / File(s) Summary
Documentation Updates
packages/js-evo-sdk/src/addresses/facade.ts, packages/wasm-dpp2/src/platform_address/address.rs
Updated example prefixes and documentation strings reflecting new bech32m prefix naming convention and variant index scheme in code comments.
JS SDK Test Data
packages/js-evo-sdk/tests/unit/facades/addresses.spec.ts
Updated test mock address data from 0xb0-based PlatformAddress bytes to 0x00 variant index, and bech32 addresses from tevo1 to tdash1 prefix across multiple test cases.
WASM DPP2 Platform Address Tests
packages/wasm-dpp2/tests/unit/PlatformAddress.spec.ts, packages/wasm-dpp2/tests/unit/PlatformAddressInput.spec.ts, packages/wasm-dpp2/tests/unit/PlatformAddressOutput.spec.ts, packages/wasm-dpp2/tests/unit/PlatformAddressSigner.spec.ts
Updated test data bytes to use variant index format (0x00 for P2PKH, 0x01 for P2SH) instead of legacy type indicators, and adjusted bech32m prefixes and associated comments throughout test cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A hop through the bytes, from old schemes to new,
Where variant indices dance in the storefront view,
From tevo to tdash, the addresses rebrand,
One prefix at a time, across every land!
thump thump 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating the address HRP prefix and encoding format, which is reflected across all modified files' documentation, test data, and examples.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/sdk/hrp-an-serialization

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@QuantumExplorer QuantumExplorer merged commit b3efcd2 into v3.1-dev Feb 8, 2026
28 of 29 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/sdk/hrp-an-serialization branch February 8, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants