Skip to content

Commit

Permalink
Merge pull request commune-ai#50 from agicommies/painful-proposal-merge
Browse files Browse the repository at this point in the history
new Proposal System merge
  • Loading branch information
Kelvin Steiner authored Apr 15, 2024
2 parents f676748 + 9d63463 commit dcfdce1
Show file tree
Hide file tree
Showing 23 changed files with 1,138 additions and 1,043 deletions.
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Ignore autogen files on VS Code
"files.exclude": {
"**/*_BASE_*": true,
"**/*_BACKUP_*": true,
"**/*_LOCAL_*": true,
"**/*_REMOTE_*": true
// "**/autogen_weights.rs": true
},
"search.exclude": {
"**/autogen_weights.rs": true
},
"rust-analyzer.linkedProjects": ["./pallets/subspace/Cargo.toml"],
"search.useParentIgnoreFiles": false
}
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "node-subspace"
version = "1.3.0"
version = "1.4.0"
description = "A fresh FRAME-based Substrate node, ready for hacking."
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
homepage = "https://substrate.io/"
Expand Down
2 changes: 1 addition & 1 deletion pallets/subspace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-subspace"
version = "1.3.0"
version = "1.4.0"
description = "FRAME pallet for runtime logic of Subspace Blockchain."
authors = ["Commune Nucleus Team"]
homepage = "https://commune.com"
Expand Down
7 changes: 4 additions & 3 deletions pallets/subspace/rpc/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
use sp_arithmetic::per_things::Percent;
use sp_runtime::{
sp_std::prelude::Vec,
sp_std::{collections::btree_map::BTreeMap, prelude::Vec},
traits::{IdentifyAccount, Verify},
MultiSignature,
};
Expand All @@ -17,8 +17,9 @@ pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::Account
pub struct ModuleStats {
pub last_update: u64,
pub registration_block: u64,
pub stake_from: Vec<(AccountId, u64)>, /* map of key to stake on this module/key * (includes
* delegations) */
/// A map of AccountId to stake amount (in u64) for this module/key.
/// This includes both direct stakes and delegations.
pub stake_from: BTreeMap<AccountId, u64>,
pub emission: u64,
pub incentive: u16,
pub dividends: u16,
Expand Down
4 changes: 2 additions & 2 deletions pallets/subspace/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Custom {
}

#[rpc(client, server)]
pub trait SubspaceApi<BlockHash, AccountId> {
pub trait SubspaceApi<BlockHash> {
#[method(name = "subspace_getBurnRate")]
fn get_burn_rate(&self, at: Option<BlockHash>) -> RpcResult<Custom>;

Expand All @@ -50,7 +50,7 @@ impl<C, Block> SubspacePallet<C, Block> {
}
}

impl<C, Block> SubspaceApiServer<<Block as BlockT>::Hash, AccountId> for SubspacePallet<C, Block>
impl<C, Block> SubspaceApiServer<<Block as BlockT>::Hash> for SubspacePallet<C, Block>
where
Block: BlockT,
C: Send + Sync + 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
Expand Down
25 changes: 0 additions & 25 deletions pallets/subspace/src/autogen_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub trait WeightInfo {
fn update_subnet() -> Weight;
fn remote_subnet() -> Weight;
fn update_module() -> Weight;
fn update_global() -> Weight;
fn add_global_update() -> Weight;
fn vote_global_update() -> Weight;
fn accept_global_update() -> Weight;
Expand Down Expand Up @@ -90,8 +89,6 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Proof: `SubspaceModule::BurnRate` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::VotePeriod` (r:1 w:0)
/// Proof: `SubspaceModule::VotePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::VoteThresholdSubnet` (r:1 w:0)
/// Proof: `SubspaceModule::VoteThresholdSubnet` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::TotalSubnets` (r:1 w:1)
/// Proof: `SubspaceModule::TotalSubnets` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::Emission` (r:1 w:1)
Expand Down Expand Up @@ -385,20 +382,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Proof: `SubspaceModule::MaxAllowedModules` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::MaxRegistrationsPerBlock` (r:0 w:1)
/// Proof: `SubspaceModule::MaxRegistrationsPerBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::TxRateLimit` (r:0 w:1)
/// Proof: `SubspaceModule::TxRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::MaxNameLength` (r:0 w:1)
/// Proof: `SubspaceModule::MaxNameLength` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::UnitEmission` (r:0 w:1)
/// Proof: `SubspaceModule::UnitEmission` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn update_global() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_323_000 picoseconds.
Weight::from_parts(19_208_000, 0)
.saturating_add(T::DbWeight::get().writes(6_u64))
}
fn add_global_update() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
Expand Down Expand Up @@ -487,8 +474,6 @@ impl WeightInfo for () {
/// Proof: `SubspaceModule::BurnRate` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::VotePeriod` (r:1 w:0)
/// Proof: `SubspaceModule::VotePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::VoteThresholdSubnet` (r:1 w:0)
/// Proof: `SubspaceModule::VoteThresholdSubnet` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::TotalSubnets` (r:1 w:1)
/// Proof: `SubspaceModule::TotalSubnets` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::Emission` (r:1 w:1)
Expand Down Expand Up @@ -782,20 +767,10 @@ impl WeightInfo for () {
/// Proof: `SubspaceModule::MaxAllowedModules` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::MaxRegistrationsPerBlock` (r:0 w:1)
/// Proof: `SubspaceModule::MaxRegistrationsPerBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::TxRateLimit` (r:0 w:1)
/// Proof: `SubspaceModule::TxRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::MaxNameLength` (r:0 w:1)
/// Proof: `SubspaceModule::MaxNameLength` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `SubspaceModule::UnitEmission` (r:0 w:1)
/// Proof: `SubspaceModule::UnitEmission` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn update_global() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_323_000 picoseconds.
Weight::from_parts(19_208_000, 0)
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
fn add_global_update() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
Expand Down
8 changes: 0 additions & 8 deletions pallets/subspace/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,6 @@ mod benchmarks {
Ok(())
}

#[benchmark]
fn update_global() -> Result<(), BenchmarkError> {
#[extrinsic_call]
update_global(RawOrigin::Root, 1, 1, 1, 1, 1, 1);

Ok(())
}

#[benchmark]
fn add_global_update() -> Result<(), BenchmarkError> {
#[extrinsic_call]
Expand Down
Loading

0 comments on commit dcfdce1

Please sign in to comment.