Skip to content

Revert "Inflation branch -> main" #21

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

Merged
merged 1 commit into from
Apr 22, 2025
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
46 changes: 2 additions & 44 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ pallet-proxy = { version = "37.0.0", default-features = false }
pallet-preimage = { version = "37.0.0", default-features = false }
pallet-scheduler = { version = "38.0.0", default-features = false }
pallet-node-authorization = { version = "37.0.0", default-features = false }
pallet-treasury = { version = "36.0.0", default-features = false }
pallet-tx-pause = { version = "18.0.0", default-features = false }
scale-info = { version = "2.11.1", default-features = false }
sp-genesis-builder = { version = "0.15.0", default-features = false }
sp-offchain = { version = "34.0.0", default-features = false }
Expand Down
11 changes: 0 additions & 11 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ fn local_genesis(
"sudo": {
// Assign network admin rights.
"key": Some(root_key),
},
"treasury": {

},
// "nodeAuthorization": {
// "nodes": vec![
Expand Down Expand Up @@ -314,10 +311,6 @@ fn testnet_gavin_genesis(
// Assign network admin rights.
"key": Some(root_key),
},
"treasury": {

},

// "nodeAuthorization": {
// "nodes": vec![
// (
Expand Down Expand Up @@ -367,10 +360,6 @@ fn testnet_tensor_genesis(
// Assign network admin rights.
"key": Some(root_key),
},
"treasury": {

},

// "nodeAuthorization": {
// "nodes": vec![
// (
Expand Down
67 changes: 27 additions & 40 deletions pallets/collective/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,6 @@ frame_support::construct_runtime!(
}
);

pub const MILLISECS_PER_BLOCK: u64 = 6000;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
// Attempting to do so will brick block production.
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;

// Time is measured by number of blocks.
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;
pub const YEAR: BlockNumber = DAYS * 365;
pub const BLOCKS_PER_HALVING: BlockNumber = YEAR * 2;
pub const TARGET_MAX_TOTAL_SUPPLY: u128 = 2_800_000_000_000_000_000_000_000;
pub const INITIAL_REWARD_PER_BLOCK: u128 = (TARGET_MAX_TOTAL_SUPPLY / 2) / BLOCKS_PER_HALVING as u128;

pub const SECS_PER_BLOCK: u32 = 6000 / 1000;

pub const EPOCH_LENGTH: u32 = 10;
pub const BLOCKS_PER_EPOCH: u32 = SECS_PER_BLOCK * EPOCH_LENGTH;
pub const EPOCHS_PER_YEAR: u32 = YEAR as u32 / BLOCKS_PER_EPOCH;

