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

feat: adding global stake #69

Closed
wants to merge 104 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
ad75e7d
test(pallets/subspace): add integrity checks for remove_subnet (#128)
aripiprazole Jun 13, 2024
8e6af33
feat: benchmarking & adding faucet (#133)
Supremesource Jun 13, 2024
3014e7d
feat(pallets/subspace): deregister not whitelisted modules (#136)
saiintbrisson Jun 15, 2024
63af393
Add ref docker tagging
DaviPtrs Jun 21, 2024
49e3a98
chore: disable whitelist removal
saiintbrisson Jul 4, 2024
b66b502
chore: add default modules to local spec
saiintbrisson Jul 4, 2024
bc98f52
chore: structure chain spec patches better
saiintbrisson Jul 5, 2024
665381a
feat: more complex spec
Supremesource Jul 5, 2024
6a5b1b9
fix: chain spec
Supremesource Jul 5, 2024
fcc5ebe
reafac: adding alice account balance
Supremesource Jul 5, 2024
bcb4089
feat: adding snapshot builder
Supremesource Jul 6, 2024
48c8df2
chore: update patch builder
saiintbrisson Jul 6, 2024
6989b88
initial merge
Supremesource Jun 23, 2024
4c338b6
refac: fixing registration on rootnet
Supremesource Jun 23, 2024
cadbd0e
wip: fixing tests
Supremesource Jun 23, 2024
98d8a66
chore: start refactor of tests
saiintbrisson Jun 24, 2024
410174b
wip: preventing panics in subnet emission
Supremesource Jun 24, 2024
1365a72
chore: move registration tests
saiintbrisson Jun 25, 2024
12e9d30
feat: adding todos
Supremesource Jun 25, 2024
c7ebc11
feat: incentive ratio
Supremesource Jun 25, 2024
4cf8014
chore: move subnet tests
saiintbrisson Jun 26, 2024
a3b6653
feat: adding treasury epoch (#153)
Supremesource Jun 28, 2024
3af3c29
feat: tackle comments on feat/global-stake-v2 pull request (#152)
devwckd Jun 29, 2024
aefd475
fix(subnet-emission): calculate lowest netuid skipping new ones
saiintbrisson Jun 29, 2024
3f356bc
feat: implement incentive ratio for yuma
saiintbrisson Jun 29, 2024
13dc23d
fix: compile warnings
Supremesource Jun 29, 2024
764f5e3
fix: clear root net weight calls on epoch
saiintbrisson Jun 29, 2024
2aca01b
chore: finished moving weight tests
saiintbrisson Jun 30, 2024
b0d2dcb
chore: make governance tests compile
saiintbrisson Jun 30, 2024
6918cbd
chore: rename governance tests
saiintbrisson Jun 30, 2024
a6e1fd7
chore: make emission tests compile
saiintbrisson Jun 30, 2024
d8aa358
chore: run fmt
saiintbrisson Jun 30, 2024
b104841
refac: adding subnet consensus type
Supremesource Jun 30, 2024
581abf6
fix: compilation
Supremesource Jul 1, 2024
5aed833
chore: remove yuma incentive ratio
saiintbrisson Jul 1, 2024
566f07b
wip: refactoring registraioon & deregistraion landspace
Supremesource Jun 30, 2024
b21c141
chore: migrate subnet consensus type
saiintbrisson Jul 1, 2024
f0d6e33
refac(pallets/subpsace): use dispatch results (#141)
aripiprazole Jul 1, 2024
c095a2d
fix: clippy lints
Supremesource Jul 1, 2024
eed25bb
fix: clippy errors
Supremesource Jul 1, 2024
db2dc54
chore: move weight rate limit to subspace
saiintbrisson Jul 2, 2024
9c3e26c
tests: add rootnet tests (#156)
devwckd Jul 2, 2024
89476cd
chore: start fixing tests
saiintbrisson Jul 3, 2024
c085ae2
chore: fix subnet tests
saiintbrisson Jul 3, 2024
6ba7978
fix: use correct default registrations per interval
saiintbrisson Jul 3, 2024
1b638b6
chore: fix registration tests
saiintbrisson Jul 3, 2024
6ac54d7
fix: root tests
saiintbrisson Jul 3, 2024
2b6359d
fix: registrations (#159)
Supremesource Jul 3, 2024
213ab59
feat: early return on non registerable subnets (#162)
devwckd Jul 3, 2024
6b097cc
feat: make some SubnetChangeset::validate_param checks exclusive to m…
devwckd Jul 3, 2024
02fb043
feat: adding subnet migrations (#157)
Supremesource Jul 3, 2024
72016ce
refac: add extra lints and fix possible errors (#160)
devwckd Jul 3, 2024
73fa153
feat: remove hardcoded rootnet id (#164)
devwckd Jul 4, 2024
b1fd90d
feat: migration logging (#163)
Supremesource Jul 4, 2024
a5b3210
fix: clippy warnings
Supremesource Jul 4, 2024
4d765bf
chore: simplify stake migration
saiintbrisson Jul 4, 2024
caf2b08
feat: adding tests
Supremesource Jul 4, 2024
b097716
refac: removing useless test
Supremesource Jul 4, 2024
f2419d5
chore: add changelog entries
devwckd Jul 4, 2024
aa91d6e
fix: remove subnet gap ids on migration
saiintbrisson Jul 4, 2024
7ab2a0b
chore: create modules for root and treasury subnets
saiintbrisson Jul 4, 2024
428c5cf
chore: fix clippy
saiintbrisson Jul 5, 2024
b9ecd5b
chore: commit cargo lock
saiintbrisson Jul 5, 2024
fd003ec
chore: simplify migration
saiintbrisson Jul 5, 2024
5521e08
fix: consensus
Supremesource Jul 5, 2024
ee6a1df
wip
devwckd Jul 5, 2024
f5cf466
fix: tests
Supremesource Jul 7, 2024
5feb1da
feat: adding balance to devnet sudo key
Supremesource Jul 8, 2024
a5ff240
feat: fixing migration order
Supremesource Jul 8, 2024
bb32a9d
feat: add minimum stake allowed (#169)
devwckd Jul 8, 2024
52c3e28
feat: remove stake storage value (#171)
devwckd Jul 8, 2024
e0f1f8d
fix: tests
Supremesource Jul 8, 2024
1ceb172
fix: remove second delegation fee migration (#172)
devwckd Jul 9, 2024
c2e434a
refac: removing hardcoded rootnet netuid
Supremesource Jul 9, 2024
7887baf
fix: subnet pricing errors (#173)
devwckd Jul 9, 2024
1a33c1b
refac: changed authors
Supremesource Jul 10, 2024
035d49f
refac: stable existential deposit
Supremesource Jul 10, 2024
fa5c60f
refac: reordering operation order
Supremesource Jul 10, 2024
43f436e
feat: removing expect in `get_total_emission_per_block`
Supremesource Jul 10, 2024
469c056
refac: error docs
Supremesource Jul 10, 2024
c7219e8
chore: cargo fmt
Supremesource Jul 10, 2024
6261af9
feat: adding perfectly balance rootnet consensus configuration
Supremesource Jul 10, 2024
8709976
test: add remove_subnet_dangling_keys test (#176)
devwckd Jul 11, 2024
bd63897
feat: adding subnet burn test
Supremesource Jul 11, 2024
b9bda22
fix: make benchmarks run (#175)
Supremesource Jul 11, 2024
9118c21
feat: added missing `min_immunity_stake` migration
Supremesource Jul 12, 2024
be05c2d
fofo
Supremesource Jul 12, 2024
c2a4b9c
feat: automatically raise unit emission (#177)
devwckd Jul 13, 2024
e615bc5
feat: adding rootnet weight set error
Supremesource Jul 13, 2024
d1e746e
chore: cargo fmt
Supremesource Jul 13, 2024
df6556e
fixing migrations (#181)
Supremesource Jul 16, 2024
967b7cb
feat: adding deregistration tests
Supremesource Jul 16, 2024
95bcadb
chore: remove min stake (#183)
saiintbrisson Jul 17, 2024
f5f6dd9
feat: adding rootnet registration tests + improving `MaxAllowedUids` …
Supremesource Jul 17, 2024
ac2b144
feat: subnet immunity period (#185)
devwckd Jul 17, 2024
5afc914
fix: tests (#187)
Supremesource Jul 17, 2024
090adea
chore: Update CHANGELOG.md
Supremesource Jul 17, 2024
4c974b9
feat: add rootnet weight delegation (#188)
devwckd Jul 18, 2024
aef44a9
chore: updated changelog
Supremesource Jul 20, 2024
596ac46
chore: add support for manual seal
saiintbrisson Jul 22, 2024
ccce657
test: intorducing old tests (#189)
devwckd Jul 22, 2024
5785ef9
chore: changed migration dereg logic
Supremesource Jul 22, 2024
5a782d3
feat: remove validator permits from root pricing (#190)
Supremesource Jul 22, 2024
dc59014
feat: double check emission division
devwckd Jul 22, 2024
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
Prev Previous commit
Next Next commit
feat: add rootnet weight delegation (#188)
* feat: add rootnet weight delegation

* fix: benchmarks

* chore: update codeowners

* chore: updated CODEOWNERS

* feat: adding funding.yml

* refac: fofo

* chore: fix docstings

* wip: removal subnet migration

* refac: fixing migration, removing

* test: add weight_control_delegation unit test

* refac: migration

---------

Co-authored-by: YourUsername <[email protected]>
  • Loading branch information
devwckd and Supremesource authored Jul 18, 2024
commit 4c974b92958bb2a05b10f9538ba77d3eadb3c4ef
8 changes: 2 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
validator_hyperparameters.md @unconst
validator_hyperparameters.md @shibshib
validator_hyperparameters.md @opentaco
/.github/workflows @DaviPtrs

.github/CODEOWNERS @unconst
.github/CODEOWNERS @shibshib
.github/CODEOWNERS @opentaco
* @Supremesource @devwckd @aripiprazole @saiintbrisson
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ["https://governance.communeai.org/"]
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Pull Request Checklist

Before submitting this PR, please make sure:

- [ ] You have run `cargo clippy` and addressed any warnings
- [ ] You have added appropriate tests (if applicable)
- [ ] You have updated the documentation (if applicable)
- [ ] You have reviewed your own code
- [ ] You have updated changelog (if applicable)

## Description

Please provide a brief description of the changes in this PR.

## Related Issues

Please link any related issues here
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ diff [here](https://github.com/agicommies/subspace-network/compare/db8a19b1d2155
- `MinStake` storage map / subnet parameter was removed
- `SubnetImmunityPeriod`storage value / global parameter was introduced
- `SubnetRegistrationBlock` storage map was introduced
- `TotalSubnets` storage value was removed
- `MinimumAllowedStake` was introduced. Users cannot stake or unstake a value smaller than this minimum.
- `MinImmunityStake` was introduced. This value is a subnet parameter that can be changed by the subnet owner. A validator (key) with delegated stake higher than or equal to this value is immune to deregistrations. This aims to reduce sudden validator deregistrations, with adaptability to subnet owner's consensus.
- Extrinsics changes:
Expand Down
24 changes: 12 additions & 12 deletions pallets/governance/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,28 @@ fn submit_dao_application<T: Config>() -> Result<(), &'static str> {
fn register_mock<T: Config>(
key: T::AccountId,
module_key: T::AccountId,
stake: u64,
name: Vec<u8>,
) -> Result<(), &'static str> {
let address = "test".as_bytes().to_vec();
let network = "testnet".as_bytes().to_vec();
BurnConfig::<T>::mutate(|cfg| cfg.min_burn = 0);

let enough_stake = 10000000000000u64;
SubspaceMod::<T>::add_balance_to_account(
&key,
SubspaceMod::<T>::u64_to_balance(stake + SubnetBurn::<T>::get() + 2000).unwrap(),
SubspaceMod::<T>::u64_to_balance(SubnetBurn::<T>::get() + enough_stake).unwrap(),
);
let metadata = Some("metadata".as_bytes().to_vec());
SubspaceMod::<T>::register(
RawOrigin::Signed(key).into(),
RawOrigin::Signed(key.clone()).into(),
network,
name,
address,
stake.into(),
module_key,
module_key.clone(),
metadata,
)?;
SubspaceMod::<T>::increase_stake(&key, &module_key, enough_stake);
Ok(())
}

benchmarks! {
//---------------------------------
//Adding proposals
Expand Down Expand Up @@ -88,7 +87,8 @@ benchmarks! {
params.governance_config.proposal_expiration, // proposal_expiration: the block number, proposal expires at
params.general_subnet_application_cost, // general_subnet_application_cost
params.kappa,
params.rho
params.rho,
params.subnet_immunity_period
)


Expand All @@ -97,7 +97,7 @@ benchmarks! {
let caller: T::AccountId = account("Alice", 0, 1);

// register the subnet
register_mock::<T>(caller.clone(), caller.clone(), 100000000000000u64 + SubnetBurn::<T>::get(),
register_mock::<T>(caller.clone(), caller.clone(),
"test".as_bytes().to_vec())?;
let netuid = SubspaceMod::<T>::get_netuid_for_name("testnet".as_bytes()).unwrap();

Expand Down Expand Up @@ -173,7 +173,7 @@ benchmarks! {
add_subnet_custom_proposal {
let caller: T::AccountId = account("Alice", 0, 1);
// The subnet has to exist
register_mock::<T>(caller.clone(), caller.clone(), 100000000000000u64,
register_mock::<T>(caller.clone(), caller.clone(),
"test".as_bytes().to_vec())?; // Add alice fund to submit the proposal
SubspaceMod::<T>::add_balance_to_account(&caller,
SubspaceMod::<T>::u64_to_balance(1_000_000_000_000_000).unwrap());
Expand Down Expand Up @@ -204,7 +204,7 @@ benchmarks! {
vote_proposal {
let caller: T::AccountId = account("Alice", 0, 1);
// Register Alice such that she has funds to vote
register_mock::<T>(caller.clone(), caller.clone(), 100000000000000u64, "test".as_bytes().to_vec())?;
register_mock::<T>(caller.clone(), caller.clone(), "test".as_bytes().to_vec())?;

// Add Alice's funds to submit the proposal
SubspaceMod::<T>::add_balance_to_account(&caller, SubspaceMod::<T>::u64_to_balance(1_000_000_000_000_000).unwrap());
Expand All @@ -221,7 +221,7 @@ benchmarks! {
remove_vote_proposal {
let caller: T::AccountId = account("Alice", 0, 1);
// Register Alice such that she has funds to vote
register_mock::<T>(caller.clone(), caller.clone(), 100000000000000u64, "test".as_bytes().to_vec())?;
register_mock::<T>(caller.clone(), caller.clone(), "test".as_bytes().to_vec())?;

// Add Alice's funds to submit the proposal
SubspaceMod::<T>::add_balance_to_account(&caller, SubspaceMod::<T>::u64_to_balance(1_000_000_000_000_000).unwrap());
Expand Down
41 changes: 25 additions & 16 deletions pallets/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,22 +378,25 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(crate) fn deposit_event)]
pub enum Event<T: Config> {
/// A new proposal has been created.
ProposalCreated(ProposalId),

/// A proposal has been accepted.
ProposalAccepted(ProposalId),
/// A proposal has been refused.
ProposalRefused(ProposalId),
/// A proposal has expired.
ProposalExpired(ProposalId),

/// A vote has been cast on a proposal.
ProposalVoted(u64, T::AccountId, bool),
/// A vote has been unregistered from a proposal.
ProposalVoteUnregistered(u64, T::AccountId),

WhitelistModuleAdded(T::AccountId), /* --- Event created when a module account has been
* added to the whitelist. */
WhitelistModuleRemoved(T::AccountId), /* --- Event created when a module account has
* been removed from the whitelist. */
/// A module account has been added to the whitelist.
WhitelistModuleAdded(T::AccountId),
/// A module account has been removed from the whitelist.
WhitelistModuleRemoved(T::AccountId),
/// A new application has been created.
ApplicationCreated(u64),
}

// ---------------------------------
// Errors
// ---------------------------------
Expand Down Expand Up @@ -443,21 +446,27 @@ pub mod pallet {
VoteModeIsNotAuthority,
/// An internal error occurred, probably relating to the size of the bounded sets.
InternalError,

// DAO / Governance
/// The application data is too small or empty.
ApplicationTooSmall,
/// The application data is too large, exceeding the maximum allowed size.
ApplicationTooLarge,
/// The application is not in a pending state.
ApplicationNotPending,
/// The application data is invalid or malformed.
InvalidApplication,
/// The account doesn't have enough balance to submit an application.
NotEnoughtBalnceToApply,
/// The recommended weight for the application is invalid.
InvalidRecommendedWeight,
NotCurator, /* --- Thrown when the user tries to set the curator and is not the
* curator */
/// The operation can only be performed by the curator.
NotCurator,
/// The application with the given ID was not found.
ApplicationNotFound,
AlreadyWhitelisted, /* --- Thrown when the user tries to whitelist an account that is
* already whitelisted. */
NotWhitelisted, /* --- Thrown when the user tries to remove an account from the
* whitelist that is not whitelisted. */
/// The account is already whitelisted and cannot be added again.
AlreadyWhitelisted,
/// The account is not whitelisted and cannot be removed from the whitelist.
NotWhitelisted,
/// Failed to convert the given value to a balance.
CouldNotConvertToBalance,
}
}
Expand Down
Loading
Loading