Skip to content

feat(platform)!: update PlatformAddress encoding and HRP constants#3059

Merged
QuantumExplorer merged 2 commits into
v3.1-devfrom
featupdate-platform-address-encoding
Feb 5, 2026
Merged

feat(platform)!: update PlatformAddress encoding and HRP constants#3059
QuantumExplorer merged 2 commits into
v3.1-devfrom
featupdate-platform-address-encoding

Conversation

@QuantumExplorer
Copy link
Copy Markdown
Member

@QuantumExplorer QuantumExplorer commented Feb 5, 2026

Issue being fixed or feature implemented

Update the PlatformAddress encoding to use the correct Human-Readable Parts (HRP) and type bytes for both user-facing and storage representations.

What was done?

  • Changed the HRP constants for mainnet and testnet from "evo" and "tevo" to "dash" and "tdash", respectively.
  • Updated comments to clarify the distinction between bech32m encoding type bytes and storage type bytes.
  • Modified the encoding and decoding methods to ensure they use the correct type bytes for both user-facing addresses and storage keys.
  • Adjusted tests to reflect the new HRP values and verify the correct encoding and decoding behavior.

How Has This Been Tested?

All existing unit tests were updated and passed successfully, ensuring that the new HRP and type byte changes work as intended.

Breaking Changes

None, but this unbreaks a breaking change.

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/e2e tests
  • I have added ! to the title and described breaking changes in the corresponding section if my code contains any.

Summary by CodeRabbit

  • New Features

    • Added bech32m encode/decode methods for user-facing platform addresses with network detection.
  • Changes

    • Mainnet HRP changed from "evo" to "dash"; testnets changed from "tevo" to "tdash".
    • Clear separation between user-facing address encoding and on-disk/storage address format.
    • Serialization/deserialization updated to use the new storage format; tests updated accordingly.

@github-actions github-actions Bot added this to the v3.1.0 milestone Feb 5, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Single-file update to PlatformAddress separating bech32m-facing type bytes from storage bytes, changing HRPs ("evo" → "dash", "tevo" → "tdash"), adding to_bech32m_string/from_bech32m_string, and refactoring to_bytes/from_bytes to use storage-format type bytes (0x00/0x01).

Changes

Cohort / File(s) Summary
Platform Address Encoding Refactor
packages/rs-dpp/src/address_funds/platform_address.rs
Adds distinct bech32m encoding/decoding (to_bech32m_string, from_bech32m_string) using bech32m type bytes (0xb0/0x80); changes storage byte format for to_bytes/from_bytes to 0x00/0x01 and uses bincode for serialization; updates HRP constants (PLATFORM_HRP_MAINNET → "dash", PLATFORM_HRP_TESTNET → "tdash"); updates hrp_for_network mapping and related tests/documentation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through bytes both bright and stark,
Split bech32m for users, storage in the dark,
"dash" and "tdash" now lead the way,
Two type-bytes dance where once one lay,
A little rabbit cheers the new display! 🎉

🚥 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 captures the main changes: HRP constant updates and PlatformAddress encoding modifications with correct type bytes.
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 featupdate-platform-address-encoding

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 changed the title feat:! update PlatformAddress encoding and HRP constants feat(platform)!: update PlatformAddress encoding and HRP constants Feb 5, 2026
Copy link
Copy Markdown
Member Author

