Skip to content

Commit

Permalink
Use reasonable storage fee (#1011)
Browse files Browse the repository at this point in the history
* Use reasonable storage fee

* Use deposit() to calculate storage fee in identity pallet

* Upate changelog_for_devs
  • Loading branch information
sea212 committed Jun 9, 2023
1 parent a0608e5 commit 13f4e67
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions docs/changelog_for_devs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ APIs/RPC interface.

## v0.3.9

[#1011]: https://github.com/zeitgeistpm/zeitgeist/pull/1011
[#937]: https://github.com/zeitgeistpm/zeitgeist/pull/937
[#903]: https://github.com/zeitgeistpm/zeitgeist/pull/903

### Changed

- ⚠️ Add `outsider` field to `MarketBonds` struct. In particular, the `Market`
struct's layout has changed ([#903]).
- Adjust `deposit` function used to calculate storage fees for the following
pallets: identity, multisig, preimage, proxy. The cost of adding an identity
reduced from a minimum of 125 ZTG to a minimum of 1.5243 ZTG ([#1011])

### Fixed

Expand Down
4 changes: 3 additions & 1 deletion primitives/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ pub const CENT: Balance = BASE / 100; // 100_000_000
pub const MILLI: Balance = CENT / 10; // 10_000_000
pub const MICRO: Balance = MILLI / 1000; // 10_000

/// Storage cost per byte and item.
// Approach: Achieve same cost per item and bytes in relation to total supply as on Polkadot.
pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 20 * BASE + (bytes as Balance) * 100 * MILLI
items as Balance * 150 * CENT + (bytes as Balance) * 75 * MICRO
}

// Rikiddo and TokensConfig
Expand Down
6 changes: 3 additions & 3 deletions runtime/battery-station/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ parameter_types! {

// Identity
/// The amount held on deposit for a registered identity
pub const BasicDeposit: Balance = 8 * BASE;
pub const BasicDeposit: Balance = deposit(1, 258);
/// The amount held on deposit per additional field for a registered identity.
pub const FieldDeposit: Balance = 256 * CENT;
pub const FieldDeposit: Balance = deposit(0, 66);
/// Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O
/// required to access an identity, but can be pretty high.
pub const MaxAdditionalFields: u32 = 64;
Expand All @@ -133,7 +133,7 @@ parameter_types! {
/// The amount held on deposit for a registered subaccount. This should account for the fact
/// that one storage item's value will increase by the size of an account ID, and there will
/// be another trie item whose value is the size of an account ID plus 32 bytes.
pub const SubAccountDeposit: Balance = 2 * BASE;
pub const SubAccountDeposit: Balance = deposit(1, 53);

// Liquidity Mining parameters
/// Pallet identifier, mainly used for named balance reserves.
Expand Down
6 changes: 3 additions & 3 deletions runtime/zeitgeist/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ parameter_types! {

// Identity
/// The amount held on deposit for a registered identity
pub const BasicDeposit: Balance = 100 * BASE;
pub const BasicDeposit: Balance = deposit(1, 258);
/// The amount held on deposit per additional field for a registered identity.
pub const FieldDeposit: Balance = 25 * BASE;
pub const FieldDeposit: Balance = deposit(0, 66);
/// Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O
/// required to access an identity, but can be pretty high.
pub const MaxAdditionalFields: u32 = 16;
Expand All @@ -133,7 +133,7 @@ parameter_types! {
/// The amount held on deposit for a registered subaccount. This should account for the fact
/// that one storage item's value will increase by the size of an account ID, and there will
/// be another trie item whose value is the size of an account ID plus 32 bytes.
pub const SubAccountDeposit: Balance = 20 * BASE;
pub const SubAccountDeposit: Balance = deposit(1, 53);

// Liquidity Mining parameters
/// Pallet identifier, mainly used for named balance reserves. DO NOT CHANGE.
Expand Down

0 comments on commit 13f4e67

Please sign in to comment.