Browse Source

update nft parameters for testing and production

Mokhtar Naamani 3 years ago
parent
commit
11ca24da94

+ 2 - 2
Cargo.lock

@@ -722,7 +722,7 @@ dependencies = [
 
 [[package]]
 name = "chain-spec-builder"
-version = "5.1.0"
+version = "5.2.0"
 dependencies = [
  "ansi_term 0.12.1",
  "enum-utils",
@@ -2278,7 +2278,7 @@ dependencies = [
 
 [[package]]
 name = "joystream-node"
-version = "6.1.0"
+version = "6.2.0"
 dependencies = [
  "frame-benchmarking",
  "frame-benchmarking-cli",

+ 1 - 1
node/Cargo.toml

@@ -3,7 +3,7 @@ authors = ['Joystream contributors']
 build = 'build.rs'
 edition = '2018'
 name = 'joystream-node'
-version = '6.1.0'
+version = '6.2.0'
 default-run = "joystream-node"
 
 [[bin]]

+ 61 - 0
node/src/chain_spec/content_config.rs

@@ -0,0 +1,61 @@
+use node_runtime::{
+    constants::{DAYS, HOURS, MINUTES},
+    ContentConfig,
+};
+use sp_runtime::Perbill;
+
+pub fn production_config() -> ContentConfig {
+    ContentConfig {
+        next_curator_group_id: 1,
+        next_channel_category_id: 1,
+        next_channel_id: 1,
+        next_video_category_id: 1,
+        next_video_id: 1,
+        next_video_post_id: 1,
+        max_reward_allowed: 1000,
+        min_cashout_allowed: 1,
+        min_auction_duration: MINUTES * 30,
+        max_auction_duration: DAYS * 90,
+        min_auction_extension_period: 0,
+        max_auction_extension_period: HOURS * 6,
+        min_bid_lock_duration: MINUTES * 1,
+        max_bid_lock_duration: HOURS * 24,
+        min_starting_price: 1,
+        max_starting_price: 1_000_000_000,
+        min_creator_royalty: Perbill::from_percent(1),
+        max_creator_royalty: Perbill::from_percent(50),
+        min_bid_step: 1,
+        max_bid_step: 1_000_000,
+        platform_fee_percentage: Perbill::from_percent(1),
+        auction_starts_at_max_delta: DAYS * 30,
+        max_auction_whitelist_length: 100,
+    }
+}
+
+pub fn testing_config() -> ContentConfig {
+    ContentConfig {
+        next_curator_group_id: 1,
+        next_channel_category_id: 1,
+        next_channel_id: 1,
+        next_video_category_id: 1,
+        next_video_id: 1,
+        next_video_post_id: 1,
+        max_reward_allowed: 1000,
+        min_cashout_allowed: 1,
+        min_auction_duration: MINUTES / 2,
+        max_auction_duration: DAYS * 90,
+        min_auction_extension_period: 0,
+        max_auction_extension_period: HOURS * 6,
+        min_bid_lock_duration: MINUTES / 2,
+        max_bid_lock_duration: HOURS * 24,
+        min_starting_price: 1,
+        max_starting_price: 1_000_000_000,
+        min_creator_royalty: Perbill::from_percent(1),
+        max_creator_royalty: Perbill::from_percent(50),
+        min_bid_step: 1,
+        max_bid_step: 1_000_000,
+        platform_fee_percentage: Perbill::from_percent(1),
+        auction_starts_at_max_delta: DAYS * 30,
+        max_auction_whitelist_length: 100,
+    }
+}

+ 7 - 27
node/src/chain_spec/mod.rs

@@ -39,6 +39,7 @@ use node_runtime::{
 // Exported to be used by chain-spec-builder
 pub use node_runtime::{AccountId, GenesisConfig};
 
+pub mod content_config;
 pub mod council_config;
 pub mod forum_config;
 pub mod initial_balances;
@@ -133,6 +134,7 @@ impl Alternative {
                         initial_members::none(),
                         forum_config::empty(get_account_id_from_seed::<sr25519::Public>("Alice")),
                         vec![],
+                        content_config::testing_config(),
                     )
                 },
                 Vec::new(),
@@ -169,6 +171,7 @@ impl Alternative {
                         initial_members::none(),
                         forum_config::empty(get_account_id_from_seed::<sr25519::Public>("Alice")),
                         vec![],
+                        content_config::testing_config(),
                     )
                 },
                 Vec::new(),
@@ -210,6 +213,7 @@ pub fn testnet_genesis(
     members: Vec<membership::genesis::Member<u64, AccountId>>,
     forum_config: ForumConfig,
     initial_balances: Vec<(AccountId, Balance)>,
+    content_config: ContentConfig,
 ) -> GenesisConfig {
     const STASH: Balance = 5_000;
     const ENDOWMENT: Balance = 100_000_000;
@@ -269,33 +273,7 @@ pub fn testnet_genesis(
         council: Some(council_config::create_council_config()),
         membership: Some(MembersConfig { members }),
         forum: Some(forum_config),
-        content: Some({
-            ContentConfig {
-                next_curator_group_id: 1,
-                next_channel_category_id: 1,
-                next_channel_id: 1,
-                next_video_category_id: 1,
-                next_video_id: 1,
-                next_video_post_id: 1,
-                max_reward_allowed: 1000,
-                min_cashout_allowed: 1,
-                min_auction_duration: 3,
-                max_auction_duration: 20,
-                min_auction_extension_period: 5,
-                max_auction_extension_period: 30,
-                min_bid_lock_duration: 2,
-                max_bid_lock_duration: 10,
-                min_starting_price: 10,
-                max_starting_price: 1000,
-                min_creator_royalty: Perbill::from_percent(1),
-                max_creator_royalty: Perbill::from_percent(5),
-                min_bid_step: 10,
-                max_bid_step: 100,
-                platform_fee_percentage: Perbill::from_percent(1),
-                auction_starts_at_max_delta: 90_000,
-                max_auction_whitelist_length: 100,
-            }
-        }),
+        content: Some(content_config),
     }
 }
 
@@ -320,6 +298,7 @@ pub(crate) mod tests {
             initial_members::none(),
             forum_config::empty(get_account_id_from_seed::<sr25519::Public>("Alice")),
             vec![],
+            content_config::testing_config(),
         )
     }
 
@@ -352,6 +331,7 @@ pub(crate) mod tests {
             initial_members::none(),
             forum_config::empty(get_account_id_from_seed::<sr25519::Public>("Alice")),
             vec![],
+            content_config::testing_config(),
         )
     }
 

+ 1 - 1
runtime/src/lib.rs

@@ -25,7 +25,7 @@ pub fn wasm_binary_unwrap() -> &'static [u8] {
     )
 }
 