@QuantumExplorer QuantumExplorer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self Reviewed

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/rs-dpp/src/address_funds/platform_address.rs`:
- Around line 88-91: The change of HRP constants PLATFORM_HRP_MAINNET and
PLATFORM_HRP_TESTNET to "dash"/"tdash" breaks decoding of existing bech32m
addresses using "evo"/"tevo"; either document this as a breaking change and
update the comment in wasm-dpp2's address.rs (the doc near from_bech32m_string)
to reflect the new HRPs, or restore backward compatibility by modifying the
from_bech32m_string decoding logic to accept both the new HRPs ("dash","tdash")
and the old HRPs ("evo","tevo") during a transition (detect HRP and normalize to
current constants), then add a clear comment noting the transitional behavior
and a TODO to remove legacy support later.

Comment on lines 88 to +91
/// Human-readable part for Platform addresses on mainnet (DIP-0018)
pub const PLATFORM_HRP_MAINNET: &str = "evo";
pub const PLATFORM_HRP_MAINNET: &str = "dash";
/// Human-readable part for Platform addresses on testnet/devnet/regtest (DIP-0018)
pub const PLATFORM_HRP_TESTNET: &str = "tevo";
pub const PLATFORM_HRP_TESTNET: &str = "tdash";
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Search for old HRP values in the codebase
rg -n '"evo"' --type rust
rg -n '"tevo"' --type rust
rg -n "evo" --type rust | grep -i hrp

Repository: dashpay/platform

Length of output: 461


🏁 Script executed:

# Look for bech32m-related functions and their implementations
rg -n "from_bech32m|to_bech32m|bech32" --type rust -B 2 -A 10 | head -100

Repository: dashpay/platform

Length of output: 8650


🏁 Script executed:

# Search for the file containing these constants to understand context
cat -n packages/rs-dpp/src/address_funds/platform_address.rs | head -120

Repository: dashpay/platform

Length of output: 5010


🏁 Script executed:

# Search for the from_bech32m_string function implementation
rg -n "from_bech32m_string" --type rust -B 2 -A 15

Repository: dashpay/platform

Length of output: 26057


🏁 Script executed:

# Search for the complete PlatformAddress implementation with bech32m handling
rg -n "fn from_bech32m|impl.*PlatformAddress" --type rust -A 20 | grep -A 20 "from_bech32m"

Repository: dashpay/platform

Length of output: 7646


🏁 Script executed:

# Search for any migration or backward compatibility handling for old HRP values
rg -n "evo|tevo" --type rust -B 3 -A 3 | grep -i "compat\|migrat\|deprecat\|old"

Repository: dashpay/platform

Length of output: 491


🏁 Script executed:

# Check if there's a CHANGELOG or breaking changes documentation
find . -maxdepth 2 -type f \( -name "CHANGELOG*" -o -name "BREAKING*" -o -name "MIGRATION*" \) | head -10

Repository: dashpay/platform

Length of output: 74


🏁 Script executed:

# Look at the wasm-dpp2 file to see the full comment context about accepting old HRPs
sed -n '285,300p' packages/wasm-dpp2/src/platform_address/address.rs

Repository: dashpay/platform

Length of output: 693


Breaking change: HRP values updated with no backward compatibility.

Changing HRP from "evo"/"tevo" to "dash"/"tdash" is a confirmed user-facing breaking change. The implementation strictly rejects old HRP values; any existing bech32m-encoded addresses using the old HRPs will fail to decode.

Additionally, the documentation in packages/wasm-dpp2/src/platform_address/address.rs (line 293) is outdated—it still claims "Accepts addresses with either mainnet ("evo") or testnet ("tevo") HRP," but the actual implementation in from_bech32m_string only accepts the new HRPs and returns an error for old ones.

Recommendations:

  1. Document this as a breaking change in the PR/release notes
  2. Update the wasm-dpp2 comment to reflect the current HRP requirements
  3. If backward compatibility is needed, implement support for both old and new HRPs during a transition period
🤖 Prompt for AI Agents
In `@packages/rs-dpp/src/address_funds/platform_address.rs` around lines 88 - 91,
The change of HRP constants PLATFORM_HRP_MAINNET and PLATFORM_HRP_TESTNET to
"dash"/"tdash" breaks decoding of existing bech32m addresses using "evo"/"tevo";
either document this as a breaking change and update the comment in wasm-dpp2's
address.rs (the doc near from_bech32m_string) to reflect the new HRPs, or
restore backward compatibility by modifying the from_bech32m_string decoding
logic to accept both the new HRPs ("dash","tdash") and the old HRPs
("evo","tevo") during a transition (detect HRP and normalize to current
constants), then add a clear comment noting the transitional behavior and a TODO
to remove legacy support later.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will fix this in a later PR @shumkov

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@QuantumExplorer QuantumExplorer merged commit 2d7ccf7 into v3.1-dev Feb 5, 2026
85 of 87 checks passed
@QuantumExplorer QuantumExplorer deleted the featupdate-platform-address-encoding branch February 5, 2026 19:27
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