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 Rebase #669

Closed
wants to merge 240 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
240 commits
Select commit Hold shift + click to select a range
847da3d
Ban unsafe arithmetic operations
keithtensor May 24, 2024
2c5b1ff
clippy fixes
keithtensor Jun 19, 2024
cbb87c4
add requirement for `devnet-companion` label for `devnet-ready` PRs
sam0x17 Jun 19, 2024
25ceb3b
add testnet-ready labels check
sam0x17 Jun 19, 2024
82cad04
update CONTRIBUTING.md with additional info
sam0x17 Jun 19, 2024
509af18
update docs
sam0x17 Jun 19, 2024
c097ff8
Merge pull request #551 from opentensor/sam-add-companion-labels-check
sam0x17 Jun 21, 2024
9b22105
override default pages to 60k
orriin Jun 23, 2024
ca26101
Merge branch 'main' into override-default-pages
orriin Jun 23, 2024
43a23f4
update doc
orriin Jun 24, 2024
bff0750
Merge branch 'main' into fix/chainspecs
orriin Jun 24, 2024
c5865b4
update docs to use production profile
orriin Jun 24, 2024
f6608b8
update one error comment
open-junius Jun 25, 2024
15878cb
update spec file usage
orriin Jun 25, 2024
2eb1fe2
always run e2e tests on all pull requests and on push for major branches
sam0x17 Jun 26, 2024
61a2e48
Merge pull request #573 from opentensor/junius/fix-one-error-comment
sam0x17 Jun 26, 2024
a12f938
Merge remote-tracking branch 'origin/main' into sam-always-run-e2e-tests
sam0x17 Jun 26, 2024
c6e1079
Merge pull request #565 from opentensor/production-profile
sam0x17 Jun 28, 2024
721ee94
fix: run emissions when reg is off
Jul 1, 2024
a8b71e9
chore: bump spec version
Jul 1, 2024
59b0679
chore: add back rust docs
Jul 1, 2024
43f0402
chore: lints
Jul 1, 2024
535983f
Merge pull request #602 from opentensor/fix/no_reg_emissions
distributedstatemachine Jul 1, 2024
de10267
Merge pull request #485 from opentensor/ban-unsafe-arithmetic
keithtensor Jul 2, 2024
5d60be2
Merge remote-tracking branch 'origin/main' into sam-always-run-e2e-tests
sam0x17 Jul 2, 2024
951009c
Merge remote-tracking branch 'origin/main' into sam-add-freeze-layout
sam0x17 Jul 2, 2024
36a1aef
whoops
sam0x17 Jul 2, 2024
1bff8ad
Merge branch 'main' into override-default-pages
orriin Jul 2, 2024
ac4c3c2
fix hash codes
sam0x17 Jul 2, 2024
318eec8
Update running-subtensor-locally.md
orriin Jul 2, 2024
9051b4b
Update running-subtensor-locally.md
orriin Jul 2, 2024
f62d824
Merge pull request #561 from opentensor/override-default-pages
orriin Jul 2, 2024
0ce8638
Merge branch 'main' into fix/chainspecs
orriin Jul 2, 2024
e5f1346
Merge branch 'main' into feat/liquid_alpha_2
distributedstatemachine Jul 2, 2024
ce6793d
Merge pull request #493 from opentensor/fix/chainspecs
orriin Jul 2, 2024
824d952
chore: merge conflicts , safe maths
Jul 2, 2024
87c8d5f
chore: bump spec
Jul 2, 2024
8cb6cb1
Merge pull request #552 from opentensor/feat/liquid_alpha_2
distributedstatemachine Jul 2, 2024
c8b5ea0
Merge branch 'main' into fix/add-adjust-senate-call
distributedstatemachine Jul 2, 2024
60d0d7d
refactor: hotkey swap + tests
Jun 17, 2024
616c322
chore: lints
Jun 17, 2024
affd4b8
chore: clippy
Jun 17, 2024
04637f8
chore: give 1k on faucet for easier to create networks locally
Jun 17, 2024
62e5907
Correct the expected weights on the register extrinsic
keithtensor Jun 17, 2024
9667b49
Update pallets/subtensor/src/swap.rs
distributedstatemachine Jun 17, 2024
b60b544
chore: updates from using real weights in tests
Jun 17, 2024
31f320c
chore: review comments , make swap cost a constant
Jun 17, 2024
8d7e186
chore: runtime consts
Jun 17, 2024
9eeff75
chore: clear prefix for removing old value from stake map
Jun 17, 2024
12161b0
chore: pr comments assert keys
Jun 17, 2024
966b5a2
chore: pr comments: remove last tx block
Jun 17, 2024
062fa09
chore: fmt
Jun 17, 2024
52831fa
Use concrete numbers for weight expectations
keithtensor Jun 18, 2024
b0e5673
Update pallets/subtensor/src/swap.rs
distributedstatemachine Jun 18, 2024
5938d16
chore: add test_swap_hotkey_tx_rate_limit_exceeded
Jun 18, 2024
2e6422d
chore: fmt
Jun 18, 2024
c595f44
chore: review comments
Jun 18, 2024
b9e6a26
fix: pr comments
Jun 21, 2024
8626ca3
chore: lint
Jun 21, 2024
2fc9e31
fix: remove unused function
Jun 21, 2024
7518c55
clippy fix
sam0x17 Jun 21, 2024
cadbe59
chore: conflicts, lints
Jul 2, 2024
2dda611
chore: lints
Jul 2, 2024
74de077
Merge pull request #553 from opentensor/safe-mode
keithtensor Jul 2, 2024
28872d6
Implement safe mode pallet
keithtensor Jun 13, 2024
76adc8f
Bump spec version and safe mode enter duration
keithtensor Jul 2, 2024
8179fbd
Merge pull request #608 from opentensor/safe-mode-emergency
sam0x17 Jul 2, 2024
8ff7e9c
whitelist subtensor calls during safe mode
sam0x17 Jul 2, 2024
0db5ad4
bump spec version
sam0x17 Jul 2, 2024
6dbcbff
whitelist commit_weights and add_stake
sam0x17 Jul 2, 2024
8143105
remove commit weights
sam0x17 Jul 2, 2024
2002b8d
Merge pull request #609 from opentensor/whitelist-subtensor-calls
distributedstatemachine Jul 2, 2024
8130bc8
whoops
sam0x17 Jul 2, 2024
c85ca82
Merge remote-tracking branch 'origin/emergency' into whitelist-subten…
sam0x17 Jul 2, 2024
d79f73b
Whitelist the majority of the extrinsics in subtensor pallet and mult…
keithtensor Jul 3, 2024
1934f33
Merge pull request #556 from opentensor/refactor/hotkey_swap
distributedstatemachine Jul 3, 2024
8128a7a
cargo fmt
keithtensor Jul 3, 2024
471e937
Merge pull request #610 from opentensor/safe-mode-emergency
keithtensor Jul 3, 2024
7ef1cb5
update cargo.lock
sam0x17 Jul 3, 2024
b45bec8
Merge remote-tracking branch 'origin/main' into sam-add-freeze-layout
sam0x17 Jul 3, 2024
b3fb04a
Merge remote-tracking branch 'origin/main' into sam-always-run-e2e-tests
sam0x17 Jul 3, 2024
dba168e
fix hash code
sam0x17 Jul 3, 2024
190b254
fix another hash code
sam0x17 Jul 3, 2024
0ab4a91
update another hash code
sam0x17 Jul 3, 2024
ac74347
feat: cold key swap
Jul 3, 2024
86e9d7b
Add Owned map and migration to populate it
gztensor Jul 3, 2024
347b8de
Swapping coldkeys: unbreak the build
gztensor Jul 3, 2024
bda0c5a
Fix coldkey_swap and its tests
gztensor Jul 3, 2024
49d19b1
chore: lints
Jul 4, 2024
c82f82f
chore: pr comments
Jul 4, 2024
4e68a5b
Merge branch 'main' into emergency
distributedstatemachine Jul 4, 2024
1f753d8
bump spec version
sam0x17 Jul 4, 2024
ae4cdf3
bump spec version
sam0x17 Jul 4, 2024
0855df7
chore: pr review, make swaps free
Jul 4, 2024
621725f
chore: unstake + transfer
Jul 4, 2024
d81e523
Merge pull request #612 from opentensor/emergency
distributedstatemachine Jul 4, 2024
6586156
Update pallets/subtensor/tests/swap.rs
distributedstatemachine Jul 4, 2024
e6b8aab
Update pallets/subtensor/tests/swap.rs
distributedstatemachine Jul 4, 2024
c4a1e6e
Update pallets/subtensor/tests/swap.rs
distributedstatemachine Jul 4, 2024
d70ef06
Update pallets/subtensor/tests/swap.rs
distributedstatemachine Jul 4, 2024
cc24255
Merge branch 'main' into feat/cold_key_swap
distributedstatemachine Jul 4, 2024
7062a3e
chore: additional tests
Jul 4, 2024
a0fa527
chore: fix tests
Jul 4, 2024
a3ef6e0
Merge pull request #611 from opentensor/feat/cold_key_swap
distributedstatemachine Jul 4, 2024
94b0954
adds tests fixes remove hotkey
Jul 5, 2024
5a26348
lints
Jul 5, 2024
a62975c
Merge pull request #614 from opentensor/feat/cold_key_swap
garrett-opentensor Jul 5, 2024
dbea365
Add migration to populate StakingHotkeys, unstake delegations in do_u…
gztensor Jul 5, 2024
f037dbc
Filter migration StakingHotkey by non-zero stakes, bump spec version
gztensor Jul 5, 2024
5b5ac3a
Merge pull request #615 from opentensor/feat/cold-hot-staking-map
garrett-opentensor Jul 5, 2024
c66aeb9
initial
Jul 5, 2024
4a39895
merge
Jul 5, 2024
bfea68a
push changes
Jul 5, 2024
462ed12
Fix build and straighten up the logic for draining coldkeys
gztensor Jul 5, 2024
7149b5b
Make tests build for draining coldkeys
gztensor Jul 5, 2024
b76408a
merge
Jul 6, 2024
b6bdb30
Merge branch 'arbitrage_coldkeys' of github.com:opentensor/subtensor …
Jul 6, 2024
a499116
Fix coldkey drain
gztensor Jul 6, 2024
3f3201c
Merge branch 'arbitrage_coldkeys' of github.com:opentensor/subtensor …
Jul 6, 2024
c5aef40
check
Jul 6, 2024
8851879
passing here
Jul 6, 2024
e7337af
fxi tests on arbitrated coldkey swap
Jul 6, 2024
cf4c8d5
add more test
Jul 6, 2024
c5b78f8
chore: update comments, lints
Jul 7, 2024
dad3925
fix: tests , feat: benchmarks
Jul 7, 2024
9a3f725
fix: benchmarks
Jul 7, 2024
f32c546
chore: whitelist schedule_arbitrated_coldkey_swap and set_weights, se…
Jul 7, 2024
68df4e1
feat: signed extension arbitration , swap cold key min amount
Jul 7, 2024
507e8cf
chore: lints
Jul 7, 2024
0bcdd26
feat: signed extensions , reduce arbitration time
Jul 7, 2024
b41a2d5
lints, bump spec version
Jul 7, 2024
7d589c4
Merge pull request #619 from opentensor/feat/extend_safe_mode
distributedstatemachine Jul 7, 2024
cc9c094
feat: pow coldkey swaps ,todo fix tests , dont clear map during abrit…
Jul 7, 2024
60f3713
fix unit tests
open-junius Jul 8, 2024
c210904
fix conflict
open-junius Jul 8, 2024
be043ac
update runtime version
open-junius Jul 8, 2024
25744e4
fix benchmark function
open-junius Jul 8, 2024
8f8b92c
add arithmetic side effects
open-junius Jul 8, 2024
6daad1e
fix clippy in test file
open-junius Jul 8, 2024
fd980b1
chore: add event
Jul 8, 2024
c572ed6
Merge remote-tracking branch 'origin/main' into sam-add-freeze-layout
sam0x17 Jul 8, 2024
44e26ff
Merge remote-tracking branch 'origin/main' into sam-always-run-e2e-tests
sam0x17 Jul 8, 2024
fbe1924
feat: unlimited arb time
Jul 8, 2024
2e2b51d
fix: broken test
Jul 8, 2024
82be091
use on_idle for swap_coldkeys logic
orriin Jul 8, 2024
01c1529
Merge branch 'arbitrage_coldkeys' into arbitrate_coldkeys_on_idle
orriin Jul 8, 2024
247c861
Increase base difficulty to 10M for PoW swaps
gztensor Jul 8, 2024
219413c
Merge pull request #621 from opentensor/arbitrate_coldkeys_on_idle
orriin Jul 8, 2024
c6dab93
add the unit test back
open-junius Jul 8, 2024
e271f37
fix broken tests
Jul 8, 2024
54a1466
chore: fix tests
Jul 8, 2024
7bf6524
chore: fix test_arbitrated_coldkey_swap_multiple_arbitrations
Jul 8, 2024
2891d62
chore: fix tests
Jul 8, 2024
d1ee744
add swap test
Jul 8, 2024
9b4d63f
Merge branch 'arbitrage_coldkeys' of github.com:opentensor/subtensor …
Jul 8, 2024
4a97e79
working
Jul 8, 2024
ba00c23
add stake balance as equal
Jul 8, 2024
41feafc
chore: bump spec version
Jul 8, 2024
b1feb3c
feat: reduce arb period to 18 hours for testnet
Jul 8, 2024
6b9801f
Merge pull request #533 from opentensor/sam-add-freeze-layout
sam0x17 Jul 8, 2024
2a48be8
Merge pull request #586 from opentensor/sam-always-run-e2e-tests
sam0x17 Jul 8, 2024
e4c9ef2
feat: allow subnet owners to swap without funds , todo: fix test_comp…
Jul 8, 2024
af555d7
chore: introduce difficulty var to make tests shorter , fix test_comp…
Jul 9, 2024
a14337b
make it easier
open-junius Jul 9, 2024
83819ff
fix fmt
open-junius Jul 9, 2024
4563e78
feat: get total delegated stake
Jul 9, 2024
4eefcf9
fix: delegated stake tests, whitelist serve_axon, lints
Jul 9, 2024
e30c8f4
feat: coldkey swap info
Jul 9, 2024
7aaeb09
feat: move back to on_initialise, lints
Jul 9, 2024
b43bed6
draft: hotkey swap for senate
Jul 9, 2024
3817b76
chore: bump arb delay back to 3 days
Jul 9, 2024
380aa65
chore: reduce min tao req to 0.1
Jul 9, 2024
fec59cb
feat: whitelist set_commitment
Jul 9, 2024
9de2afb
spec verion , lints
Jul 9, 2024
0efeaf3
Merge pull request #620 from opentensor/arbitrage_coldkeys
distributedstatemachine Jul 9, 2024
dc96aad
fix clippy issue
sam0x17 Jul 10, 2024
966eaf3
Merge remote-tracking branch 'origin/main' into fix/add-adjust-senate…
sam0x17 Jul 10, 2024
0abfb9b
chore: remove coldkey swap rpc
Jul 12, 2024
3e8afeb
Merge pull request #627 from opentensor/fix/remove_childkey_rpcs
distributedstatemachine Jul 12, 2024
bcb696b
Merge pull request #490 from opentensor/fix/add-adjust-senate-call
sam0x17 Jul 12, 2024
dc3f178
Make weighted_median iterative
keithtensor Jul 1, 2024
bba97c8
Merge remote-tracking branch 'origin/main' into merge-main-into-devne…
sam0x17 Jul 12, 2024
177c47a
fix merge conflict
sam0x17 Jul 12, 2024
9d1f6c9
feat: remove schedule coldkey swap
Jul 12, 2024
90512c2
chore: fix tests
Jul 12, 2024
dd87bca
Merge branch 'fix/hotkeyswap_senate' into feat/remove_schedule_coldke…
Jul 12, 2024
606b771
fixes for network resumption
Jul 12, 2024
8ebcf2d
chore: bump spec
Jul 12, 2024
7b84d3c
fix: add back arbitration check
Jul 12, 2024
2455082
fix: hotkey
Jul 12, 2024
f49bb55
fix: coldkey arb swap hotkey
Jul 12, 2024
884a179
Merge pull request #631 from opentensor/feat/remove_schedule_coldkey_…
distributedstatemachine Jul 12, 2024
76f20ce
swap delegate stake also
camfairchild Jul 13, 2024
4ccb879
add test for this
camfairchild Jul 13, 2024
73533b9
swap over stakinghotkeys map
camfairchild Jul 13, 2024
c370aad
check map first
camfairchild Jul 13, 2024
9b8c0e4
add staking hotkeys test
camfairchild Jul 13, 2024
baec581
no take
camfairchild Jul 13, 2024
a84ac6b
keep old stake
camfairchild Jul 13, 2024
221d320
add check to test
camfairchild Jul 13, 2024
f9164fc
fix some tests
camfairchild Jul 13, 2024
2a14df7
fix delegate test
camfairchild Jul 13, 2024
b970f50
update staking hotekys maps
camfairchild Jul 13, 2024
ad57e2b
init
camfairchild Jul 13, 2024
1cc7d3c
comment out
camfairchild Jul 13, 2024
6dcd0a1
add admin swap
camfairchild Jul 13, 2024
f474112
fix swap
camfairchild Jul 13, 2024
b708c1d
..
camfairchild Jul 13, 2024
5b30256
hotkey staking maps fix
Jul 13, 2024
fc245f8
remove staking hotkeys
Jul 13, 2024
494796e
remove commented code
Jul 13, 2024
f041ed9
cargo fmt
sam0x17 Jul 13, 2024
54ec750
cargo fix --workspace
sam0x17 Jul 13, 2024
ca51109
bump spec_version to 165
sam0x17 Jul 13, 2024
98a1ed2
Merge pull request #629 from opentensor/merge-main-into-devnet-ready-…
sam0x17 Jul 15, 2024
4dafd88
swap hotkey benchmark removed
Jul 15, 2024
d95a7df
add migration and tests for total coldkey hotfix
Jul 15, 2024
5e6fc7e
adds new test for missing hotkey value
Jul 15, 2024
3c61aa8
bump migration values
Jul 15, 2024
ff23b6f
fmt
Jul 15, 2024
0c2ad41
Merge pull request #636 from opentensor/total_coldkey_migration
unconst Jul 15, 2024
b3fa487
feat: try runtime passing
Jul 16, 2024
8766c98
chore: remove commented code
Jul 16, 2024
92fc1f0
chore: make logs human readable
Jul 16, 2024
c255d92
chore: remove comments
Jul 16, 2024
0478596
Update pallets/subtensor/src/lib.rs
distributedstatemachine Jul 16, 2024
5adbbd9
Merge pull request #644 from opentensor/hotfix/storage_version_incons…
distributedstatemachine Jul 16, 2024
8f6e8d6
add test first
camfairchild Jul 16, 2024
f25bdda
clear map before rest of migration
camfairchild Jul 16, 2024
e009ff1
track weight for clear/removal
camfairchild Jul 16, 2024
480b1c5
add comment
camfairchild Jul 16, 2024
eb4a57c
rename test
camfairchild Jul 16, 2024
23f540c
add test for emission appends staking hotkeys map
camfairchild Jul 16, 2024
a2b8d70
Merge pull request #645 from opentensor/fix/total-coldkey-stake-migra…
distributedstatemachine Jul 16, 2024
aa5e890
Merge main into devnet ready 7 18 2024 (#650)
camfairchild Jul 19, 2024
ce3e87e
Merge pull request #628 from opentensor/end-recursion-devnet
keithtensor Jul 22, 2024
1c50295
Feat/devnet companion/check metadata hash extension (#649)
camfairchild Jul 22, 2024
c9202c9
Merge branch 'devnet-ready' into main
unconst Jul 22, 2024
2bb1557
Revert "Merge branch 'devnet-ready' into main"
Jul 22, 2024
d7fd308
Merge pull request #664 from opentensor/main-fix
unconst 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
8 changes: 1 addition & 7 deletions .github/workflows/e2e-bittensor-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ concurrency:
cancel-in-progress: true

on:
## Run automatically for all PRs against main, regardless of what the changes are
## to be safe and so we can more easily force re-run the CI when github is being
## weird by using a blank commit
push:
branches: [main, development, staging]
branches: [main, devnet-ready, devnet, testnet, finney]

##
# Run automatically for PRs against default/main branch if Rust files change
pull_request:
branches: [main, development, staging]

## Allow running workflow manually from the Actions tab
workflow_dispatch:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ specs/*.json
.idea

# Runtime upgrade snapshot
bt.snap
bt.snap

# localnet spec
scripts/specs/local.json
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ COPY Cargo.lock Cargo.toml /subtensor/

# Specs
COPY ./snapshot.json /subtensor/snapshot.json
COPY ./raw_spec_testfinney.json /subtensor/raw_spec_testfinney.json
COPY ./raw_spec_finney.json /subtensor/raw_spec_finney.json

# Copy our sources
COPY ./node /subtensor/node
Expand All @@ -51,11 +53,13 @@ RUN /subtensor/scripts/init.sh

# Cargo build
WORKDIR /subtensor
RUN cargo build --release --features runtime-benchmarks --locked
RUN cargo build --profile production --features runtime-benchmarks --locked
EXPOSE 30333 9933 9944


FROM $BASE_IMAGE AS subtensor

COPY --from=builder /subtensor/snapshot.json /
COPY --from=builder /subtensor/target/release/node-subtensor /usr/local/bin
COPY --from=builder /subtensor/raw_spec_testfinney.json /
COPY --from=builder /subtensor/raw_spec_finney.json /
COPY --from=builder /subtensor/target/production/node-subtensor /usr/local/bin
10 changes: 5 additions & 5 deletions docs/running-subtensor-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ rm -rf /tmp/blockchain
Install subtensor by compiling with `cargo`:

```bash
cargo build --release --features=runtime-benchmarks
cargo build --profile production --features=runtime-benchmarks
```

## Run the subtensor node
Expand All @@ -174,31 +174,31 @@ You can now run the public subtensor node either as a lite node or as an archive
To run a lite node connected to the mainchain, execute the below command (note the `--sync=warp` flag which runs the subtensor node in lite mode):

```bash title="With --sync=warp setting, for lite node"
./target/release/node-subtensor --chain raw_spec_finney.json --base-path /tmp/blockchain --sync=warp --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
./target/production/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=warp --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
```

### Archive node on mainchain

To run an archive node connected to the mainchain, execute the below command (note the `--sync=full` which syncs the node to the full chain and `--pruning archive` flags, which disables the node's automatic pruning of older historical data):

```bash title="With --sync=full and --pruning archive setting, for archive node"
./target/release/node-subtensor --chain raw_spec_finney.json --base-path /tmp/blockchain --sync=full --pruning archive --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
./target/production/node-subtensor --chain raw_spec.json --base-path /tmp/blockchain --sync=full --pruning archive --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /ip4/13.58.175.193/tcp/30333/p2p/12D3KooWDe7g2JbNETiKypcKT1KsCEZJbTzEHCn8hpd4PHZ6pdz5 --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
```

### Lite node on testchain

To run a lite node connected to the testchain, execute the below command:

```bash title="With bootnodes set to testnet and --sync=warp setting, for lite node."
./target/release/node-subtensor --chain raw_spec_testfinney.json --base-path /tmp/blockchain --sync=warp --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
./target/production/node-subtensor --chain raw_testspec.json --base-path /tmp/blockchain --sync=warp --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
```

### Archive node on testchain

To run an archive node connected to the testchain, execute the below command:

```bash title="With bootnodes set to testnet and --sync=full and --pruning archive setting, for archive node"
./target/release/node-subtensor --chain raw_spec_testfinney.json --base-path /tmp/blockchain --sync=full --pruning archive --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
./target/production/node-subtensor --chain raw_testspec.json --base-path /tmp/blockchain --sync=full --pruning archive --port 30333 --max-runtime-instances 32 --rpc-max-response-size 2048 --rpc-cors all --rpc-port 9944 --bootnodes /dns/bootnode.test.finney.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr --no-mdns --in-peers 8000 --out-peers 8000 --prometheus-external --rpc-external
```

## Running on cloud
Expand Down
6 changes: 3 additions & 3 deletions docs/rust-setup.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: Installation
---

This guide is for reference only, please check the latest information on getting starting with Substrate
This guide is for reference only, please check the latest information on getting starting with Substrate
[here](https://docs.substrate.io/main-docs/install/).

This page will guide you through the **2 steps** needed to prepare a computer for **Substrate** development.
Expand Down Expand Up @@ -207,7 +206,7 @@ Use the `WASM_BUILD_TOOLCHAIN` environment variable to specify the Rust nightly
project should use for Wasm compilation:

```bash
WASM_BUILD_TOOLCHAIN=nightly-<yyyy-MM-dd> cargo build --release
WASM_BUILD_TOOLCHAIN=nightly-<yyyy-MM-dd> cargo build --profile production
```

> Note that this only builds _the runtime_ with the specified nightly. The rest of project will be
Expand All @@ -223,3 +222,4 @@ rustup uninstall nightly
rustup install nightly-<yyyy-MM-dd>
rustup target add wasm32-unknown-unknown --toolchain nightly-<yyyy-MM-dd>
```

11 changes: 6 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ clippy:
-D clippy::unimplemented

clippy-fix:
@echo "Running cargo clippy with automatic fixes on potentially dirty code..."
cargo +{{RUSTV}} clippy --workspace --all-targets --fix --allow-dirty -- \
-A clippy::todo \
-A clippy::unimplemented \
-A clippy::indexing_slicing
@echo "Running cargo clippy with automatic fixes on potentially dirty code..."
cargo +{{RUSTV}} clippy --fix --allow-dirty --allow-staged --workspace --all-targets -- \
-A clippy::todo \
-A clippy::unimplemented \
-A clippy::indexing_slicing

fix:
@echo "Running cargo fix..."
cargo +{{RUSTV}} fix --workspace
Expand Down
20 changes: 9 additions & 11 deletions pallets/admin-utils/scripts/benchmark.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
cargo build --release --features runtime-benchmarks
./target/release/node-subtensor benchmark pallet \
--chain=local \
--execution=wasm \
--wasm-execution=compiled \
--pallet=pallet_admin_utils \
--extrinsic="*" \
--steps 50 \
--repeat 20 \
--output=pallets/admin-utils/src/weights.rs \
--template=./.maintain/frame-weight-template.hbs
cargo build --profile production --features runtime-benchmarks
./target/production/node-subtensor benchmark pallet \
--chain=local \
--pallet=pallet_admin_utils \
--extrinsic="*" \
--steps 50 \
--repeat 20 \
--output=pallets/admin-utils/src/weights.rs \
--template=./.maintain/frame-weight-template.hbs
6 changes: 4 additions & 2 deletions pallets/admin-utils/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ parameter_types! {
pub const InitialSubnetLimit: u16 = 10; // Max 10 subnets.
pub const InitialNetworkRateLimit: u64 = 0;
pub const InitialTargetStakesPerInterval: u16 = 1;
pub const InitialHotkeySwapCost: u64 = 1_000_000_000;
pub const InitialKeySwapCost: u64 = 1_000_000_000;
pub const InitialAlphaHigh: u16 = 58982; // Represents 0.9 as per the production default
pub const InitialAlphaLow: u16 = 45875; // Represents 0.7 as per the production default
pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn
pub const InitialBaseDifficulty: u64 = 10_000; // Base difficulty
}

impl pallet_subtensor::Config for Test {
Expand Down Expand Up @@ -165,10 +166,11 @@ impl pallet_subtensor::Config for Test {
type InitialSubnetLimit = InitialSubnetLimit;
type InitialNetworkRateLimit = InitialNetworkRateLimit;
type InitialTargetStakesPerInterval = InitialTargetStakesPerInterval;
type HotkeySwapCost = InitialHotkeySwapCost;
type KeySwapCost = InitialKeySwapCost;
type AlphaHigh = InitialAlphaHigh;
type AlphaLow = InitialAlphaLow;
type LiquidAlphaOn = InitialLiquidAlphaOn;
type InitialBaseDifficulty = InitialBaseDifficulty;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
Expand Down
2 changes: 1 addition & 1 deletion pallets/collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<AccountId, I> GetBacking for RawOrigin<AccountId, I> {
}

/// Info for keeping track of a motion being voted on.
#[freeze_struct("5959418cdb31993b")]
#[freeze_struct("a8e7b0b34ad52b17")]
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct Votes<AccountId, BlockNumber> {
/// The proposal's unique index.
Expand Down
16 changes: 7 additions & 9 deletions pallets/commitments/scripts/benchmark.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
cargo build --release --features runtime-benchmarks
./target/release/node-subtensor benchmark pallet \
--chain=local \
--execution=wasm \
--wasm-execution=compiled \
--pallet=pallet_commitments \
--extrinsic="*" \
--output=pallets/commitments/src/weights.rs \
--template=./.maintain/frame-weight-template.hbs
cargo build --profile production --features runtime-benchmarks
./target/production/node-subtensor benchmark pallet \
--chain=local \
--pallet=pallet_commitments \
--extrinsic="*" \
--output=pallets/commitments/src/weights.rs \
--template=./.maintain/frame-weight-template.hbs
14 changes: 6 additions & 8 deletions pallets/registry/scripts/benchmark.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
cargo build --release --features runtime-benchmarks
./target/release/node-subtensor benchmark pallet \
--chain=local \
--execution=wasm \
--wasm-execution=compiled \
--pallet=pallet_registry \
--extrinsic="*" \
--output=pallets/registry/src/weights.rs \
--template=./.maintain/frame-weight-template.hbs
./target/production/node-subtensor benchmark pallet \
--chain=local \
--pallet=pallet_registry \
--extrinsic="*" \
--output=pallets/registry/src/weights.rs \
--template=./.maintain/frame-weight-template.hbs
2 changes: 1 addition & 1 deletion pallets/registry/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl TypeInfo for IdentityFields {
///
/// NOTE: This should be stored at the end of the storage item to facilitate the addition of extra
/// fields in a backwards compatible way through a specialized `Decode` impl.
#[freeze_struct("9d47309f8e379957")]
#[freeze_struct("98e2d7fc7536226b")]
#[derive(
CloneNoBound, Encode, Decode, Eq, MaxEncodedLen, PartialEqNoBound, RuntimeDebugNoBound, TypeInfo,
)]
Expand Down
80 changes: 28 additions & 52 deletions pallets/subtensor/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ benchmarks! {
// This is a whitelisted caller who can make transaction without weights.
let caller: T::AccountId = whitelisted_caller::<AccountIdOf<T>>();
let caller_origin = <T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));
let netuid: u16 = 0;
let netuid: u16 = 1;
let version_key: u64 = 1;
let tempo: u16 = 1;
let modality: u16 = 0;
Expand Down Expand Up @@ -314,33 +314,33 @@ benchmarks! {
assert_ok!(Subtensor::<T>::register_network(RawOrigin::Signed(coldkey.clone()).into()));
}: dissolve_network(RawOrigin::Signed(coldkey), 1)

swap_hotkey {
let seed: u32 = 1;
let coldkey: T::AccountId = account("Alice", 0, seed);
let old_hotkey: T::AccountId = account("Bob", 0, seed);
let new_hotkey: T::AccountId = account("Charlie", 0, seed);

let netuid = 1u16;
Subtensor::<T>::init_new_network(netuid, 100);
Subtensor::<T>::set_min_burn(netuid, 1);
Subtensor::<T>::set_max_burn(netuid, 1);
Subtensor::<T>::set_target_registrations_per_interval(netuid, 256);
Subtensor::<T>::set_max_registrations_per_block(netuid, 256);

Subtensor::<T>::add_balance_to_coldkey_account(&coldkey.clone(), 10_000_000_000u64);
assert_ok!(Subtensor::<T>::burned_register(RawOrigin::Signed(coldkey.clone()).into(), netuid, old_hotkey.clone()));
assert_ok!(Subtensor::<T>::become_delegate(RawOrigin::Signed(coldkey.clone()).into(), old_hotkey.clone()));

let max_uids = Subtensor::<T>::get_max_allowed_uids(netuid) as u32;
for i in 0..max_uids - 1 {
let coldkey: T::AccountId = account("Axon", 0, i);
let hotkey: T::AccountId = account("Hotkey", 0, i);

Subtensor::<T>::add_balance_to_coldkey_account(&coldkey.clone(), 10_000_000_000u64);
assert_ok!(Subtensor::<T>::burned_register(RawOrigin::Signed(coldkey.clone()).into(), netuid, hotkey));
assert_ok!(Subtensor::<T>::add_stake(RawOrigin::Signed(coldkey).into(), old_hotkey.clone(), 1_000_000_000));
}
}: _(RawOrigin::Signed(coldkey), old_hotkey, new_hotkey)
// swap_hotkey {
// let seed: u32 = 1;
// let coldkey: T::AccountId = account("Alice", 0, seed);
// let old_hotkey: T::AccountId = account("Bob", 0, seed);
// let new_hotkey: T::AccountId = account("Charlie", 0, seed);

// let netuid = 1u16;
// Subtensor::<T>::init_new_network(netuid, 100);
// Subtensor::<T>::set_min_burn(netuid, 1);
// Subtensor::<T>::set_max_burn(netuid, 1);
// Subtensor::<T>::set_target_registrations_per_interval(netuid, 256);
// Subtensor::<T>::set_max_registrations_per_block(netuid, 256);

// Subtensor::<T>::add_balance_to_coldkey_account(&coldkey.clone(), 10_000_000_000u64);
// assert_ok!(Subtensor::<T>::burned_register(RawOrigin::Signed(coldkey.clone()).into(), netuid, old_hotkey.clone()));
// assert_ok!(Subtensor::<T>::become_delegate(RawOrigin::Signed(coldkey.clone()).into(), old_hotkey.clone()));

// let max_uids = Subtensor::<T>::get_max_allowed_uids(netuid) as u32;
// for i in 0..max_uids - 1 {
// let coldkey: T::AccountId = account("Axon", 0, i);
// let hotkey: T::AccountId = account("Hotkey", 0, i);

// Subtensor::<T>::add_balance_to_coldkey_account(&coldkey.clone(), 10_000_000_000u64);
// assert_ok!(Subtensor::<T>::burned_register(RawOrigin::Signed(coldkey.clone()).into(), netuid, hotkey));
// assert_ok!(Subtensor::<T>::add_stake(RawOrigin::Signed(coldkey).into(), old_hotkey.clone(), 1_000_000_000));
// }
// }: _(RawOrigin::Signed(coldkey), old_hotkey, new_hotkey)

commit_weights {
let tempo: u16 = 1;
Expand Down Expand Up @@ -429,28 +429,4 @@ reveal_weights {

}: reveal_weights(RawOrigin::Signed(hotkey.clone()), netuid, uids, weight_values, salt, version_key)


adjust_senate {
migration::migrate_create_root_network::<T>();
let netuid: u16 = 1;
let tempo: u16 = 13;
let burn_cost = 1000;
let hotkey: T::AccountId = account("hot", 0, 1);
let coldkey: T::AccountId = account("cold", 0, 2);

Subtensor::<T>::init_new_network(netuid, 100);
Subtensor::<T>::set_burn(netuid, 1);
Subtensor::<T>::set_max_allowed_uids( netuid, 4096 );
assert_eq!(Subtensor::<T>::get_max_allowed_uids(netuid), 4096);
Subtensor::<T>::set_burn(netuid, burn_cost);

let amount_to_be_staked = 100_000_000_000;
Subtensor::<T>::add_balance_to_coldkey_account(&coldkey.clone(), amount_to_be_staked);

assert_ok!(Subtensor::<T>::burned_register(RawOrigin::Signed(coldkey.clone()).into(), netuid, hotkey.clone()));
assert_ok!(Subtensor::<T>::become_delegate(RawOrigin::Signed(coldkey.clone()).into(), hotkey.clone()));
assert_ok!(Subtensor::<T>::root_register(RawOrigin::Signed(coldkey.clone()).into(), hotkey.clone()));
T::SenateMembers::remove_member(&hotkey).map_err(|_| "Failed to remove member")?;

}: adjust_senate(RawOrigin::Signed(coldkey.clone()), hotkey.clone())
}
8 changes: 6 additions & 2 deletions pallets/subtensor/src/block_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,17 @@ impl<T: Config> Pallet<T> {
// --- 1. Iterate across each network and add pending emission into stash.
for (netuid, tempo) in <Tempo<T> as IterableStorageMap<u16, u16>>::iter() {
// Skip the root network or subnets with registrations turned off
if netuid == Self::get_root_netuid() || !Self::is_registration_allowed(netuid) {
if netuid == Self::get_root_netuid() {
// Root emission or subnet emission is burned
continue;
}

// --- 2. Queue the emission due to this network.
let new_queued_emission: u64 = Self::get_subnet_emission_value(netuid);
let mut new_queued_emission: u64 = Self::get_subnet_emission_value(netuid);
if !Self::is_registration_allowed(netuid) {
new_queued_emission = 0; // No emission for this network if registration is off.
}

log::debug!(
"generate_emission for netuid: {:?} with tempo: {:?} and emission: {:?}",
netuid,
Expand Down
Loading
Loading