-mod constants;
+pub mod constants;
 mod integration;
 pub mod primitives;
 mod proposals_configuration;

+ 1 - 1
utils/chain-spec-builder/Cargo.toml

@@ -3,7 +3,7 @@ authors = ['Joystream contributors']
 build = 'build.rs'
 edition = '2018'
 name = 'chain-spec-builder'
-version = '5.1.0'
+version = '5.2.0'
 
 [dependencies]
 enum-utils = "0.1.2"

+ 9 - 2
utils/chain-spec-builder/src/main.rs

@@ -23,7 +23,8 @@ use rand::{distributions::Alphanumeric, rngs::OsRng, Rng};
 use structopt::StructOpt;
 
 use joystream_node::chain_spec::{
-    self, chain_spec_properties, forum_config, initial_balances, initial_members, AccountId,
+    self, chain_spec_properties, content_config, forum_config, initial_balances, initial_members,
+    AccountId,
 };
 
 use sc_chain_spec::ChainType;
@@ -195,7 +196,7 @@ impl ChainSpecBuilder {
 // as more args will likely be needed
 #[allow(clippy::too_many_arguments)]
 fn genesis_constructor(
-    _deployment: &ChainDeployment,
+    deployment: &ChainDeployment,
     authority_seeds: &[String],
     endowed_accounts: &[AccountId],
     sudo_account: &AccountId,
@@ -224,6 +225,11 @@ fn genesis_constructor(
         .map(|path| initial_balances::from_json(path.as_path()))
         .unwrap_or_else(Vec::new);
 
+    let content_config = match deployment {
+        ChainDeployment::live => content_config::production_config(),
+        _ => content_config::testing_config(),
+    };
+
     chain_spec::testnet_genesis(
         authorities,
         sudo_account.clone(),
@@ -231,6 +237,7 @@ fn genesis_constructor(
         members,
         forum_cfg,
         initial_account_balances,
+        content_config,
     )
 }