Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved deposit function #815

Merged
merged 11 commits into from
Feb 28, 2023
Merged

Conversation

Dinonard
Copy link
Member

@Dinonard Dinonard commented Jan 5, 2023

Pull Request Summary

Make fn deposit function weight items and bytes differently.

Summary

  • updated fn deposit
  • replaced hardcoded constants for pallet-identity with deposit function usage
  • increased price for creating a new asset
Deposit Type Shiden Astar
Per Storage Byte 0.00002 SDN 0.002 ASTR
Per Storage Item (General) 0.1 SDN 10 ASTR
Per Storage Item (Contracts) 0.004 SDN 0.4 ASTR
Asset Creation 10 SDN 1000 ASTR

Handling pallet-contracts on Shibuya & Shiden should be done as part of future update since ti requires storage migration.

Check list

  • check impact on pallet-contracts (requires storage migration)
  • scale ASTR prices by INIT_SUPPLY_FACTOR where applicable?
  • the price to create an asset in both Astar and Shiden is incredibly low
  • updated spec version
  • updated semver

@Dinonard Dinonard marked this pull request as ready for review February 27, 2023 10:49
pub const SubAccountDeposit: Balance = 2 * ASTR; // 53 bytes on-chain
pub const BasicDeposit: Balance = deposit(1, 258); // 258 bytes on-chain
pub const FieldDeposit: Balance = deposit(0, 66); // 66 bytes on-chain
pub const SubAccountDeposit: Balance = deposit(1, 53); // 53 bytes on-chain
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to get actual sizeofs for on-chain bytes instead of hand written constants?

Copy link
Member Author

@Dinonard Dinonard Feb 28, 2023

Choose a reason for hiding this comment

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

Perhaps the size of the struct being stored could be fetched via MaxEncodedLenTrait but its function isn't a const. So not right now, to the best of my knowledge - perhaps in the future.

Copy link
Member

@PierreOssun PierreOssun left a comment

Choose a reason for hiding this comment

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

LGTM

@Dinonard Dinonard merged commit 879a39b into master Feb 28, 2023
@Dinonard Dinonard deleted the feat/deposit-function-improvement branch February 28, 2023 08:09
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.

3 participants