feat: ✨ Standardize currency system to HAVE token with Wei-based units#130
feat: ✨ Standardize currency system to HAVE token with Wei-based units#130ahmadkaouk merged 9 commits intomainfrom
Conversation
- Switch from decimal-based units to Ethereum-compatible Wei units (18 decimals) - Set ExistentialDeposit to 0 for dust account support - Configure proper block weights and gas limits for solochain operation - Update fee structure to align with Ethereum standards - Fix treasury tests to handle zero existential deposit behavior BREAKING CHANGE: Currency units changed from 12 to 18 decimals 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Rename UNIT → HAVE across all three runtimes (mainnet, stagenet, testnet) - Rename KILOUNIT → KILOHAVE, MILLIUNIT → MILLIHAVE, MICROUNIT → MICROHAVE - Update storage hub parameters and comments to use HAVE terminology - Update all tests to reference HAVE instead of UNIT - Preserve supply factor differences: mainnet=100, stagenet/testnet=1 The native token is now consistently called HAVE throughout the codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughRefactors runtimes to a HAVE-based currency unit system, replaces static existential-deposit constants with parameterized Get types, introduces centralized currency modules and dynamic BlockWeights, updates EVM/gas/fees wiring, adjusts metadata-hash denominations, and migrates tests and configs across mainnet, stagenet, and testnet to the new units and weight model. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Extrinsic
participant Runtime
participant Currency as currency module
participant Weights as BlockWeights
participant Balances
participant EVM
participant Treasury
User->>Extrinsic: Submit transaction
Extrinsic->>Runtime: Dispatch call
Runtime->>Weights: BlockWeights::get()
Runtime->>Currency: WEIGHT_PER_GAS, fees, units (HAVE)
alt EVM call
Runtime->>EVM: Gas price via TransactionPaymentAsGasPrice
EVM->>Treasury: Base fee portion
else Substrate call
Runtime->>Balances: Charge fee (WeightToFee using MILLIHAVE)
Balances->>Treasury: Fees/tips per DealWithFees
end
Runtime->>Balances: Check ExistentialDeposit::get()
Runtime-->>User: Apply result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (27)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
ahmadkaouk
left a comment
There was a problem hiding this comment.
There seems to be an issue with the benchmarks of the pallet balances after this change
|
@ahmadkaouk Good catch. I will create a separate ticket for this. It will be fixed by paritytech/polkadot-sdk#7379 when we upgrade to Polkadot SDK stable2503. |
Updated all proxy test files across mainnet, stagenet, and testnet runtimes to use HAVE instead of UNIT, aligning with the native token naming convention.
Summary
This PR modernizes DataHaven's currency system by standardizing all three runtimes (mainnet, stagenet, testnet) to use Ethereum-compatible Wei-based units with HAVE as the native token name.
Key Changes
🔄 Currency Unit Standardization
insecure_zero_edfeature🏷️ Token Naming
⚖️ Block Weights & Gas Configuration
🧪 Test Updates
Breaking Changes
Runtime Coverage
Technical Details
Fee Structure
Block Configuration
Test Plan
Files Modified
27 files changed, 728 insertions(+), 342 deletions(-)
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements