Skip to content

Commit fb2484b

Browse files
authored
Merge pull request #667 from opentensor/devnet-ready
Devnet Rebase
2 parents abe7a8a + 77ac802 commit fb2484b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4268
-452
lines changed

.github/workflows/e2e-bittensor-tests.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@ concurrency:
55
cancel-in-progress: true
66

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

14-
##
15-
# Run automatically for PRs against default/main branch if Rust files change
1611
pull_request:
17-
branches: [main, development, staging]
1812

1913
## Allow running workflow manually from the Actions tab
2014
workflow_dispatch:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ specs/*.json
4040
.idea
4141

4242
# Runtime upgrade snapshot
43-
bt.snap
43+
bt.snap
44+
45+
# localnet spec
46+
scripts/specs/local.json

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ COPY Cargo.lock Cargo.toml /subtensor/
3838

3939
# Specs
4040
COPY ./snapshot.json /subtensor/snapshot.json
41+
COPY ./raw_spec_testfinney.json /subtensor/raw_spec_testfinney.json
42+
COPY ./raw_spec_finney.json /subtensor/raw_spec_finney.json
4143

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

5254
# Cargo build
5355
WORKDIR /subtensor
54-
RUN cargo build --release --features runtime-benchmarks --locked
56+
RUN cargo build --profile production --features runtime-benchmarks --locked
5557
EXPOSE 30333 9933 9944
5658

5759

5860
FROM $BASE_IMAGE AS subtensor
5961

6062
COPY --from=builder /subtensor/snapshot.json /
61-
COPY --from=builder /subtensor/target/release/node-subtensor /usr/local/bin
63+
COPY --from=builder /subtensor/raw_spec_testfinney.json /
64+
COPY --from=builder /subtensor/raw_spec_finney.json /
65+
COPY --from=builder /subtensor/target/production/node-subtensor /usr/local/bin

docs/running-subtensor-locally.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ rm -rf /tmp/blockchain
162162
Install subtensor by compiling with `cargo`:
163163

164164
```bash
165-
cargo build --release --features=runtime-benchmarks
165+
cargo build --profile production --features=runtime-benchmarks
166166
```
167167

168168
## Run the subtensor node
@@ -174,31 +174,31 @@ You can now run the public subtensor node either as a lite node or as an archive
174174
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):
175175

176176
```bash title="With --sync=warp setting, for lite node"
177-
./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
177+
./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
178178
```
179179

180180
### Archive node on mainchain
181181

182182
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):
183183

184184
```bash title="With --sync=full and --pruning archive setting, for archive node"
185-
./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
185+
./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
186186
```
187187

188188
### Lite node on testchain
189189

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

192192
```bash title="With bootnodes set to testnet and --sync=warp setting, for lite node."
193-
./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
193+
./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
194194
```
195195

196196
### Archive node on testchain
197197

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

200200
```bash title="With bootnodes set to testnet and --sync=full and --pruning archive setting, for archive node"
201-
./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
201+
./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
202202
```
203203

204204
## Running on cloud

docs/rust-setup.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
title: Installation
33
---
4-
5-
This guide is for reference only, please check the latest information on getting starting with Substrate
4+
This guide is for reference only, please check the latest information on getting starting with Substrate
65
[here](https://docs.substrate.io/main-docs/install/).
76

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

209208
```bash
210-
WASM_BUILD_TOOLCHAIN=nightly-<yyyy-MM-dd> cargo build --release
209+
WASM_BUILD_TOOLCHAIN=nightly-<yyyy-MM-dd> cargo build --profile production
211210
```
212211

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

justfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ clippy:
3030
-D clippy::unimplemented
3131

3232
clippy-fix:
33-
@echo "Running cargo clippy with automatic fixes on potentially dirty code..."
34-
cargo +{{RUSTV}} clippy --workspace --all-targets --fix --allow-dirty -- \
35-
-A clippy::todo \
36-
-A clippy::unimplemented \
37-
-A clippy::indexing_slicing
33+
@echo "Running cargo clippy with automatic fixes on potentially dirty code..."
34+
cargo +{{RUSTV}} clippy --fix --allow-dirty --allow-staged --workspace --all-targets -- \
35+
-A clippy::todo \
36+
-A clippy::unimplemented \
37+
-A clippy::indexing_slicing
38+
3839
fix:
3940
@echo "Running cargo fix..."
4041
cargo +{{RUSTV}} fix --workspace
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
cargo build --release --features runtime-benchmarks
2-
./target/release/node-subtensor benchmark pallet \
3-
--chain=local \
4-
--execution=wasm \
5-
--wasm-execution=compiled \
6-
--pallet=pallet_admin_utils \
7-
--extrinsic="*" \
8-
--steps 50 \
9-
--repeat 20 \
10-
--output=pallets/admin-utils/src/weights.rs \
11-
--template=./.maintain/frame-weight-template.hbs
1+
cargo build --profile production --features runtime-benchmarks
2+
./target/production/node-subtensor benchmark pallet \
3+
--chain=local \
4+
--pallet=pallet_admin_utils \
5+
--extrinsic="*" \
6+
--steps 50 \
7+
--repeat 20 \
8+
--output=pallets/admin-utils/src/weights.rs \
9+
--template=./.maintain/frame-weight-template.hbs

pallets/admin-utils/tests/mock.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ parameter_types! {
110110
pub const InitialSubnetLimit: u16 = 10; // Max 10 subnets.
111111
pub const InitialNetworkRateLimit: u64 = 0;
112112
pub const InitialTargetStakesPerInterval: u16 = 1;
113-
pub const InitialHotkeySwapCost: u64 = 1_000_000_000;
113+
pub const InitialKeySwapCost: u64 = 1_000_000_000;
114114
pub const InitialAlphaHigh: u16 = 58982; // Represents 0.9 as per the production default
115115
pub const InitialAlphaLow: u16 = 45875; // Represents 0.7 as per the production default
116116
pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn
117+
pub const InitialBaseDifficulty: u64 = 10_000; // Base difficulty
117118
}
118119

119120
impl pallet_subtensor::Config for Test {
@@ -165,10 +166,11 @@ impl pallet_subtensor::Config for Test {
165166
type InitialSubnetLimit = InitialSubnetLimit;
166167
type InitialNetworkRateLimit = InitialNetworkRateLimit;
167168
type InitialTargetStakesPerInterval = InitialTargetStakesPerInterval;
168-
type HotkeySwapCost = InitialHotkeySwapCost;
169+
type KeySwapCost = InitialKeySwapCost;
169170
type AlphaHigh = InitialAlphaHigh;
170171
type AlphaLow = InitialAlphaLow;
171172
type LiquidAlphaOn = InitialLiquidAlphaOn;
173+
type InitialBaseDifficulty = InitialBaseDifficulty;
172174
}
173175

174176
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]

pallets/collective/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl<AccountId, I> GetBacking for RawOrigin<AccountId, I> {
151151
}
152152

153153
/// Info for keeping track of a motion being voted on.
154-
#[freeze_struct("5959418cdb31993b")]
154+
#[freeze_struct("a8e7b0b34ad52b17")]
155155
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
156156
pub struct Votes<AccountId, BlockNumber> {
157157
/// The proposal's unique index.
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
cargo build --release --features runtime-benchmarks
2-
./target/release/node-subtensor benchmark pallet \
3-
--chain=local \
4-
--execution=wasm \
5-
--wasm-execution=compiled \
6-
--pallet=pallet_commitments \
7-
--extrinsic="*" \
8-
--output=pallets/commitments/src/weights.rs \
9-
--template=./.maintain/frame-weight-template.hbs
1+
cargo build --profile production --features runtime-benchmarks
2+
./target/production/node-subtensor benchmark pallet \
3+
--chain=local \
4+
--pallet=pallet_commitments \
5+
--extrinsic="*" \
6+
--output=pallets/commitments/src/weights.rs \
7+
--template=./.maintain/frame-weight-template.hbs

0 commit comments

Comments
 (0)