mod mock_democracy {
pub use pallet::*;
#[frame_support::pallet(dev_mode)]
Expand Down Expand Up @@ -114,14 +93,12 @@ impl pallet_balances::Config for Test {
impl pallet_insecure_randomness_collective_flip::Config for Test {}

parameter_types! {
pub const EpochLength: u32 = EPOCH_LENGTH; // Testnet 600 blocks per erpoch / 69 mins per epoch, Local 10
pub const EpochsPerYear: u32 = EPOCHS_PER_YEAR; // Testnet 600 blocks per erpoch / 69 mins per epoch, Local 10
pub const EpochLength: u64 = 100;
pub const NetworkPalletId: PalletId = PalletId(*b"/network");
pub const MinProposalStake: u128 = 1_000_000_000_000_000_000;
pub const DelegateStakeCooldownEpochs: u32 = 100;
pub const NodeDelegateStakeCooldownEpochs: u32 = 100;
pub const StakeCooldownEpochs: u32 = 100;
pub const DelegateStakeEpochsRemovalWindow: u32 = 10;
pub const DelegateStakeCooldownEpochs: u64 = 100;
pub const StakeCooldownEpochs: u64 = 100;
pub const DelegateStakeEpochsRemovalWindow: u64 = 10;
pub const MaxDelegateStakeUnlockings: u32 = 32;
pub const MaxStakeUnlockings: u32 = 32;
}
Expand All @@ -132,24 +109,26 @@ impl pallet_network::Config for Test {
type Currency = Balances;
type MajorityCollectiveOrigin = pallet_collective::EnsureProportionAtLeast<AccountId, Instance1, 2, 3>;
type SuperMajorityCollectiveOrigin = pallet_collective::EnsureProportionAtLeast<AccountId, Instance1, 4, 5>;
type EpochLength = EpochLength;
type EpochsPerYear = EpochsPerYear;
type EpochLength = EpochLength;
type StringLimit = ConstU32<100>;
type InitialTxRateLimit = ConstU32<0>;
type InitialTxRateLimit = ConstU64<0>;
type Randomness = InsecureRandomnessCollectiveFlip;
type PalletId = NetworkPalletId;
type DelegateStakeCooldownEpochs = DelegateStakeCooldownEpochs;
type NodeDelegateStakeCooldownEpochs = NodeDelegateStakeCooldownEpochs;
type StakeCooldownEpochs = DelegateStakeCooldownEpochs;
type DelegateStakeEpochsRemovalWindow = DelegateStakeEpochsRemovalWindow;
type MaxDelegateStakeUnlockings = MaxDelegateStakeUnlockings;
type MaxStakeUnlockings = MaxStakeUnlockings;
type MinProposalStake = MinProposalStake;
type TreasuryAccount = ();
}

pub type BlockNumber = u32;

pub const MILLISECS_PER_BLOCK: u64 = 6000;
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;

parameter_types! {
pub const VotingPeriod: BlockNumber = DAYS * 21;
pub const EnactmentPeriod: BlockNumber = DAYS * 7;
Expand Down Expand Up @@ -1602,6 +1581,7 @@ fn genesis_build_panics_with_duplicate_members() {
fn proposal_network_pallet_vote_2_3() {
ExtBuilder::default().build_and_execute(|| {
let value = pallet_network::MaxSubnetNodes::<Test>::get();
log::error!("value {:?}", value);
let proposal = RuntimeCall::Network(pallet_network::Call::set_max_subnet_nodes {
value: 999,
});
Expand All @@ -1628,6 +1608,7 @@ fn proposal_network_pallet_vote_2_3() {
proposal_len
));
let value_call = pallet_network::MaxSubnetNodes::<Test>::get();
log::error!("value_call {:?}", value_call);
assert_ne!(value, value_call);
})
}
Expand All @@ -1636,6 +1617,7 @@ fn proposal_network_pallet_vote_2_3() {
fn proposal_network_pallet_vote_1_3() {
ExtBuilder::default().build_and_execute(|| {
let value = pallet_network::MaxSubnetNodes::<Test>::get();
log::error!("value {:?}", value);
let proposal = RuntimeCall::Network(pallet_network::Call::set_max_subnet_nodes {
value: 999,
});
Expand All @@ -1662,16 +1644,18 @@ fn proposal_network_pallet_vote_1_3() {
proposal_len
));
let value_call = pallet_network::MaxSubnetNodes::<Test>::get();
log::error!("value_call {:?}", value_call);
assert_eq!(value, value_call);
})
}

#[test]
fn proposal_network_pallet_vote_4_5() {
ExtBuilder::default().build_and_execute(|| {
let value = pallet_network::MinSubnetDelegateStakeFactor::<Test>::get();
let proposal = RuntimeCall::Network(pallet_network::Call::set_min_subnet_delegate_stake_factor {
value: 1000000000,
let value = pallet_network::MinStakeBalance::<Test>::get();
log::error!("value {:?}", value);
let proposal = RuntimeCall::Network(pallet_network::Call::set_min_stake_balance {
value: 200_000_000_000_000_000_000,
});
let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32);
let proposal_weight = proposal.get_dispatch_info().weight;
Expand All @@ -1695,17 +1679,19 @@ fn proposal_network_pallet_vote_4_5() {
proposal_weight,
proposal_len
));
let value_call = pallet_network::MinSubnetDelegateStakeFactor::<Test>::get();
let value_call = pallet_network::MinStakeBalance::<Test>::get();
log::error!("value_call {:?}", value_call);
assert_ne!(value, value_call);
})
}

#[test]
fn proposal_network_pallet_vote_1_5() {
ExtBuilder::default().build_and_execute(|| {
let value = pallet_network::MinSubnetDelegateStakeFactor::<Test>::get();
let proposal = RuntimeCall::Network(pallet_network::Call::set_min_subnet_delegate_stake_factor {
value: 1000000000,
let value = pallet_network::MinStakeBalance::<Test>::get();
log::error!("value {:?}", value);
let proposal = RuntimeCall::Network(pallet_network::Call::set_min_stake_balance {
value: 200_000_000_000_000_000_000,
});
let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32);
let proposal_weight = proposal.get_dispatch_info().weight;
Expand All @@ -1729,7 +1715,8 @@ fn proposal_network_pallet_vote_1_5() {
proposal_weight,
proposal_len
));
let value_call = pallet_network::MinSubnetDelegateStakeFactor::<Test>::get();
let value_call = pallet_network::MinStakeBalance::<Test>::get();
log::error!("value_call {:?}", value_call);
assert_eq!(value, value_call);
})
}
Expand Down
3 changes: 0 additions & 3 deletions pallets/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ pallet-collective = { version = "37.0.0", default-features = false, path = "../c

[dev-dependencies]
sp-io = { default-features = true, workspace = true }
env_logger = "0.10"
pallet-treasury.workspace = true
pallet-tx-pause.workspace = true

[features]
default = ["std"]
Expand Down
Loading
Loading