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

Remove zrml-simple-disputes and migrate markets #1344

Merged
merged 8 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 0 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
/zrml/orderbook/ @Chralt98
/zrml/parimutuel/ @Chralt98
/zrml/prediction-markets/ @maltekliemann
/zrml/simple-disputes/ @Chralt98
/zrml/styx/ @yornaath
/zrml/swaps/ @maltekliemann

Expand Down
27 changes: 0 additions & 27 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ default-members = [
"zrml/parimutuel",
"zrml/prediction-markets",
"zrml/prediction-markets/runtime-api",
"zrml/simple-disputes",
"zrml/swaps",
"zrml/swaps/rpc",
"zrml/swaps/runtime-api",
Expand All @@ -43,7 +42,6 @@ members = [
"zrml/prediction-markets",
"zrml/prediction-markets/fuzz",
"zrml/prediction-markets/runtime-api",
"zrml/simple-disputes",
"zrml/swaps",
"zrml/swaps/fuzz",
"zrml/swaps/rpc",
Expand Down Expand Up @@ -241,7 +239,6 @@ zrml-orderbook = { path = "zrml/orderbook", default-features = false }
zrml-parimutuel = { path = "zrml/parimutuel", default-features = false }
zrml-prediction-markets = { path = "zrml/prediction-markets", default-features = false }
zrml-prediction-markets-runtime-api = { path = "zrml/prediction-markets/runtime-api", default-features = false }
zrml-simple-disputes = { path = "zrml/simple-disputes", default-features = false }
zrml-styx = { path = "zrml/styx", default-features = false }
zrml-swaps = { path = "zrml/swaps", default-features = false }
zrml-swaps-runtime-api = { path = "zrml/swaps/runtime-api", default-features = false }
Expand Down
3 changes: 0 additions & 3 deletions primitives/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ pub const MAX_ORACLE_DURATION: BlockNumber = 14 * BLOCKS_PER_DAY;
/// Pallet identifier, mainly used for named balance reserves.
pub const PM_PALLET_ID: PalletId = PalletId(*b"zge/pred");

// Simple Disputes
pub const SD_PALLET_ID: PalletId = PalletId(*b"zge/sedp");

// Swaps
/// Max. assets in a swap pool.
pub const MAX_ASSETS: u16 = MAX_CATEGORIES + 1;
Expand Down
7 changes: 0 additions & 7 deletions primitives/src/constants/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ parameter_types! {
pub const ValidityBond: Balance = 50 * CENT;
}

// Simple disputes parameters
parameter_types! {
pub const SimpleDisputesPalletId: PalletId = PalletId(*b"zge/sedp");
pub const OutcomeBond: Balance = 5 * BASE;
pub const OutcomeFactor: Balance = 2 * BASE;
}

// Swaps parameters
parameter_types! {
pub const ExitFee: Balance = 3 * BASE / 1000; // 0.3%
Expand Down
1 change: 0 additions & 1 deletion primitives/src/market.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ pub struct MarketDispute<AccountId, BlockNumber, Balance> {
pub enum MarketDisputeMechanism {
Authorized,
Court,
SimpleDisputes,
}

/// Defines whether the period is represented as a blocknumber or a timestamp.
Expand Down
4 changes: 0 additions & 4 deletions runtime/battery-station/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ zrml-neo-swaps = { workspace = true }
zrml-orderbook = { workspace = true }
zrml-parimutuel = { workspace = true }
zrml-prediction-markets = { workspace = true }
zrml-simple-disputes = { workspace = true }
zrml-styx = { workspace = true }
zrml-swaps = { workspace = true }
zrml-swaps-runtime-api = { workspace = true }
Expand Down Expand Up @@ -216,7 +215,6 @@ runtime-benchmarks = [
"zrml-neo-swaps/runtime-benchmarks",
"zrml-parimutuel/runtime-benchmarks",
"zrml-prediction-markets/runtime-benchmarks",
"zrml-simple-disputes/runtime-benchmarks",
"zrml-global-disputes/runtime-benchmarks",
"zrml-styx/runtime-benchmarks",
"zrml-swaps/runtime-benchmarks",
Expand Down Expand Up @@ -331,7 +329,6 @@ std = [
"zrml-neo-swaps/std",
"zrml-parimutuel/std",
"zrml-prediction-markets/std",
"zrml-simple-disputes/std",
"zrml-global-disputes/std",
"zrml-styx/std",
"zrml-swaps-runtime-api/std",
Expand Down Expand Up @@ -388,7 +385,6 @@ try-runtime = [
"zrml-neo-swaps/try-runtime",
"zrml-parimutuel/try-runtime",
"zrml-prediction-markets/try-runtime",
"zrml-simple-disputes/try-runtime",
"zrml-global-disputes/try-runtime",
"zrml-styx/try-runtime",
"zrml-swaps/try-runtime",
Expand Down
12 changes: 0 additions & 12 deletions runtime/battery-station/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,6 @@ impl Contains<RuntimeCall> for IsCallable {
finish_destroy { .. } => false,
_ => true,
},
RuntimeCall::SimpleDisputes(_) => false,
RuntimeCall::PredictionMarkets(inner_call) => match inner_call {
create_market {
dispute_mechanism: Some(MarketDisputeMechanism::SimpleDisputes),
..
} => false,
edit_market {
dispute_mechanism: Some(MarketDisputeMechanism::SimpleDisputes),
..
} => false,
_ => true,
},
RuntimeCall::Swaps(inner_call) => match inner_call {
force_pool_exit { .. } => true,
_ => false,
Expand Down
10 changes: 0 additions & 10 deletions runtime/battery-station/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,6 @@ parameter_types! {
pub const MaxScheduledPerBlock: u32 = 50;
pub const NoPreimagePostponement: Option<u64> = Some(5 * BLOCKS_PER_MINUTE);

// Simple disputes parameters
/// Pallet identifier, mainly used for named balance reserves.
pub const SimpleDisputesPalletId: PalletId = SD_PALLET_ID;
/// (Slashable) Bond that is provided for overriding the last outcome addition.
/// Slashed in case the final outcome does not match the dispute for which the `OutcomeBond`
/// was deposited.
pub const OutcomeBond: Balance = 5 * BASE;
/// `OutcomeBond` is increased by this factor after every new outcome addition.
pub const OutcomeFactor: Balance = 2 * BASE;

// Swaps parameters
/// A precentage from the withdrawal amount a liquidity provider wants to withdraw
/// from a pool before the pool is closed.
Expand Down
30 changes: 4 additions & 26 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,13 @@ macro_rules! decl_common_types {
use orml_traits::MultiCurrency;
use sp_runtime::{generic, DispatchError, DispatchResult, SaturatedConversion};
use zeitgeist_primitives::traits::{DeployPoolApi, DistributeFees, MarketCommonsPalletApi};
use zrml_market_commons::migrations::MigrateScoringRuleAmmCdaHybridAndMarketId;
use zrml_neo_swaps::migration::MigratePoolReservesToBoundedBTreeMap;
use zrml_market_commons::migrations::MigrateDisputeMechanism;

pub type Block = generic::Block<Header, UncheckedExtrinsic>;

type Address = sp_runtime::MultiAddress<AccountId, ()>;

type Migrations = (
MigrateScoringRuleAmmCdaHybridAndMarketId<Runtime>,
MigratePoolReservesToBoundedBTreeMap<Runtime>,
);
type Migrations = (MigrateDisputeMechanism<Runtime>);

pub type Executive = frame_executive::Executive<
Runtime,
Expand Down Expand Up @@ -198,7 +194,6 @@ macro_rules! decl_common_types {
OrderbookPalletId::get(),
ParimutuelPalletId::get(),
PmPalletId::get(),
SimpleDisputesPalletId::get(),
SwapsPalletId::get(),
TreasuryPalletId::get(),
];
Expand Down Expand Up @@ -259,8 +254,8 @@ macro_rules! create_runtime {
use alloc::{boxed::Box, vec::Vec};
// Pallets are enumerated based on the dependency graph.
//
// For example, `PredictionMarkets` is pĺaced after `SimpleDisputes` because
// `PredictionMarkets` depends on `SimpleDisputes`.
// For example, `PredictionMarkets` is pĺaced after `MarketCommons` because
// `PredictionMarkets` depends on `MarketCommons`.

construct_runtime!(
pub enum Runtime where
Expand Down Expand Up @@ -310,7 +305,6 @@ macro_rules! create_runtime {
MarketCommons: zrml_market_commons::{Pallet, Storage} = 50,
Authorized: zrml_authorized::{Call, Event<T>, Pallet, Storage} = 51,
Court: zrml_court::{Call, Event<T>, Pallet, Storage} = 52,
SimpleDisputes: zrml_simple_disputes::{Call, Event<T>, Pallet, Storage} = 55,
Swaps: zrml_swaps::{Call, Event<T>, Pallet, Storage} = 56,
PredictionMarkets: zrml_prediction_markets::{Call, Event<T>, Pallet, Storage} = 57,
Styx: zrml_styx::{Call, Event<T>, Pallet, Storage} = 58,
Expand Down Expand Up @@ -1271,24 +1265,11 @@ macro_rules! impl_config_traits {
type RejectOrigin = EnsureRootOrMoreThanTwoThirdsAdvisoryCommittee;
type RequestEditOrigin = EnsureRootOrMoreThanOneThirdAdvisoryCommittee;
type ResolveOrigin = EnsureRoot<AccountId>;
type SimpleDisputes = SimpleDisputes;
type Slash = Treasury;
type ValidityBond = ValidityBond;
type WeightInfo = zrml_prediction_markets::weights::WeightInfo<Runtime>;
}

impl zrml_simple_disputes::Config for Runtime {
type Currency = Balances;
type OutcomeBond = OutcomeBond;
type OutcomeFactor = OutcomeFactor;
type DisputeResolution = zrml_prediction_markets::Pallet<Runtime>;
type RuntimeEvent = RuntimeEvent;
type MarketCommons = MarketCommons;
type MaxDisputes = MaxDisputes;
type PalletId = SimpleDisputesPalletId;
type WeightInfo = zrml_simple_disputes::weights::WeightInfo<Runtime>;
}

impl zrml_global_disputes::Config for Runtime {
type AddOutcomePeriod = AddOutcomePeriod;
type Currency = Balances;
Expand Down Expand Up @@ -1484,7 +1465,6 @@ macro_rules! create_runtime_api {
list_benchmark!(list, extra, zrml_swaps, Swaps);
list_benchmark!(list, extra, zrml_authorized, Authorized);
list_benchmark!(list, extra, zrml_court, Court);
list_benchmark!(list, extra, zrml_simple_disputes, SimpleDisputes);
list_benchmark!(list, extra, zrml_global_disputes, GlobalDisputes);
list_benchmark!(list, extra, zrml_orderbook, Orderbook);
list_benchmark!(list, extra, zrml_parimutuel, Parimutuel);
Expand Down Expand Up @@ -1589,7 +1569,6 @@ macro_rules! create_runtime_api {
add_benchmark!(params, batches, zrml_swaps, Swaps);
add_benchmark!(params, batches, zrml_authorized, Authorized);
add_benchmark!(params, batches, zrml_court, Court);
add_benchmark!(params, batches, zrml_simple_disputes, SimpleDisputes);
add_benchmark!(params, batches, zrml_global_disputes, GlobalDisputes);
add_benchmark!(params, batches, zrml_orderbook, Orderbook);
add_benchmark!(params, batches, zrml_parimutuel, Parimutuel);
Expand Down Expand Up @@ -2202,7 +2181,6 @@ macro_rules! create_common_tests {
#[test_case(AuthorizedPalletId::get(); "authorized")]
#[test_case(CourtPalletId::get(); "court")]
#[test_case(PmPalletId::get(); "prediction_markets")]
#[test_case(SimpleDisputesPalletId::get(); "simple_disputes")]
#[test_case(SwapsPalletId::get(); "swaps")]
#[test_case(TreasuryPalletId::get(); "treasury")]
fn whitelisted_pallet_accounts_dont_get_reaped(pallet_id: PalletId) {
Expand Down
4 changes: 0 additions & 4 deletions runtime/zeitgeist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ zrml-neo-swaps = { workspace = true }
zrml-orderbook = { workspace = true }
zrml-parimutuel = { workspace = true }
zrml-prediction-markets = { workspace = true }
zrml-simple-disputes = { workspace = true }
zrml-styx = { workspace = true }
zrml-swaps = { workspace = true }
zrml-swaps-runtime-api = { workspace = true }
Expand Down Expand Up @@ -214,7 +213,6 @@ runtime-benchmarks = [
"zrml-neo-swaps/runtime-benchmarks",
"zrml-parimutuel/runtime-benchmarks",
"zrml-prediction-markets/runtime-benchmarks",
"zrml-simple-disputes/runtime-benchmarks",
"zrml-global-disputes/runtime-benchmarks",
"zrml-styx/runtime-benchmarks",
"zrml-swaps/runtime-benchmarks",
Expand Down Expand Up @@ -321,7 +319,6 @@ std = [
"zrml-neo-swaps/std",
"zrml-parimutuel/std",
"zrml-prediction-markets/std",
"zrml-simple-disputes/std",
"zrml-global-disputes/std",
"zrml-swaps-runtime-api/std",
"zrml-styx/std",
Expand Down Expand Up @@ -378,7 +375,6 @@ try-runtime = [
"zrml-neo-swaps/try-runtime",
"zrml-parimutuel/try-runtime",
"zrml-prediction-markets/try-runtime",
"zrml-simple-disputes/try-runtime",
"zrml-global-disputes/try-runtime",
"zrml-styx/try-runtime",
"zrml-swaps/try-runtime",
Expand Down
19 changes: 6 additions & 13 deletions runtime/zeitgeist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ impl Contains<RuntimeCall> for IsCallable {
set_code as set_code_contracts,
};
use pallet_vesting::Call::force_vested_transfer;
use zeitgeist_primitives::types::MarketDisputeMechanism::SimpleDisputes;
use zrml_prediction_markets::Call::{
admin_move_market_to_closed, admin_move_market_to_resolved, create_market, edit_market,
admin_move_market_to_closed, admin_move_market_to_resolved,
};
use zrml_swaps::Call::force_pool_exit;

Expand Down Expand Up @@ -180,17 +179,11 @@ impl Contains<RuntimeCall> for IsCallable {
RuntimeCall::Council(set_members { .. }) => false,
#[cfg(feature = "parachain")]
RuntimeCall::DmpQueue(service_overweight { .. }) => false,
RuntimeCall::PredictionMarkets(inner_call) => {
match inner_call {
// Disable SimpleDisputes dispute resolution mechanism
create_market { dispute_mechanism: Some(SimpleDisputes), .. } => false,
edit_market { dispute_mechanism: Some(SimpleDisputes), .. } => false,
admin_move_market_to_closed { .. } => false,
admin_move_market_to_resolved { .. } => false,
_ => true,
}
}
RuntimeCall::SimpleDisputes(_) => false,
RuntimeCall::PredictionMarkets(inner_call) => match inner_call {
admin_move_market_to_closed { .. } => false,
admin_move_market_to_resolved { .. } => false,
_ => true,
},
RuntimeCall::Swaps(inner_call) => match inner_call {
force_pool_exit { .. } => true,
_ => false,
Expand Down
10 changes: 0 additions & 10 deletions runtime/zeitgeist/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,6 @@ parameter_types! {
pub const MaxScheduledPerBlock: u32 = 50;
pub const NoPreimagePostponement: Option<u64> = Some(5 * BLOCKS_PER_MINUTE);

// Simple disputes parameters
/// Pallet identifier, mainly used for named balance reserves. DO NOT CHANGE.
pub const SimpleDisputesPalletId: PalletId = SD_PALLET_ID;
/// (Slashable) Bond that is provided for overriding the last outcome addition.
/// Slashed in case the final outcome does not match the dispute for which the `OutcomeBond`
/// was deposited.
pub const OutcomeBond: Balance = 2_000 * BASE;
/// `OutcomeBond` is increased by this factor after every new outcome addition.
pub const OutcomeFactor: Balance = 2 * BASE;

// Swaps parameters
/// A precentage from the withdrawal amount a liquidity provider wants to withdraw
/// from a pool before the pool is closed.
Expand Down
Loading
Loading