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

testnet deploy 12-12-2024 🙏🏻 #1090

Merged
merged 269 commits into from
Dec 12, 2024
Merged
Changes from 14 commits
Commits
Show all changes
269 commits
Select commit Hold shift + click to select a range
d2b6e8e
update dep
JohnReedV Nov 14, 2024
93e38e9
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 14, 2024
b684810
fmt, clippy, bump spec
JohnReedV Nov 14, 2024
14daf26
use saturating math
JohnReedV Nov 14, 2024
676ad8c
wip crv3
orriin Nov 15, 2024
4ee5e06
Merge branch 'spiigot/add-pallet-drand' into commit-reveal-v3
orriin Nov 15, 2024
1323cc2
update doc comment
JohnReedV Nov 15, 2024
1bfe856
remove newpulse event & increase max pulses
JohnReedV Nov 15, 2024
6961db4
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 15, 2024
4926c1b
add node config again
JohnReedV Nov 15, 2024
41cfff9
crv3 implementation
orriin Nov 18, 2024
3224834
Merge branch 'spiigot/add-pallet-drand' into commit-reveal-v3
orriin Nov 18, 2024
bb16b28
clippy
orriin Nov 18, 2024
c8facf4
zepter
orriin Nov 18, 2024
7ea88f9
make setconfig require root call
JohnReedV Nov 19, 2024
64c52b7
fmt & clippy
JohnReedV Nov 19, 2024
51cb0ce
fmt & bump spec
JohnReedV Nov 19, 2024
47bd2dd
re-implement pairing comparison & address clippy
JohnReedV Nov 19, 2024
c4cfecb
re-order HostFunctions
JohnReedV Nov 19, 2024
40f220b
drand verifier bug fix
JohnReedV Nov 21, 2024
c92519e
remove mainnet feature
JohnReedV Nov 21, 2024
ddc51e5
merge
orriin Nov 21, 2024
46b512f
doc
orriin Nov 21, 2024
acd6093
Move unit tests to right place
ales-otf Nov 21, 2024
5540907
Reformat
ales-otf Nov 21, 2024
0b3efe3
Update spec version
ales-otf Nov 21, 2024
27a3194
Update chainspecs
ales-otf Nov 21, 2024
a84af10
Merge pull request #1011 from opentensor/chore/move-unit-tests
unconst Nov 21, 2024
357fd6a
bring drand into mock runtimes
JohnReedV Nov 21, 2024
557da60
remove redundant comments
JohnReedV Nov 22, 2024
fbf06e0
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 22, 2024
6e2a4ad
Update chainspecs
JohnReedV Nov 22, 2024
487dc7c
ci: update archive node uri
orriin Nov 22, 2024
3db119c
Update chainspecs
orriin Nov 22, 2024
d53297d
Merge pull request #1013 from opentensor/archive-node-url
sam0x17 Nov 22, 2024
2686215
add drand to benches
JohnReedV Nov 22, 2024
9bfc747
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 23, 2024
2fb43a7
Update chainspecs
JohnReedV Nov 23, 2024
b1401c2
fix tests
JohnReedV Nov 23, 2024
3d9e408
consider reveal epochs in crv3
JohnReedV Nov 23, 2024
bb11a7c
add hyperparam crv3 rate limit
JohnReedV Nov 23, 2024
318c244
move test
JohnReedV Nov 23, 2024
7492611
move imports
JohnReedV Nov 23, 2024
fdd4280
Merge pull request #1012 from opentensor/spiigot/drand-mock-runtimes
JohnReedV Nov 23, 2024
47df1b4
Merge branch 'spiigot/add-pallet-drand' into commit-reveal-v3
JohnReedV Nov 23, 2024
faa5d9b
Update chainspecs
JohnReedV Nov 23, 2024
1a59ba0
fmt & clippy
JohnReedV Nov 23, 2024
a123ad7
add hyperparam enable/disable crv3
JohnReedV Nov 23, 2024
5479995
Update chainspecs
JohnReedV Nov 24, 2024
ec502bd
sort the account in spec file
open-junius Nov 26, 2024
47d0d29
Update chainspecs
open-junius Nov 26, 2024
017f5b9
trigger build spec again
open-junius Nov 26, 2024
3978207
trigger build spec again
open-junius Nov 26, 2024
ddc3804
Merge pull request #1017 from opentensor/determistic-spec-file
sam0x17 Nov 26, 2024
3e4076d
add tests & fix bugs
JohnReedV Nov 26, 2024
a51741f
freeze struct WeightsTlockPayload
JohnReedV Nov 26, 2024
40b67df
zepter
JohnReedV Nov 26, 2024
08961fa
Update chainspecs
JohnReedV Nov 26, 2024
9d4dcb5
enable NewPulse event
JohnReedV Nov 26, 2024
2c4c109
Update chainspecs
JohnReedV Nov 26, 2024
5e2d135
add impl; needs tests
camfairchild Nov 26, 2024
8642fd4
Update chainspecs
camfairchild Nov 26, 2024
f771a45
Move chainspecs into a dedicated directory
ales-otf Nov 26, 2024
c74f8f2
Fix pre-evm sync issue with evm-enabled node
gztensor Nov 26, 2024
aeeaad8
use commit-reveal-enabled
JohnReedV Nov 26, 2024
61d754b
fix bug and test
JohnReedV Nov 26, 2024
62ccf80
Merge branch 'commit-reveal-v3' of github.com:opentensor/subtensor in…
JohnReedV Nov 26, 2024
45830c5
fmt
JohnReedV Nov 26, 2024
8b6351b
Update chainspecs
JohnReedV Nov 26, 2024
574bf7f
add test & saturating math
JohnReedV Nov 26, 2024
3fba9a0
Merge branch 'commit-reveal-v3' of github.com:opentensor/subtensor in…
JohnReedV Nov 26, 2024
af3e095
Update chainspecs
JohnReedV Nov 26, 2024
48456db
only error on commit enabled
camfairchild Nov 26, 2024
fce1dc1
fix doc string
camfairchild Nov 26, 2024
1eacf69
Update chainspecs
camfairchild Nov 26, 2024
a84fe51
add test for set weights batch and fix doc string
camfairchild Nov 26, 2024
0756cc5
add batch commit and test
camfairchild Nov 26, 2024
9294d3a
add index comment next to errors
camfairchild Nov 26, 2024
fe9b33c
bump spec ver
camfairchild Nov 26, 2024
e6bc596
Update chainspecs
camfairchild Nov 26, 2024
b510fc8
check weightsminstake pre-dispatch crv3
JohnReedV Nov 26, 2024
864c89a
Update chainspecs
JohnReedV Nov 26, 2024
4640bf8
Fix build_all_chainspecs rewrite plain specs genesis
ales-otf Nov 27, 2024
55caaa3
Add devnet to chainspec generating script
ales-otf Nov 27, 2024
90338a7
Update bootnode in testnet
ales-otf Nov 27, 2024
a0b9d66
more unit tests
JohnReedV Nov 27, 2024
4f90985
Update chainspecs
JohnReedV Nov 27, 2024
1459191
Update chainspecs
ales-otf Nov 27, 2024
3addecc
even more unit tests
JohnReedV Nov 27, 2024
f1ed637
Update chainspecs
JohnReedV Nov 27, 2024
16551f8
expand a test
JohnReedV Nov 27, 2024
965ee3e
Update chainspecs
JohnReedV Nov 27, 2024
af90612
remove deprecated
JohnReedV Nov 27, 2024
e62d438
Merge branch 'commit-reveal-v3' of github.com:opentensor/subtensor in…
JohnReedV Nov 27, 2024
6e2ecbe
Merge pull request #982 from opentensor/commit-reveal-v3
JohnReedV Nov 27, 2024
b1fc591
Bring back testnet bootnode
ales-otf Nov 27, 2024
b55e3e1
Update chainspecs
ales-otf Nov 27, 2024
5b90f6c
Add admin extrinsic to set chain ID
gztensor Nov 27, 2024
6540ed4
Add unit tests for setting chain ID admin extrinsic
gztensor Nov 27, 2024
df5877c
Update chainspecs
gztensor Nov 27, 2024
2a1db9d
add length check
camfairchild Nov 27, 2024
a0e0636
chore: fmt
camfairchild Nov 27, 2024
c8369c1
add error to comments
camfairchild Nov 27, 2024
edb2412
Update chainspecs
camfairchild Nov 27, 2024
711bf98
Merge pull request #1034 from opentensor/testnet
unconst Nov 27, 2024
966ae1d
fix keystore key accumulation bug
JohnReedV Nov 28, 2024
f7c5898
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 28, 2024
83f75cc
Update chainspecs
JohnReedV Nov 28, 2024
c7bf1cb
Use existing rate limit
JohnReedV Nov 28, 2024
bc926b2
fmt
JohnReedV Nov 28, 2024
1caead6
Update chainspecs
JohnReedV Nov 28, 2024
b07f802
remove signature prefix
JohnReedV Nov 29, 2024
47367d6
Update chainspecs
JohnReedV Nov 29, 2024
9da2947
Merge pull request #1025 from opentensor/chore/chainspecs-folder
sam0x17 Nov 29, 2024
dd58804
fix remaining escapes in hotfix pr bot message
sam0x17 Nov 29, 2024
556086f
Merge branch 'devnet-ready' into merge-devnet-to-devnet-ready
gztensor Nov 29, 2024
a0526c4
Update chainspecs
gztensor Nov 29, 2024
4ff2e5b
bump CI
sam0x17 Nov 29, 2024
04300f5
init solution
open-junius Dec 1, 2024
c9109ac
Merge pull request #1023 from opentensor/fix/pre-evm-block-import
sam0x17 Dec 1, 2024
1bf2730
more method definition
open-junius Dec 2, 2024
7e46bb5
Merge remote-tracking branch 'origin/devnet-ready' into merge-devnet-…
sam0x17 Dec 2, 2024
f0f34fb
fix clippy pt 1
sam0x17 Dec 2, 2024
bb2f560
fix doc comment
sam0x17 Dec 2, 2024
5ecb7a5
almost
sam0x17 Dec 2, 2024
1db2eb6
allow two stubborn non-local-definitions for now
sam0x17 Dec 2, 2024
b639263
cargo fmt
sam0x17 Dec 2, 2024
7a5072a
fix clippy
sam0x17 Dec 2, 2024
f21a5ea
cargo fmt
sam0x17 Dec 2, 2024
3eaea00
Merge pull request #1042 from opentensor/merge-devnet-to-devnet-ready
sam0x17 Dec 2, 2024
c344fac
Merge pull request #1040 from opentensor/sam-fix-hotfix-bot-again
sam0x17 Dec 2, 2024
3f1ed6f
Merge pull request #1047 from opentensor/testnet
unconst Dec 2, 2024
fada798
Merge remote-tracking branch 'origin/devnet' into final-backpropagati…
sam0x17 Dec 2, 2024
31ed560
Update chainspecs
sam0x17 Dec 2, 2024
e53eefd
fix broken test
sam0x17 Dec 2, 2024
6d86c12
give each OCW a unique tx tag
JohnReedV Dec 2, 2024
d36fdd9
Merge remote-tracking branch 'origin/final-backpropagation-12-2-2024'…
sam0x17 Dec 2, 2024
ba03f23
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Dec 2, 2024
f1a7803
Merge pull request #1049 from opentensor/final-backpropagation-12-2-2024
sam0x17 Dec 2, 2024
e33a580
Pending children, tests passing, no specific tests
gztensor Dec 3, 2024
88bf635
Pending children, specific tests
gztensor Dec 3, 2024
07cef6a
Merge branch 'devnet-ready' into feat/pending-childkeys
gztensor Dec 3, 2024
50b9b8b
axon data support
open-junius Dec 3, 2024
12d90d4
implement done
open-junius Dec 3, 2024
2d76d84
fix clippy
open-junius Dec 3, 2024
ee0756b
clean expired commits
JohnReedV Dec 3, 2024
a0e96d5
bump spec
JohnReedV Dec 3, 2024
1438380
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Dec 3, 2024
aad6f56
Add pending childkey cooldown test
gztensor Dec 3, 2024
247d8db
remove sneaky unwrap from drand pallet
JohnReedV Dec 3, 2024
44a34a8
Merge branch 'spiigot/add-pallet-drand' of https://github.com/openten…
JohnReedV Dec 3, 2024
80a0001
fmt
JohnReedV Dec 3, 2024
e19501d
Merge pull request #951 from opentensor/spiigot/add-pallet-drand
unconst Dec 3, 2024
275bb51
Merge pull request #1053 from opentensor/devnet-ready
unconst Dec 3, 2024
01e90ab
Merge branch 'devnet-ready' into feat/admin-set-evm-chain-id
gztensor Dec 3, 2024
fe75d1c
Fix clippy warnings
gztensor Dec 3, 2024
7c16b02
Bump spec version
gztensor Dec 3, 2024
e9fb1c5
Bump spec version
gztensor Dec 3, 2024
796ffdb
Bump spec version
gztensor Dec 3, 2024
5a04b94
Revert "Bump spec version"
gztensor Dec 4, 2024
eb154a8
Revert "Bump spec version"
gztensor Dec 4, 2024
962bf82
Revert "Bump spec version"
gztensor Dec 4, 2024
39e661d
Merge pull request #1056 from opentensor/fix/clippy-warnings
sam0x17 Dec 4, 2024
2c63c6c
Fix clippy issues
gztensor Dec 4, 2024
95764b6
fix clippy
open-junius Dec 4, 2024
4bfae6b
update version
open-junius Dec 4, 2024
6f294ed
merge with target branch
open-junius Dec 4, 2024
19d175f
fmt
gztensor Dec 4, 2024
d001c99
Fix test for removing stake
gztensor Dec 4, 2024
b4d41d0
Add ChildkeysMinStake, fix clippy, fix tests
gztensor Dec 4, 2024
7233ee6
fix early exit bug & increase max commit bytes
JohnReedV Dec 4, 2024
a4ccd6d
clippy
JohnReedV Dec 4, 2024
5df225e
Merge branch 'devnet-ready' into spiigot/hotfix-crv3-devnet
JohnReedV Dec 4, 2024
e54ac13
bump spec
JohnReedV Dec 4, 2024
4914867
Merge pull request #1059 from opentensor/spiigot/hotfix-crv3-devnet
sam0x17 Dec 4, 2024
688d4a7
Remove dead code
ales-otf Nov 28, 2024
2f79f2e
Satisfy linter
ales-otf Nov 28, 2024
cfc0b9f
Bring back is_registration_allowed
ales-otf Nov 29, 2024
b55c8f6
Bring back commented test _map_consensus_guarantees
ales-otf Nov 29, 2024
6bb1afe
Reformat
ales-otf Nov 29, 2024
91c0d4a
Use StakeThreshold instead of WeightsMinStake and ChildkeyMinStake
gztensor Dec 4, 2024
7f5bd9d
Merge pull request #1036 from opentensor/chore/cleanup-pallet-subtensor
sam0x17 Dec 4, 2024
c596998
Set that migration has run for StakeThreshold migration
gztensor Dec 4, 2024
55e754b
Merge pull request #1060 from opentensor/devnet-ready
unconst Dec 4, 2024
7e03512
Merge branch 'devnet-ready' into feat/pending-childkeys
gztensor Dec 4, 2024
8a4962c
throw TooManyUnrevealedCommits per hotkey
JohnReedV Dec 4, 2024
c113b88
Merge pull request #1061 from opentensor/spiigot/fix-crv3-devnet-2
sam0x17 Dec 5, 2024
6b5d834
Merge branch 'devnet-ready' into metagraph-contract
open-junius Dec 5, 2024
1398353
add get subnet register interface
open-junius Dec 5, 2024
ffa76ba
fix Dockerfile
sam0x17 Dec 5, 2024
5096be2
bump CI
sam0x17 Dec 5, 2024
c7ae614
use newer ubuntu
sam0x17 Dec 5, 2024
31f9e54
docker build must pass for CI to pass
sam0x17 Dec 5, 2024
6e43a0d
rename
sam0x17 Dec 5, 2024
7b5ad83
add workflow_dispatch option
sam0x17 Dec 5, 2024
a202f44
Merge pull request #1063 from opentensor/fix-dockerfile
sam0x17 Dec 5, 2024
0cad3de
use correct grandpa addresses for devnet
sam0x17 Dec 5, 2024
7bcf2ec
log drand deserialization
JohnReedV Dec 5, 2024
01ff37b
Merge pull request #1064 from opentensor/fix-devnet-chainspec
sam0x17 Dec 5, 2024
4fdd7f3
Merge branch 'devnet-ready' into feat/batch-set-weights
camfairchild Dec 5, 2024
346377b
chore: fmt
camfairchild Dec 5, 2024
3ebcdb9
cargo run -p node-subtensor -- build-spec --chain dev >chainspecs/pla…
sam0x17 Dec 5, 2024
63ff23a
revert to debug
JohnReedV Dec 5, 2024
048d1b3
cargo run -p node-subtensor -- build-spec --chain dev --raw > raw_spe…
sam0x17 Dec 5, 2024
a558ab3
whoops
sam0x17 Dec 5, 2024
ee302fc
bump spec_version to 215
sam0x17 Dec 5, 2024
8b36200
Update chainspecs
sam0x17 Dec 5, 2024
888438e
bump CI
sam0x17 Dec 5, 2024
9efedff
change call index
sam0x17 Dec 6, 2024
8d4adf9
bump spec version
sam0x17 Dec 6, 2024
f87d97d
Merge pull request #1030 from opentensor/feat/admin-set-evm-chain-id
sam0x17 Dec 6, 2024
51cdd9c
Merge pull request #1050 from opentensor/feat/pending-childkeys
sam0x17 Dec 6, 2024
28780d9
Merge remote-tracking branch 'origin/devnet-ready' into feat/batch-se…
sam0x17 Dec 6, 2024
7417fac
commit Cargo.lock changes
sam0x17 Dec 6, 2024
ed8a892
Merge pull request #1070 from opentensor/update-devnet-chainspec
sam0x17 Dec 6, 2024
81345c1
Merge remote-tracking branch 'origin/devnet-ready' into spiigot/log-d…
sam0x17 Dec 6, 2024
4877062
Use new stake_threshold
camfairchild Dec 6, 2024
25758dc
Merge pull request #1065 from opentensor/spiigot/log-drand-deserializion
sam0x17 Dec 6, 2024
cc76060
clippy
sam0x17 Dec 6, 2024
83af209
Merge remote-tracking branch 'origin/devnet-ready' into feat/batch-se…
sam0x17 Dec 6, 2024
e44fbf6
Merge pull request #1022 from opentensor/feat/batch-set-weights
sam0x17 Dec 6, 2024
c2106ec
fix according comments
open-junius Dec 6, 2024
7d8f591
fix release notes script
sam0x17 Dec 6, 2024
197798f
Merge pull request #1073 from opentensor/fix-release-notes-script
sam0x17 Dec 6, 2024
f5a1443
remove unneeded files
sam0x17 Dec 6, 2024
ed9d9e8
Merge pull request #1074 from opentensor/remove-extra-chainspec-files
sam0x17 Dec 6, 2024
8fdfb73
tweak
sam0x17 Dec 6, 2024
dec011f
tweaks
sam0x17 Dec 6, 2024
af330be
Merge pull request #1072 from opentensor/devnet-ready
unconst Dec 6, 2024
a50bc50
Fix devnet chainspecs
ales-otf Dec 6, 2024
fbc26eb
Merge pull request #1078 from opentensor/fix/devnet-specs
sam0x17 Dec 6, 2024
0e3f594
Update devnet chainspec
ales-otf Dec 9, 2024
4842f4e
Regenerate devnet chain specs
ales-otf Dec 9, 2024
362b128
Remove bootnodes from devnet chainspec
ales-otf Dec 9, 2024
b2db7ab
Merge pull request #1080 from opentensor/fix/update-devnet-spec
sam0x17 Dec 9, 2024
683fd70
Merge pull request #1081 from opentensor/devnet-ready
unconst Dec 9, 2024
2fed26e
refactor rate limit check
camfairchild Dec 10, 2024
0ae49df
add register network to passes_rate_limit
camfairchild Dec 10, 2024
9da42a9
add more tao for lock costs in test
camfairchild Dec 10, 2024
29ea11c
Merge pull request #1083 from opentensor/fix/network-rate-limit-on-ze…
sam0x17 Dec 10, 2024
fb98188
set set_children rate limit to 30min
camfairchild Dec 10, 2024
5965f9b
spec bump
camfairchild Dec 10, 2024
974e76b
Merge pull request #1085 from opentensor/feat/lower-set-children-rate…
sam0x17 Dec 10, 2024
e620216
try all endpoints
JohnReedV Dec 10, 2024
2028c2b
add try all endpoints tests
JohnReedV Dec 10, 2024
0c97849
clippy
JohnReedV Dec 10, 2024
c406084
remove sleep
JohnReedV Dec 10, 2024
cfe0c29
Merge pull request #1087 from opentensor/spiigot/try-all-endpoints
sam0x17 Dec 10, 2024
f5542c1
Merge pull request #1043 from opentensor/metagraph-contract
sam0x17 Dec 11, 2024
fd1797b
Merge pull request #1088 from opentensor/devnet-ready
unconst Dec 11, 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
5 changes: 3 additions & 2 deletions pallets/subtensor/src/coinbase/root.rs
Original file line number Diff line number Diff line change
@@ -301,8 +301,9 @@ impl<T: Config> Pallet<T> {

/// Checks if registrations are allowed for a given subnet.
///
/// This function retrieves the subnet hyperparameters for the specified subnet and checks the `registration_allowed` flag.
/// If the subnet doesn't exist or doesn't have hyperparameters defined, it returns `false`.
/// This function retrieves the subnet hyperparameters for the specified subnet and checks the
/// `registration_allowed` flag. If the subnet doesn't exist or doesn't have hyperparameters
/// defined, it returns `false`.
///
/// # Arguments
///
31 changes: 15 additions & 16 deletions pallets/subtensor/src/coinbase/run_coinbase.rs
Original file line number Diff line number Diff line change
@@ -20,28 +20,30 @@ pub struct WeightsTlockPayload {
impl<T: Config> Pallet<T> {
/// The `coinbase` function performs a four-part emission distribution process involving
/// subnets, epochs, hotkeys, and nominators.
///
/// It is divided into several steps, each handling a specific part of the distribution:
///
/// Step 1: Compute the block-wise emission for each subnet.
/// This involves calculating how much (TAO) should be emitted into each subnet using the
/// root epoch function.
/// This involves calculating how much (TAO) should be emitted into each subnet using the root
/// epoch function.
///
/// Step 2: Accumulate the subnet block emission.
/// After calculating the block-wise emission, these values are accumulated to keep track
/// of how much each subnet should emit before the next distribution phase. This accumulation
/// is a running total that gets updated each block.
/// After calculating the block-wise emission, these values are accumulated to keep track of how
/// much each subnet should emit before the next distribution phase. This accumulation is a
/// running total that gets updated each block.
///
/// Step 3: Distribute the accumulated emissions through epochs.
/// Subnets periodically distribute their accumulated emissions to hotkeys (active validators/miners)
/// in the network on a `tempo` --- the time between epochs. This step runs Yuma consensus to
/// determine how emissions are split among hotkeys based on their contributions and roles.
/// The accumulation of hotkey emissions is done through the `accumulate_hotkey_emission` function.
/// The function splits the rewards for a hotkey amongst itself and its `parents`. The parents are
/// the hotkeys that are delegating their stake to the hotkey.
/// Subnets periodically distribute their accumulated emissions to hotkeys (active
/// validators/miners) in the network on a `tempo` --- the time between epochs. This step runs
/// Yuma consensus to determine how emissions are split among hotkeys based on their
/// contributions and roles. The accumulation of hotkey emissions is done through the
/// `accumulate_hotkey_emission` function. The function splits the rewards for a hotkey amongst
/// itself and its `parents`. The parents are the hotkeys that are delegating their stake to the
/// hotkey.
///
/// Step 4: Further distribute emissions from hotkeys to nominators.
/// Finally, the emissions received by hotkeys are further distributed to their nominators,
/// who are stakeholders that support the hotkeys.
/// Finally, the emissions received by hotkeys are further distributed to their nominators, who
/// are stakeholders that support the hotkeys.
pub fn run_coinbase() {
// --- 0. Get current block.
let current_block: u64 = Self::get_current_block_as_u64();
@@ -327,9 +329,6 @@ impl<T: Config> Pallet<T> {
);
continue;
};

// If we reached here, we sucessfully set weights!
return Ok(());
}

Ok(())
12 changes: 0 additions & 12 deletions pallets/subtensor/src/epoch/run_epoch.rs
Original file line number Diff line number Diff line change
@@ -803,18 +803,6 @@ impl<T: Config> Pallet<T> {
I32F32::from_num(Self::get_kappa(netuid)).saturating_div(I32F32::from_num(u16::MAX))
}

pub fn get_normalized_stake(netuid: u16) -> Vec<I32F32> {
let n = Self::get_subnetwork_n(netuid);
let mut stake_64: Vec<I64F64> = (0..n)
.map(|neuron_uid| {
I64F64::from_num(Self::get_stake_for_uid_and_subnetwork(netuid, neuron_uid))
})
.collect();
inplace_normalize_64(&mut stake_64);
let stake: Vec<I32F32> = vec_fixed64_to_fixed32(stake_64);
stake
}

pub fn get_block_at_registration(netuid: u16) -> Vec<u64> {
let n = Self::get_subnetwork_n(netuid);
let block_at_registration: Vec<u64> = (0..n)
2 changes: 1 addition & 1 deletion pallets/subtensor/src/lib.rs
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ mod tests;
// apparently this is stabilized since rust 1.36
extern crate alloc;

pub const MAX_CRV3_COMMIT_SIZE_BYTES: u32 = 2048;
pub const MAX_CRV3_COMMIT_SIZE_BYTES: u32 = 5000;

#[deny(missing_docs)]
#[import_section(errors::errors)]
55 changes: 22 additions & 33 deletions pallets/subtensor/src/macros/errors.rs
Original file line number Diff line number Diff line change
@@ -22,33 +22,42 @@ mod errors {
HotKeyAccountNotExists,
/// The hotkey is not registered in any subnet.
HotKeyNotRegisteredInNetwork,
/// Request to stake, unstake or subscribe is made by a coldkey that is not associated with the hotkey account.
/// Request to stake, unstake or subscribe is made by a coldkey that is not associated with
/// the hotkey account.
NonAssociatedColdKey,
/// The hotkey is not a delegate and the signer is not the owner of the hotkey.
HotKeyNotDelegateAndSignerNotOwnHotKey,
/// Stake amount to withdraw is zero.
StakeToWithdrawIsZero,
/// The caller is requesting removing more stake than there exists in the staking account. See: "[remove_stake()]".
/// The caller is requesting removing more stake than there exists in the staking account.
/// See: "[remove_stake()]".
NotEnoughStakeToWithdraw,
/// The caller is requesting to set weights but the caller has less than minimum stake required to set weights (less than WeightsMinStake).
/// The caller is requesting to set weights but the caller has less than minimum stake
/// required to set weights (less than WeightsMinStake).
NotEnoughStakeToSetWeights,
/// The caller is requesting adding more stake than there exists in the coldkey account. See: "[add_stake()]"
/// The caller is requesting adding more stake than there exists in the coldkey account.
/// See: "[add_stake()]"
NotEnoughBalanceToStake,
/// The caller is trying to add stake, but for some reason the requested amount could not be withdrawn from the coldkey account.
/// The caller is trying to add stake, but for some reason the requested amount could not be
/// withdrawn from the coldkey account.
BalanceWithdrawalError,
/// Unsuccessfully withdraw, balance could be zero (can not make account exist) after withdrawal.
/// Unsuccessfully withdraw, balance could be zero (can not make account exist) after
/// withdrawal.
ZeroBalanceAfterWithdrawn,
/// The caller is attempting to set non-self weights without being a permitted validator.
NeuronNoValidatorPermit,
/// The caller is attempting to set the weight keys and values but these vectors have different size.
/// The caller is attempting to set the weight keys and values but these vectors have
/// different size.
WeightVecNotEqualSize,
/// The caller is attempting to set weights with duplicate UIDs in the weight matrix.
DuplicateUids,
/// The caller is attempting to set weight to at least one UID that does not exist in the metagraph.
/// The caller is attempting to set weight to at least one UID that does not exist in the
/// metagraph.
UidVecContainInvalidOne,
/// The dispatch is attempting to set weights on chain with fewer elements than are allowed.
WeightVecLengthIsLow,
/// Number of registrations in this block exceeds the allowed number (i.e., exceeds the subnet hyperparameter "max_regs_per_block").
/// Number of registrations in this block exceeds the allowed number (i.e., exceeds the
/// subnet hyperparameter "max_regs_per_block").
TooManyRegistrationsThisBlock,
/// The caller is requesting registering a neuron which already exists in the active set.
HotKeyAlreadyRegisteredInSubNet,
@@ -60,7 +69,8 @@ mod errors {
InvalidDifficulty,
/// The supplied PoW hash seal does not match the supplied work.
InvalidSeal,
/// The dispatch is attempting to set weights on chain with weight value exceeding the MaxWeightLimit (max_weight_limit subnet hyperparameter).
/// The dispatch is attempting to set weights on chain with weight value exceeding the
/// MaxWeightLimit (max_weight_limit subnet hyperparameter).
MaxWeightExceeded,
/// The hotkey is attempting to become a delegate when the hotkey is already a delegate.
HotKeyAlreadyDelegate,
@@ -114,7 +124,8 @@ mod errors {
DelegateTakeTooLow,
/// Delegate take is too high.
DelegateTakeTooHigh,
/// No commit found for the provided hotkey+netuid combination when attempting to reveal the weights.
/// No commit found for the provided hotkey+netuid combination when attempting to reveal the
/// weights.
NoWeightsCommitFound,
/// Committed hash does not equal the hashed reveal data.
InvalidRevealCommitHashNotMatch,
@@ -132,28 +143,10 @@ mod errors {
AlphaLowOutOfRange,
/// The coldkey has already been swapped
ColdKeyAlreadyAssociated,
/// The coldkey swap transaction rate limit exceeded
ColdKeySwapTxRateLimitExceeded,
/// The new coldkey is the same as the old coldkey
NewColdKeyIsSameWithOld,
/// The coldkey does not exist
NotExistColdkey,
/// The coldkey balance is not enough to pay for the swap
NotEnoughBalanceToPaySwapColdKey,
/// No balance to transfer
NoBalanceToTransfer,
/// Same coldkey
SameColdkey,
/// The coldkey is in arbitration
ColdkeyIsInArbitration,
/// The new coldkey is already registered for the drain
DuplicateColdkey,
/// Error thrown on a coldkey swap.
ColdkeySwapError,
/// Insufficient Balance to Schedule coldkey swap
InsufficientBalanceToPerformColdkeySwap,
/// The maximum number of coldkey destinations has been reached
MaxColdkeyDestinationsReached,
/// Attempting to set an invalid child for a hotkey on a network.
InvalidChild,
/// Duplicate child when setting children.
@@ -164,16 +157,12 @@ mod errors {
TooManyChildren,
/// Default transaction rate limit exceeded.
TxRateLimitExceeded,
/// Swap coldkey only callable by root.
SwapColdkeyOnlyCallableByRoot,
/// Swap already scheduled.
SwapAlreadyScheduled,
/// failed to swap coldkey
FailedToSchedule,
/// New coldkey is hotkey
NewColdKeyIsHotkey,
/// New coldkey is in arbitration
NewColdkeyIsInArbitration,
/// Childkey take is invalid.
InvalidChildkeyTake,
/// Childkey take rate limit exceeded.
14 changes: 0 additions & 14 deletions pallets/subtensor/src/rpc_info/delegate_info.rs
Original file line number Diff line number Diff line change
@@ -156,20 +156,6 @@ impl<T: Config> Pallet<T> {
total_delegated
}

// Helper function to get total delegated stake for a hotkey
pub fn get_total_hotkey_delegated_stake(hotkey: &T::AccountId) -> u64 {
let mut total_delegated = 0u64;

// Iterate through all delegators for this hotkey
for (delegator, stake) in Stake::<T>::iter_prefix(hotkey) {
if delegator != Self::get_coldkey_for_hotkey(hotkey) {
total_delegated = total_delegated.saturating_add(stake);
}
}

total_delegated
}

// Helper function to get the coldkey associated with a hotkey
pub fn get_coldkey_for_hotkey(hotkey: &T::AccountId) -> T::AccountId {
Owner::<T>::get(hotkey)
9 changes: 1 addition & 8 deletions pallets/subtensor/src/staking/helpers.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ use frame_support::{
storage::IterableStorageDoubleMap,
traits::{
tokens::{
fungible::{Balanced as _, Inspect as _, Mutate as _},
fungible::{Balanced as _, Inspect as _},
Fortitude, Precision, Preservation,
},
Imbalance,
@@ -341,13 +341,6 @@ impl<T: Config> Pallet<T> {
let _ = T::Currency::deposit(coldkey, amount, Precision::BestEffort);
}

pub fn set_balance_on_coldkey_account(
coldkey: &T::AccountId,
amount: <<T as Config>::Currency as fungible::Inspect<<T as system::Config>::AccountId>>::Balance,
) {
T::Currency::set_balance(coldkey, amount);
}

pub fn can_remove_balance_from_coldkey_account(
coldkey: &T::AccountId,
amount: <<T as Config>::Currency as fungible::Inspect<<T as system::Config>::AccountId>>::Balance,
8 changes: 0 additions & 8 deletions pallets/subtensor/src/subnets/serving.rs
Original file line number Diff line number Diff line change
@@ -246,14 +246,6 @@ impl<T: Config> Pallet<T> {
rate_limit == 0 || last_serve == 0 || current_block.saturating_sub(last_serve) >= rate_limit
}

pub fn has_axon_info(netuid: u16, hotkey: &T::AccountId) -> bool {
Axons::<T>::contains_key(netuid, hotkey)
}

pub fn has_prometheus_info(netuid: u16, hotkey: &T::AccountId) -> bool {
Prometheus::<T>::contains_key(netuid, hotkey)
}

pub fn get_axon_info(netuid: u16, hotkey: &T::AccountId) -> AxonInfoOf {
if let Some(axons) = Axons::<T>::get(netuid, hotkey) {
axons
7 changes: 0 additions & 7 deletions pallets/subtensor/src/subnets/uids.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;
use frame_support::storage::IterableStorageDoubleMap;
use frame_support::storage::IterableStorageMap;
use sp_std::vec;

impl<T: Config> Pallet<T> {
@@ -127,12 +126,6 @@ impl<T: Config> Pallet<T> {
}
}

/// Return the total number of subnetworks available on the chain.
///
pub fn get_number_of_subnets() -> u16 {
<SubnetworkN<T> as IterableStorageMap<u16, u16>>::iter().count() as u16
}

/// Return a list of all networks a hotkey is registered on.
///
pub fn get_registered_networks_for_hotkey(hotkey: &T::AccountId) -> Vec<u16> {
10 changes: 9 additions & 1 deletion pallets/subtensor/src/subnets/weights.rs
Original file line number Diff line number Diff line change
@@ -186,7 +186,15 @@ impl<T: Config> Pallet<T> {
let cur_epoch = Self::get_epoch_index(netuid, cur_block);
CRV3WeightCommits::<T>::try_mutate(netuid, cur_epoch, |commits| -> DispatchResult {
// 6. Verify that the number of unrevealed commits is within the allowed limit.
ensure!(commits.len() < 10, Error::<T>::TooManyUnrevealedCommits);

let unrevealed_commits_for_who = commits
.iter()
.filter(|(account, _, _)| account == &who)
.count();
ensure!(
unrevealed_commits_for_who < 10,
Error::<T>::TooManyUnrevealedCommits
);

// 7. Append the new commit with calculated reveal blocks.
// Hash the commit before it is moved, for the event
86 changes: 44 additions & 42 deletions pallets/subtensor/src/tests/epoch.rs
Original file line number Diff line number Diff line change
@@ -2737,46 +2737,48 @@ fn test_blocks_since_last_step() {
});
}

// // Map the retention graph for consensus guarantees with an single epoch on a graph with 512 nodes, of which the first 64 are validators, the graph is split into a major and minor set, each setting specific weight on itself and the complement on the other.
// //
// // ```import torch
// // import matplotlib.pyplot as plt
// // from matplotlib.pyplot import cm
// // %matplotlib inline
// //
// // with open('finney_consensus_0.4.txt') as f: # test output saved to finney_consensus.txt
// // retention_map = eval(f.read())
// //
// // major_ratios = {}
// // avg_weight_devs = {}
// // for major_stake, major_weight, minor_weight, avg_weight_dev, major_ratio in retention_map:
// // major_stake = f'{major_stake:.2f}'
// // maj, min = int(round(50 * major_weight)), int(round(50 * minor_weight))
// // avg_weight_devs.setdefault(major_stake, torch.zeros((51, 51)))
// // avg_weight_devs[major_stake][maj][min] = avg_weight_dev
// // major_ratios.setdefault(major_stake, torch.zeros((51, 51)))
// // major_ratios[major_stake][maj][min] = major_ratio
// //
// // _x = torch.linspace(0, 1, 51); _y = torch.linspace(0, 1, 51)
// // x, y = torch.meshgrid(_x, _y, indexing='ij')
// //
// // fig = plt.figure(figsize=(6, 6), dpi=70); ax = fig.gca()
// // ax.set_xticks(torch.arange(0, 1, 0.05)); ax.set_yticks(torch.arange(0, 1., 0.05))
// // ax.set_xticklabels([f'{_:.2f}'[1:] for _ in torch.arange(0, 1., 0.05)])
// // plt.grid(); plt.rc('grid', linestyle="dotted", color=[0.85, 0.85, 0.85])
// //
// // isolate = ['0.60']; stakes = [0.51, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.99]
// // colors = cm.viridis(torch.linspace(0, 1, len(stakes) + 1))
// // for i, stake in enumerate(stakes):
// // contours = plt.contour(x, y, major_ratios[f'{stake:.2f}'], levels=[0., stake], colors=[colors[i + 1]])
// // if f'{stake:.2f}' in isolate:
// // contours.collections[1].set_linewidth(3)
// // plt.clabel(contours, inline=True, fontsize=10)
// //
// // plt.title(f'Major emission [$stake_{{maj}}=emission_{{maj}}$ retention lines]')
// // plt.ylabel('Minor self-weight'); plt.xlabel('Major self-weight'); plt.show()
// // ```
// // #[test]
// Map the retention graph for consensus guarantees with an single epoch on a graph with 512 nodes,
// of which the first 64 are validators, the graph is split into a major and minor set, each setting
// specific weight on itself and the complement on the other.
//
// ```import torch
// import matplotlib.pyplot as plt
// from matplotlib.pyplot import cm
// %matplotlib inline
//
// with open('finney_consensus_0.4.txt') as f: # test output saved to finney_consensus.txt
// retention_map = eval(f.read())
//
// major_ratios = {}
// avg_weight_devs = {}
// for major_stake, major_weight, minor_weight, avg_weight_dev, major_ratio in retention_map:
// major_stake = f'{major_stake:.2f}'
// maj, min = int(round(50 * major_weight)), int(round(50 * minor_weight))
// avg_weight_devs.setdefault(major_stake, torch.zeros((51, 51)))
// avg_weight_devs[major_stake][maj][min] = avg_weight_dev
// major_ratios.setdefault(major_stake, torch.zeros((51, 51)))
// major_ratios[major_stake][maj][min] = major_ratio
//
// _x = torch.linspace(0, 1, 51); _y = torch.linspace(0, 1, 51)
// x, y = torch.meshgrid(_x, _y, indexing='ij')
//
// fig = plt.figure(figsize=(6, 6), dpi=70); ax = fig.gca()
// ax.set_xticks(torch.arange(0, 1, 0.05)); ax.set_yticks(torch.arange(0, 1., 0.05))
// ax.set_xticklabels([f'{_:.2f}'[1:] for _ in torch.arange(0, 1., 0.05)])
// plt.grid(); plt.rc('grid', linestyle="dotted", color=[0.85, 0.85, 0.85])
//
// isolate = ['0.60']; stakes = [0.51, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.99]
// colors = cm.viridis(torch.linspace(0, 1, len(stakes) + 1))
// for i, stake in enumerate(stakes):
// contours = plt.contour(x, y, major_ratios[f'{stake:.2f}'], levels=[0., stake], colors=[colors[i + 1]])
// if f'{stake:.2f}' in isolate:
// contours.collections[1].set_linewidth(3)
// plt.clabel(contours, inline=True, fontsize=10)
//
// plt.title(f'Major emission [$stake_{{maj}}=emission_{{maj}}$ retention lines]')
// plt.ylabel('Minor self-weight'); plt.xlabel('Major self-weight'); plt.show()
// ```
// #[test]
// fn _map_consensus_guarantees() {
// let netuid: u16 = 1;
// let network_n: u16 = 512;
@@ -2811,10 +2813,10 @@ fn test_blocks_since_last_step() {
// network_n as usize,
// interleave as usize,
// );

//
// new_test_ext(1).execute_with(|| {
// init_run_epochs(netuid, network_n, &validators, &servers, epochs, 1, true, &stake, true, &weights, true, false, 0, true);

//
// let mut major_emission: I64F64 = I64F64::from_num(0);
// let mut minor_emission: I64F64 = I64F64::from_num(0);
// for set in vec![major_validators, major_servers] {
459 changes: 445 additions & 14 deletions pallets/subtensor/src/tests/weights.rs

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions pallets/subtensor/src/utils/misc.rs
Original file line number Diff line number Diff line change
@@ -424,9 +424,6 @@ impl<T: Config> Pallet<T> {
Self::deposit_event(Event::AdjustmentAlphaSet(netuid, adjustment_alpha));
}

pub fn get_validator_prune_len(netuid: u16) -> u64 {
ValidatorPruneLen::<T>::get(netuid)
}
pub fn set_validator_prune_len(netuid: u16, validator_prune_len: u64) {
ValidatorPruneLen::<T>::insert(netuid, validator_prune_len);
Self::deposit_event(Event::ValidatorPruneLenSet(netuid, validator_prune_len));
13 changes: 0 additions & 13 deletions pallets/subtensor/src/utils/rate_limiting.rs
Original file line number Diff line number Diff line change
@@ -56,15 +56,6 @@ impl<T: Config> Pallet<T> {
last_block == 0 || block.saturating_sub(last_block) >= limit
}

/// Check if a transaction should be rate limited globally
pub fn passes_rate_limit_globally(tx_type: &TransactionType, hotkey: &T::AccountId) -> bool {
let netuid: u16 = u16::MAX;
let block: u64 = Self::get_current_block_as_u64();
let limit: u64 = Self::get_rate_limit(tx_type, 0);
let last_block: u64 = Self::get_last_transaction_block(hotkey, netuid, tx_type);
block.saturating_sub(last_block) >= limit
}

/// Get the block number of the last transaction for a specific hotkey, network, and transaction type
pub fn get_last_transaction_block(
hotkey: &T::AccountId,
@@ -98,10 +89,6 @@ impl<T: Config> Pallet<T> {
pub fn get_last_tx_block_delegate_take(key: &T::AccountId) -> u64 {
LastTxBlockDelegateTake::<T>::get(key)
}

pub fn set_last_tx_block_childkey_take(key: &T::AccountId, block: u64) {
LastTxBlockChildKeyTake::<T>::insert(key, block)
}
pub fn get_last_tx_block_childkey_take(key: &T::AccountId) -> u64 {
LastTxBlockChildKeyTake::<T>::get(key)
}