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

Actually Lower ED #158

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Upgrade parachains runtime API from v7 to v8 in Kusama ([polkadot-fellows/runtimes#148](https://github.com/polkadot-fellows/runtimes/pull/148)). Context: https://paritytech.github.io/polkadot-sdk/book/protocol-validator-disabling.html
- Fixed the lowering of Asset Hub existential deposits.

## [1.1.0] 10.01.2024

Expand Down
6 changes: 1 addition & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
hex-literal = { version = "0.4.1" }
log = { version = "0.4.20", default-features = false }
scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }
smallvec = "1.11.0"

# Local
bp-asset-hub-kusama = { path = "./primitives", default-features = false}
Expand Down
106 changes: 0 additions & 106 deletions system-parachains/asset-hubs/asset-hub-kusama/src/constants.rs

This file was deleted.

12 changes: 6 additions & 6 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ impl pallet_authorship::Config for Runtime {
}

parameter_types! {
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
// This comes from system_parachains_constants::kusama::currency and is the ED for all system
// parachains. For Asset Hub in particular, we set it to 1/10th of the amount.
pub const ExistentialDeposit: Balance = SYSTEM_PARA_EXISTENTIAL_DEPOSIT / 10;
}

impl pallet_balances::Config for Runtime {
Expand Down Expand Up @@ -250,7 +252,6 @@ impl pallet_transaction_payment::Config for Runtime {
parameter_types! {
pub const AssetDeposit: Balance = UNITS / 10; // 1 / 10 UNITS deposit to create asset
pub const AssetAccountDeposit: Balance = deposit(1, 16);
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT;
pub const AssetsStringLimit: u32 = 50;
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1)
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271
Expand All @@ -277,7 +278,7 @@ impl pallet_assets::Config<TrustBackedAssetsInstance> for Runtime {
type AssetDeposit = AssetDeposit;
type MetadataDepositBase = MetadataDepositBase;
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type ApprovalDeposit = ExistentialDeposit;
type StringLimit = AssetsStringLimit;
type Freezer = ();
type Extra = ();
Expand Down Expand Up @@ -317,7 +318,7 @@ impl pallet_assets::Config<PoolAssetsInstance> for Runtime {
type AssetAccountDeposit = ConstU128<0>;
type MetadataDepositBase = ConstU128<0>;
type MetadataDepositPerByte = ConstU128<0>;
type ApprovalDeposit = ApprovalDeposit;
type ApprovalDeposit = ExistentialDeposit;
type StringLimit = ConstU32<50>;
type Freezer = ();
type Extra = ();
Expand Down Expand Up @@ -363,7 +364,6 @@ parameter_types! {
// we just reuse the same deposits
pub const ForeignAssetsAssetDeposit: Balance = AssetDeposit::get();
pub const ForeignAssetsAssetAccountDeposit: Balance = AssetAccountDeposit::get();
pub const ForeignAssetsApprovalDeposit: Balance = ApprovalDeposit::get();
pub const ForeignAssetsAssetsStringLimit: u32 = AssetsStringLimit::get();
pub const ForeignAssetsMetadataDepositBase: Balance = MetadataDepositBase::get();
pub const ForeignAssetsMetadataDepositPerByte: Balance = MetadataDepositPerByte::get();
Expand All @@ -389,7 +389,7 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type AssetDeposit = ForeignAssetsAssetDeposit;
type MetadataDepositBase = ForeignAssetsMetadataDepositBase;
type MetadataDepositPerByte = ForeignAssetsMetadataDepositPerByte;
type ApprovalDeposit = ForeignAssetsApprovalDeposit;
type ApprovalDeposit = ExistentialDeposit;
type StringLimit = ForeignAssetsAssetsStringLimit;
type Freezer = ();
type Extra = ();
Expand Down
19 changes: 18 additions & 1 deletion system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ fn collator_session_keys() -> CollatorSessionKeys<Runtime> {
)
}

#[test]
fn test_ed_is_one_hundredth_of_relay() {
ExtBuilder::<Runtime>::default()
.with_collators(vec![AccountId::from(ALICE)])
.with_session_keys(vec![(
AccountId::from(ALICE),
AccountId::from(ALICE),
SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) },
)])
.build()
.execute_with(|| {
let relay_ed = kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT;
let ah_ed = ExistentialDeposit::get();
assert_eq!(relay_ed / 100, ah_ed);
});
}

#[test]
fn test_asset_xcm_trader() {
ExtBuilder::<Runtime>::default()
Expand Down Expand Up @@ -257,7 +274,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() {
RuntimeHelper::run_to_block(2, AccountId::from(ALICE));

// We are going to buy small amount
let bought = Weight::from_parts(500_000_000u64, 0);
let bought = Weight::from_parts(50_000_000u64, 0);

let asset_multilocation = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap();

Expand Down
1 change: 0 additions & 1 deletion system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
hex-literal = { version = "0.4.1", optional = true }
log = { version = "0.4.20", default-features = false }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
smallvec = "1.11.1"

# Local
bp-asset-hub-kusama = { path = "../asset-hub-kusama/primitives", default-features = false}
Expand Down
107 changes: 0 additions & 107 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/constants.rs

This file was deleted.

Loading
Loading