Skip to content

Commit

Permalink
feat(pallets/subspace): update parameters of proposals and remove set…
Browse files Browse the repository at this point in the history
…_floor_founder_share
  • Loading branch information
aripiprazole committed May 3, 2024
1 parent 5c49ff6 commit 6213c2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
9 changes: 1 addition & 8 deletions pallets/subspace/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ impl<T: Config> Pallet<T> {
);

// Make sure of floor founder share
ensure!(
floor_founder_share >= params.founder_share,
Error::<T>::InvalidFounderShare
);
ensure!(floor_founder_share >= 8, Error::<T>::InvalidFounderShare);

// Make sure that the burn rate is below 100%
ensure!(params.burn_rate <= 100, Error::<T>::InvalidBurnRate);
Expand Down Expand Up @@ -325,10 +322,6 @@ impl<T: Config> Pallet<T> {
AdjustmentAlpha::<T>::put(adjustment_alpha);
}

pub fn set_floor_founder_share(founder_share: u8) {
FloorFounderShare::<T>::put(founder_share);
}

// Whitelist management
pub fn is_in_legit_whitelist(account_id: &T::AccountId) -> bool {
LegitWhitelist::<T>::contains_key(account_id)
Expand Down
3 changes: 2 additions & 1 deletion pallets/subspace/tests/profit_share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod mock;
use frame_support::assert_ok;
use log::info;
use mock::*;
use pallet_subspace::FloorFounderShare;
use sp_core::U256;
use sp_std::vec;

Expand All @@ -15,7 +16,7 @@ fn test_add_profit_share() {
let voter_key = U256::from(1);
// make sure that the results won´t get affected by burn
SubspaceModule::set_min_burn(0);
SubspaceModule::set_floor_founder_share(0);
FloorFounderShare::put(0);

register_module(netuid, miner_key, 1_000_000_000).expect("register miner module failed");
register_module(netuid, voter_key, 1_000_000_000).expect("register voter module failed");
Expand Down
9 changes: 6 additions & 3 deletions pallets/subspace/tests/step_yuma.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::mock::*;
use frame_support::assert_ok;
use pallet_subspace::yuma::{AccountKey, EmissionMap, ModuleKey, YumaCalc};
use pallet_subspace::{
yuma::{AccountKey, EmissionMap, ModuleKey, YumaCalc},
FloorFounderShare,
};
use sp_core::U256;
use std::collections::BTreeMap;
mod mock;
Expand Down Expand Up @@ -44,7 +47,7 @@ fn test_1_graph() {
new_test_ext().execute_with(|| {
SubspaceModule::set_unit_emission(23148148148);
SubspaceModule::set_min_burn(0);
SubspaceModule::set_floor_founder_share(0);
FloorFounderShare::put(0);

Check failure on line 50 in pallets/subspace/tests/step_yuma.rs

View workflow job for this annotation

GitHub Actions / check

type annotations needed

// Register general subnet
assert_ok!(register_module(0, 10.into(), 1));
Expand Down Expand Up @@ -115,7 +118,7 @@ fn test_10_graph() {
new_test_ext().execute_with(|| {
SubspaceModule::set_unit_emission(23148148148);
SubspaceModule::set_min_burn(0);
SubspaceModule::set_floor_founder_share(0);
FloorFounderShare::put(0);

Check failure on line 121 in pallets/subspace/tests/step_yuma.rs

View workflow job for this annotation

GitHub Actions / check

type annotations needed
SubspaceModule::set_max_registrations_per_block(1000);
// Register general subnet
assert_ok!(register_module(0, 10_000.into(), 1));
Expand Down
4 changes: 2 additions & 2 deletions pallets/subspace/tests/weights.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod mock;
use frame_support::{assert_err, assert_ok};

use pallet_subspace::Error;
use pallet_subspace::{Error, FloorFounderShare};
use sp_core::U256;
use sp_runtime::DispatchError;

Expand Down Expand Up @@ -267,7 +267,7 @@ fn test_weight_age() {
const PASSIVE_VOTER: u16 = 0;
const ACTIVE_VOTER: u16 = 1;
SubspaceModule::set_max_registrations_per_block(1000);
SubspaceModule::set_floor_founder_share(0);
FloorFounderShare::put(0);

// Register modules
(0..MODULE_COUNT).for_each(|i| {
Expand Down

0 comments on commit 6213c2f

Please sign in to comment.