Skip to content

Commit

Permalink
Increase existential deposit (#1397)
Browse files Browse the repository at this point in the history
* Increase existential deposit

* Make test independent of `ExistentialDeposit` definition

* Remove contracts

* Add notes to changelog

* Prettier

* Fix benchmarks

* .
  • Loading branch information
maltekliemann authored Dec 4, 2024
1 parent b3d2884 commit ca88b16
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 243 deletions.
37 changes: 27 additions & 10 deletions docs/changelog_for_devs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@ As of 0.3.9, the changelog's format is based on
components which query the chain's storage, the extrinsics or the runtime
APIs/RPC interface.

## v0.5.6

- Increase existential deposit of all non-foreign assets to `BASE`.
- Remove pallet-contracts from all runtimes.

## v0.5.5

- Fix Rikiddo migration (#1363)
- Fix incorrect documentation of XcmMetadata::fee_factor (#1360)
- Remove old migrations and clear pallet storage (#1352)

## v0.5.4

- ⚠️ Remove zrml-liquidity-mining from code base.
- ⚠️ Remove zrml-rikiddo from the code base.
- ⚠️ Remove zrml-liquidity-mining from code base.
- ⚠️ Remove zrml-rikiddo from the code base.

## v0.5.2

Expand Down Expand Up @@ -135,20 +146,26 @@ if ztg_supply / campaign_asset_supply >= 100 {

### Changes

- ⚠️ Move the `zeitgeist_primitives::Pool` struct to `zrml_swaps::types::Pool` and change the following fields ([#1197]):
- Remove `market_id`
- Make `swap_fee` non-optional
- Remove `total_subsidy`
- Make `total_weight` non-optional
- Make `weights` non-optional
- ⚠️ Change the type of `liquidity_shares_manager` in `zrml_neo_swaps::types::Pool` from `zrml_neo_swaps::types::SoloLp` to `zrml_neo_swaps::types::LiquidityTree`. Details on the liquidity tree can be found in the `README.md` of zrml-neo-swaps and the documentation of the `LiquidityTree` object ([#1179]).
- ⚠️ Move the `zeitgeist_primitives::Pool` struct to `zrml_swaps::types::Pool`
and change the following fields ([#1197]):
- Remove `market_id`
- Make `swap_fee` non-optional
- Remove `total_subsidy`
- Make `total_weight` non-optional
- Make `weights` non-optional
- ⚠️ Change the type of `liquidity_shares_manager` in
`zrml_neo_swaps::types::Pool` from `zrml_neo_swaps::types::SoloLp` to
`zrml_neo_swaps::types::LiquidityTree`. Details on the liquidity tree can be
found in the `README.md` of zrml-neo-swaps and the documentation of the
`LiquidityTree` object ([#1179]).

### Migrations

- Closed all CPMM pools. Withdrawals are still allowed. Creating new pools will
be impossible until further updates are deployed. ([#1197])
- Remove all Rikiddo storage elements. ([#1197])
- Migrate neo-swaps `Pools` storage. The market creator's liquidity position is translated into a position in the liquidity tree of the same value ([#1178]).
- Migrate neo-swaps `Pools` storage. The market creator's liquidity position is
translated into a position in the liquidity tree of the same value ([#1178]).

### Removed

Expand Down
1 change: 1 addition & 0 deletions primitives/src/constants/base_multiples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub const _40: u128 = 40 * _1;
pub const _70: u128 = 70 * _1;
pub const _80: u128 = 80 * _1;
pub const _100: u128 = 100 * _1;
pub const _200: u128 = 200 * _1;
pub const _101: u128 = 101 * _1;
pub const _444: u128 = 444 * _1;
pub const _500: u128 = 500 * _1;
Expand Down
64 changes: 1 addition & 63 deletions runtime/battery-station/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,12 @@ use frame_support::{
weights::{constants::RocksDbWeight, ConstantMultiplier, IdentityFee, Weight},
};
use frame_system::{EnsureRoot, EnsureWithSuccess};
use orml_currencies::Call::transfer;
use pallet_collective::{EnsureProportionAtLeast, PrimeDefaultVote};
use sp_runtime::traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256};
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use zeitgeist_primitives::types::*;
use zrml_prediction_markets::Call::{
buy_complete_set, create_market, dispute, edit_market, redeem_shares, report, sell_complete_set,
};
use zrml_swaps::Call::{
force_pool_exit, pool_exit, pool_exit_with_exact_asset_amount,
pool_exit_with_exact_pool_amount, pool_join, pool_join_with_exact_asset_amount,
pool_join_with_exact_pool_amount, swap_exact_amount_in, swap_exact_amount_out,
};
use zrml_swaps::Call::force_pool_exit;
#[cfg(feature = "parachain")]
use {
frame_support::traits::{AsEnsureOriginWithArg, Everything, Nothing},
Expand Down Expand Up @@ -104,60 +96,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
state_version: 1,
};

#[derive(scale_info::TypeInfo)]
pub struct ContractsCallfilter;

impl Contains<RuntimeCall> for ContractsCallfilter {
fn contains(runtime_call: &RuntimeCall) -> bool {
#[allow(clippy::match_like_matches_macro)]
match runtime_call {
RuntimeCall::System(inner_call) => match inner_call {
SystemCall::remark { .. } => true,
SystemCall::remark_with_event { .. } => true,
_ => false,
},
RuntimeCall::AssetManager(transfer { .. }) => true,
RuntimeCall::PredictionMarkets(inner_call) => {
match inner_call {
buy_complete_set { .. } => true,
dispute { .. } => true,
// Only allow markets using Authorized or Court dispute mechanism
create_market {
dispute_mechanism:
Some(MarketDisputeMechanism::Authorized)
| Some(MarketDisputeMechanism::Court),
..
} => true,
edit_market {
dispute_mechanism:
Some(MarketDisputeMechanism::Authorized)
| Some(MarketDisputeMechanism::Court),
..
} => true,
redeem_shares { .. } => true,
report { .. } => true,
sell_complete_set { .. } => true,
_ => false,
}
}
RuntimeCall::Swaps(inner_call) => match inner_call {
pool_exit { .. } => true,
pool_exit_with_exact_asset_amount { .. } => true,
pool_exit_with_exact_pool_amount { .. } => true,
pool_join { .. } => true,
pool_join_with_exact_asset_amount { .. } => true,
pool_join_with_exact_pool_amount { .. } => true,
swap_exact_amount_in { .. } => true,
swap_exact_amount_out { .. } => true,
_ => false,
},
RuntimeCall::Orderbook(_) => true,
RuntimeCall::Parimutuel(_) => true,
_ => false,
}
}
}

#[derive(scale_info::TypeInfo)]
pub struct IsCallable;

Expand Down
13 changes: 2 additions & 11 deletions runtime/battery-station/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ parameter_types! {
pub const CorrectionPeriod: BlockNumber = BLOCKS_PER_DAY;

// Balance
pub const ExistentialDeposit: u128 = 5 * MILLI;
pub const ExistentialDeposit: u128 = BASE / 2;
pub const MaxHolds: u32 = 1;
pub const MaxFreezes: u32 = 1;
pub const MaxLocks: u32 = 50;
Expand All @@ -90,16 +90,7 @@ parameter_types! {
pub const TechnicalCommitteeMotionDuration: BlockNumber = 7 * BLOCKS_PER_DAY;

// Contracts
pub const ContractsCodeHashLockupDepositPercent: Perbill = Perbill::from_percent(10);
pub const ContractsDefaultDepositLimit: Balance = deposit(16, 16 * 1024 * 1024);
pub const ContractsDepositPerByte: Balance = deposit(0,1);
pub const ContractsDepositPerItem: Balance = deposit(1,0);
pub const ContractsMaxCodeLen: u32 = 123 * 1024;
pub const ContractsMaxDebugBufferLen: u32 = 2 * 1024 * 1024;
pub const ContractsMaxDelegateDependencies: u32 = 32;
pub const ContractsMaxStorageKeyLen: u32 = 128;
pub const ContractsUnsafeUnstableInterface: bool = true;
pub ContractsSchedule: pallet_contracts::Schedule<Runtime> = Default::default();

// Court
/// (Slashable) Bond that is provided for overriding the last appeal.
Expand Down Expand Up @@ -309,7 +300,7 @@ parameter_types! {
pub const OrderbookPalletId: PalletId = ORDERBOOK_PALLET_ID;

// Parimutuel parameters
pub const MinBetSize: Balance = 100 * ExistentialDeposit::get();
pub const MinBetSize: Balance = 5 * BASE;
pub const ParimutuelPalletId: PalletId = PARIMUTUEL_PALLET_ID;

// System
Expand Down
10 changes: 5 additions & 5 deletions runtime/common/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ macro_rules! impl_foreign_fees {
if can_withdraw != WithdrawConsequence::Success {
return Err(InvalidTransaction::Payment.into());
}
<Tokens as Balanced<AccountId>>::withdraw(
let result = <Tokens as Balanced<AccountId>>::withdraw(
currency_id,
who,
converted_fee,
Precision::Exact,
Preservation::Expendable,
Fortitude::Force,
)
.map_err(|_| TransactionValidityError::from(InvalidTransaction::Payment))
);
result.map_err(|_| TransactionValidityError::from(InvalidTransaction::Payment))
}

fn correct_and_deposit_fee(
Expand Down Expand Up @@ -318,7 +318,7 @@ macro_rules! fee_tests {
use pallet_asset_tx_payment::OnChargeAssetTransaction;
use sp_core::H256;
use sp_runtime::BuildStorage;
use zeitgeist_primitives::constants::BASE;
use zeitgeist_primitives::constants::{BASE, MILLI};

fn run_with_system_weight<F>(w: Weight, mut assertions: F)
where
Expand Down Expand Up @@ -603,7 +603,7 @@ macro_rules! fee_tests {
decimals: 10,
name: "Polkadot".as_bytes().to_vec().try_into().unwrap(),
symbol: "DOT".as_bytes().to_vec().try_into().unwrap(),
existential_deposit: ExistentialDeposit::get(),
existential_deposit: 5 * MILLI,
location: Some(xcm::VersionedMultiLocation::V3(
xcm::latest::MultiLocation::parent(),
)),
Expand Down
Loading

0 comments on commit ca88b16

Please sign in to comment.