Skip to content

Commit

Permalink
feat: implement global stake (commune-ai#70)
Browse files Browse the repository at this point in the history
* test(pallets/subspace): add integrity checks for remove_subnet (#128)

* test(pallets/subspace): add integrity checks for remove_subnet

* test(pallets/subspace): add integrity checks for apply function (#129)

* feat: benchmarking & adding faucet (#133)

* Feat/benchmarking (#130)

* feat: adding benchmarks

* refac: restructuring lib.rs

* feat: adding testnet faucet (#131)

* feat: adding benchmarks

* refac: restructuring lib.rs

* feat: implementing faucet

* fix: call index

* cargo fmt

* cargo fmt

---------

Signed-off-by: JZ <[email protected]>

* fix: testnet faucet

* fix: faucet

* chore: remove old spec file

* Update lib.rs

Signed-off-by: Luiz Carvalho <[email protected]>

* chore: fix formatting

* chore: make delegation fee public

---------

Signed-off-by: JZ <[email protected]>
Signed-off-by: Luiz Carvalho <[email protected]>
Co-authored-by: saiintbrisson <[email protected]>

* feat(pallets/subspace): deregister not whitelisted modules (#136)

* feat: deregister not whitelisted modules on idle

* chore: step weights

* chore: add logs

* chore: made deregistering a module resilient to index panics

* Add ref docker tagging

Signed-off-by: Davi Petris <[email protected]>

* chore: disable whitelist removal

* chore: add default modules to local spec

* chore: structure chain spec patches better

* feat: more complex spec

* fix: chain spec

* reafac: adding alice account balance

* feat: adding snapshot builder

* chore: update patch builder

* feat: adding global stake (#146)

* initial merge

* refac: fixing registration on rootnet

* wip: fixing tests

* chore: start refactor of tests

* wip: preventing panics in subnet emission

* chore: move registration tests

* feat: adding todos

* feat: incentive ratio

* chore: move subnet tests

* feat: adding treasury epoch (#153)

* feat: adding treasury epoch

* feat: adding extra emission err

* refac: added double check back

* feat: tackle comments on feat/global-stake-v2 pull request (#152)

* feat: add SubnetEmission migration

* feat: add max subnet registrations per interval

* feat: add stake migrations

* feat: don't burn stake on subnet registration

* feat: only remove stake on dangling keys

* test: fix tests

* feat: change default subnet burn adjustment interval

* fix: remove the possibility of panic on stake migrations

* chore: make clippy happy

* wip: fixing migrations

* fix: make migration run

* feat: improved logging of migration

* feat: improve remove_subnet_dangling_keys method

* feat: add governance migration

---------

Co-authored-by: YourUsername <[email protected]>

* fix(subnet-emission): calculate lowest netuid skipping new ones

* feat: implement incentive ratio for yuma

* fix: compile warnings

* fix: clear root net weight calls on epoch

* chore: finished moving weight tests

* chore: make governance tests compile

* chore: rename governance tests

* chore: make emission tests compile

* chore: run fmt

* refac: adding subnet consensus type

* fix: compilation

* chore: remove yuma incentive ratio

* wip: refactoring registraioon & deregistraion landspace

* chore: migrate subnet consensus type

* refac(pallets/subpsace): use dispatch results (#141)

* refac(pallets/subpsace): use dispatch results

* refac(pallets/subpsace): fix allow panicking

* refac(pallets/subspace): fix panics in math.rs

* refac(pallets/subspace): change if lets to let else

* fix(pallets/subpsace): fix weighted median

* fix(pallets/subpsace): make weighted_median be safe

* build: change lints to root workspace

* chore: remove .repos

* fix: step panicked

* chore: fix clippy

---------

Co-authored-by: YourUsername <[email protected]>
Co-authored-by: saiintbrisson <[email protected]>

* fix: clippy lints

* fix: clippy errors

* chore: move weight rate limit to subspace

* tests: add rootnet tests (#156)

* wip

* test: rootnet pricing tests wip

* feat: closer migration

* test: fix rootnet tests

* refac: `set_weights`

* wip

---------

Co-authored-by: YourUsername <[email protected]>
Co-authored-by: saiintbrisson <[email protected]>

* chore: start fixing tests

* chore: fix subnet tests

* fix: use correct default registrations per interval

* chore: fix registration tests

* fix: root tests

* fix: registrations (#159)

* feat: early return on non registerable subnets (#162)

Co-authored-by: YourUsername <[email protected]>

* feat: make some SubnetChangeset::validate_param checks exclusive to mineable subnets (#161)

Co-authored-by: YourUsername <[email protected]>

* feat: adding subnet migrations (#157)

* feat: branch compatibility

* feat: add rootnet migrations

* feat: set rootnet burn and min stake on migration

* feat: lower unit emission on migration

* feat: set max allowed uids to 0 on treasury net

---------

Co-authored-by: devwckd <[email protected]>

* refac: add extra lints and fix possible errors (#160)

* feat: branch compatibility

* feat: add rootnet migrations

* refac: add new lints and fix warnings/errors

* chore: remove useless lints

---------

Co-authored-by: YourUsername <[email protected]>

* feat: remove hardcoded rootnet id (#164)

* feat: migration logging (#163)

* feat: adding migration logging

* fix: calculate stake correctly

---------

Co-authored-by: saiintbrisson <[email protected]>

* fix: clippy warnings

* chore: simplify stake migration

* feat: adding tests

* refac: removing useless test

* chore: add changelog entries

* fix: remove subnet gap ids on migration

* chore: create modules for root and treasury subnets

* chore: fix clippy

* chore: commit cargo lock

* chore: simplify migration

* fix: consensus

* wip

* fix: tests

* feat: adding balance to devnet sudo key

* feat: fixing migration order

* feat: add minimum stake allowed (#169)

* feat: remove stake storage value (#171)

* feat: remove stake storage value

* chore: update changelog

* fix: tests

* fix: remove second delegation fee migration (#172)

* refac: removing hardcoded rootnet netuid

* fix: subnet pricing errors (#173)

* wip

* fix: account for non validator modules on root pricing weights

* refac: changed authors

* refac: stable existential deposit

* refac: reordering operation order

* feat: removing expect in `get_total_emission_per_block`

* refac: error docs

* chore: cargo fmt

* feat: adding perfectly balance rootnet consensus configuration

* test: add remove_subnet_dangling_keys test (#176)

* feat: adding subnet burn test

* fix: make benchmarks run (#175)

Co-authored-by: devwckd <[email protected]>

* feat: added missing `min_immunity_stake` migration

* fofo

* feat: automatically raise unit emission (#177)

* feat: adding rootnet weight set error

* chore: cargo fmt

* fixing migrations (#181)

* fix: correct emission migration

* fix: migrations

* feat: adding deregistration tests

* chore: remove min stake (#183)

* chore: remove min stake

* fix: corrected test code

* feat: adding rootnet registration tests + improving `MaxAllowedUids` safety (#179)

* feat: adding rootnet registration tests + improving `MaxAllowedUids` safety

* fix comment

* feat: subnet immunity period (#185)

* fix: tests (#187)

* fix: tests

* chore: Updating CHANGELOG

* chore: adding extrinsic changes

* chore: Update CHANGELOG.md

Signed-off-by: Honza <[email protected]>

* 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]>

* chore: updated changelog

* chore: add support for manual seal

* test: intorducing old tests (#189)

* test: wip

* feat: adding lowest uid test

* refac: removing useless test

* feat: reintroducing tests

* feat: reintroduced founder share test

* refac: removed outdated TODOs

* chore: faucet module improvements

* fix: migration total subnets

---------

Co-authored-by: YourUsername <[email protected]>

* chore: changed migration dereg logic

* feat: remove validator permits from root pricing (#190)

* feat: remove validator permits from root pricing

* feat: change rootnet validator check to module check

---------

Co-authored-by: devwckd <[email protected]>

* feat: double check emission division

---------

Signed-off-by: Honza <[email protected]>
Co-authored-by: saiintbrisson <[email protected]>
Co-authored-by: João Victor <[email protected]>
Co-authored-by: Gabrielle Guimarães de Oliveira <[email protected]>
Co-authored-by: devwckd <[email protected]>

* chore: remove invalid codeowners

Signed-off-by: Luiz Carvalho <[email protected]>

* chore: remove all invalid codeowners

Signed-off-by: Luiz Carvalho <[email protected]>

---------

Signed-off-by: JZ <[email protected]>
Signed-off-by: Luiz Carvalho <[email protected]>
Signed-off-by: Davi Petris <[email protected]>
Signed-off-by: Honza <[email protected]>
Co-authored-by: Gabrielle Guimarães de Oliveira <[email protected]>
Co-authored-by: Honza <[email protected]>
Co-authored-by: Davi Petris <[email protected]>
Co-authored-by: supreme <[email protected]>
Co-authored-by: João Victor <[email protected]>
Co-authored-by: devwckd <[email protected]>
  • Loading branch information
7 people authored Jul 22, 2024
1 parent eb15ec4 commit 666b78a
Show file tree
Hide file tree
Showing 93 changed files with 165,699 additions and 821,518 deletions.
8 changes: 1 addition & 7 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
validator_hyperparameters.md @unconst
validator_hyperparameters.md @shibshib
validator_hyperparameters.md @opentaco

.github/CODEOWNERS @unconst
.github/CODEOWNERS @shibshib
.github/CODEOWNERS @opentaco
* @Supremesource @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
7 changes: 6 additions & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Build and push Docker image
on:
push:
branches: [main]
tags:
- '*'


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -39,4 +42,6 @@ jobs:
SCCACHE_ENDPOINT=${{ vars.SCCACHE_ENDPOINT }}
SCCACHE_REGION=auto
push: true
tags: ghcr.io/agicommies/subspace:${{ steps.commit.outputs.short }}
tags: |
ghcr.io/agicommies/subspace:${{ steps.commit.outputs.short }}
ghcr.io/agicommies/subspace:${{ github.ref_name }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@
.direnv

.idea

# scripts
__pycache__
55 changes: 44 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
{
// Ignore autogen files on VS Code
"files.exclude": {
"**/*_BASE_*": true,
"**/*_BACKUP_*": true,
"**/*_LOCAL_*": true,
"**/*_REMOTE_*": true,
},
"search.exclude": {
"**/autogen_weights.rs": true
},
"workbench.iconTheme": "material-icon-theme",
// Ignore autogen files on VS Code
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/node_modules": true,
"**/.next": true,
"**/.spago": true,
"**/*.bs.js": true,
"**/.gradle": true,
"**/.classpath": true,
"**/.settings": true,
"**/.project": true,
"**/*.ibc": true,
"**/.factorypath": true,
"**/*_BASE_*": true,
"**/*_BACKUP_*": true,
"**/*_LOCAL_*": true,
"**/*_REMOTE_*": true,
"**/.repos": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/autogen_weights.rs": true,
"**/.repos": true
},
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true,
"**/.hg/store/**": true,
"**/.repos": true
},
"rust-analyzer.cargo.extraEnv": {
"SKIP_WASM_BUILD": 1
},
"rust-analyzer.server.extraEnv": {
"SKIP_WASM_BUILD": 1
}
}
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

[Unreleased]

spec_version `118`

This branch starts off of the commit hash `95e5d26b550839c24fd367090e02abaa37df3d32`.
diff [here](https://github.com/agicommies/subspace-network/compare/db8a19b1d2155d3ecda4172aaf72cdeea1feda2b...agicommies:subspace-network:feat/global-stake)

- Error type `NotRegistered` was renamed to `ModuleDoesNotExist`.
- Error `InvalidSubnetStakeThreshold` removed.
- Storage value changes:

- MaximumSetWeightCallsPerEpoch lost its `ValueQuery` behavior and returns an `Option<u16>` now instead of 0 if missing.
- `SubnetEmission`, `PendingEmission` and `UnitEmission` were moved to the new subnet_emission pallet.
- `StakeFrom` and `StakeTo` lost their subnet id key. Because of this the value type changed from `BTreeMap<T::AcountId,u64>` to just `u64`. Their new type is `StorageDoubleMap<T::AccountId, T::AcountId, u64>` _(other generics ommited for clarity)_.
- `TotalStake` lost its subnet id key and turned into a simple `StorageValue<u64>` _(other generics ommited for clarity)_.
- `Stake` storage value was removed.
- `MinStake` storage map / subnet parameter was removed
- `SubnetImmunityPeriod`storage value / global parameter was introduced
- `SubnetRegistrationBlock` storage map was introduced
- `TotalSubnets` storage value was removed
- `RootnetControlDelegation`: MAP (netuid, module_key) -> control_delegation, storage map was introduced, which stores information from `delegate_rootnet_control` extrinsic.
- `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:

- `add_stake`, `remove_stake`, `add_stake_multiple`, `remove_stake_multiple` and `transfer_stake` lost their subnet id parameter.
- `register` no longer takes the `stake` parameter
- New extrinsic `delegate_rootnet_control: target: T::AccountId,`:
Rootnet validators are capable of calling this extrinsic. The weight setting of the calling validator is delegated to the specified target (another validator making rootnet decisions on behalf).

## Version 1.7.8

`spec_version: 117`
Expand Down
Loading

0 comments on commit 666b78a

Please sign in to comment.