Skip to content

Commit fae9db0

Browse files
author
Samuel Dare
committed
Merge branch 'devnet-ready' into fix-add-adjust-senate-call-vune-devnet-companion
2 parents f339e8e + fce53c0 commit fae9db0

Some content is hidden

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

70 files changed

+104879
-256092
lines changed

.cargo-husky/hooks/prepare-commit-msg

-18
This file was deleted.
+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Update Chainspecs
2+
3+
concurrency:
4+
group: update-chainspec-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches: [main, testnet, staging, staging-ready]
10+
11+
workflow_dispatch:
12+
inputs:
13+
verbose:
14+
description: "Output more information when triggered manually"
15+
required: false
16+
default: ""
17+
18+
env:
19+
CARGO_TERM_COLOR: always
20+
VERBOSE: ${{ github.events.input.verbose }}
21+
22+
jobs:
23+
update-chainspecs:
24+
runs-on: SubtensorCI
25+
permissions:
26+
contents: write
27+
28+
strategy:
29+
matrix:
30+
rust-branch:
31+
- nightly-2024-03-05
32+
rust-target:
33+
- x86_64-unknown-linux-gnu
34+
os:
35+
- ubuntu-latest
36+
include:
37+
- os: ubuntu-latest
38+
env:
39+
RELEASE_NAME: development
40+
RUSTV: ${{ matrix.rust-branch }}
41+
RUST_BACKTRACE: full
42+
RUST_BIN_DIR: target/${{ matrix.rust-target }}
43+
TARGET: ${{ matrix.rust-target }}
44+
steps:
45+
- name: Check-out repository under $GITHUB_WORKSPACE
46+
uses: actions/checkout@v2
47+
48+
- name: Install dependencies
49+
run: |
50+
sudo apt-get update &&
51+
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
52+
53+
- name: Install Rust ${{ matrix.rust-branch }}
54+
uses: actions-rs/toolchain@v1.0.6
55+
with:
56+
toolchain: ${{ matrix.rust-branch }}
57+
components: rustfmt, clippy
58+
profile: minimal
59+
60+
- name: Utilize Shared Rust Cache
61+
uses: Swatinem/rust-cache@v2.2.1
62+
with:
63+
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}
64+
65+
- name: Build chainspecs
66+
run: ./scripts/build_all_chainspecs.sh
67+
68+
- uses: stefanzweifel/git-auto-commit-action@v5
69+
name: Commit any updated chainspecs
70+
with:
71+
commit_message: Update chainspecs

CITATION.cft

Whitespace-only changes.

Cargo.lock

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ members = [
44
"pallets/commitments",
55
"pallets/subtensor",
66
"runtime",
7+
"support/macros",
78
]
89
resolver = "2"
910

1011
[workspace.lints.clippy]
12+
indexing-slicing = "deny"
13+
arithmetic-side-effects = "deny"
1114
type_complexity = "allow"
15+
unwrap-used = "deny"
1216

1317
[workspace.dependencies]
1418
cargo-husky = { version = "1", default-features = false }
@@ -33,6 +37,8 @@ serde_with = { version = "=2.0.0", default-features = false }
3337
smallvec = "1.13.2"
3438
litep2p = { git = "https://github.com/paritytech/litep2p", branch = "master" }
3539

40+
subtensor-macros = { path = "support/macros" }
41+
3642
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0", default-features = false }
3743
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0" }
3844
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.10.0", default-features = false }

Dockerfile

+2-5
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ COPY Cargo.lock Cargo.toml /subtensor/
3838

3939
# Specs
4040
COPY ./snapshot.json /subtensor/snapshot.json
41-
COPY ./raw_spec.json /subtensor/raw_spec.json
42-
COPY ./raw_testspec.json /subtensor/raw_testspec.json
4341

4442
# Copy our sources
4543
COPY ./node /subtensor/node
4644
COPY ./pallets /subtensor/pallets
4745
COPY ./runtime /subtensor/runtime
46+
COPY ./support /subtensor/support
4847

49-
# Update to nightly toolchain
48+
# Copy our toolchain
5049
COPY rust-toolchain.toml /subtensor/
5150
RUN /subtensor/scripts/init.sh
5251

@@ -59,6 +58,4 @@ EXPOSE 30333 9933 9944
5958
FROM $BASE_IMAGE AS subtensor
6059

6160
COPY --from=builder /subtensor/snapshot.json /
62-
COPY --from=builder /subtensor/raw_spec.json /
63-
COPY --from=builder /subtensor/raw_testspec.json /
6461
COPY --from=builder /subtensor/target/release/node-subtensor /usr/local/bin

finney_plain_spec.json

-103,931
This file was deleted.

node/src/chain_spec/finney.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::*;
55

66
pub fn finney_mainnet_config() -> Result<ChainSpec, String> {
77
let path: PathBuf = std::path::PathBuf::from("./snapshot.json");
8-
let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?;
8+
let wasm_binary = WASM_BINARY.ok_or("Development wasm not available".to_string())?;
99

1010
// We mmap the file into memory first, as this is *a lot* faster than using
1111
// `serde_json::from_reader`. See https://github.com/serde-rs/json/issues/160
@@ -53,14 +53,16 @@ pub fn finney_mainnet_config() -> Result<ChainSpec, String> {
5353
let key_account = sp_runtime::AccountId32::from(key);
5454

5555
processed_balances.push((key_account, *amount));
56-
balances_issuance += *amount;
56+
balances_issuance = balances_issuance
57+
.checked_add(*amount)
58+
.ok_or("Balances issuance overflowed".to_string())?;
5759
}
5860

5961
// Give front-ends necessary data to present to users
6062
let mut properties = sc_service::Properties::new();
6163
properties.insert("tokenSymbol".into(), "TAO".into());
6264
properties.insert("tokenDecimals".into(), 9.into());
63-
properties.insert("ss58Format".into(), 13116.into());
65+
properties.insert("ss58Format".into(), 42.into());
6466

6567
Ok(ChainSpec::builder(
6668
wasm_binary,
@@ -70,8 +72,14 @@ pub fn finney_mainnet_config() -> Result<ChainSpec, String> {
7072
},
7173
)
7274
.with_name("Bittensor")
75+
.with_protocol_id("bittensor")
7376
.with_id("bittensor")
7477
.with_chain_type(ChainType::Live)
78+
.with_boot_nodes(vec![
79+
"/dns/bootnode.finney.chain.opentensor.ai/tcp/30333/ws/p2p/12D3KooWRwbMb85RWnT8DSXSYMWQtuDwh4LJzndoRrTDotTR5gDC"
80+
.parse()
81+
.unwrap(),
82+
])
7583
.with_genesis_config_patch(finney_genesis(
7684
// Initial PoA authorities (Validators)
7785
// aura | grandpa
@@ -191,9 +199,9 @@ fn finney_genesis(
191199
.collect::<Vec<_>>(),
192200
},
193201
"sudo": { "key": Some(<AccountId32 as Ss58Codec>::from_ss58check("5FCM3DBXWiGcwYYQtT8z4ZD93TqYpYxjaAfgv6aMStV1FTCT").unwrap()) },
194-
"subtensor_module": {
202+
"subtensorModule": {
195203
"stakes": stakes,
196-
"balances_issuance": balances_issuance,
204+
"balancesIssuance": balances_issuance,
197205
}
198206
})
199207
}

node/src/chain_spec/localnet.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn localnet_config() -> Result<ChainSpec, String> {
1010
let mut properties = sc_service::Properties::new();
1111
properties.insert("tokenSymbol".into(), "TAO".into());
1212
properties.insert("tokenDecimals".into(), 9.into());
13-
properties.insert("ss58Format".into(), 13116.into());
13+
properties.insert("ss58Format".into(), 42.into());
1414

1515
Ok(ChainSpec::builder(
1616
wasm_binary,
@@ -26,6 +26,7 @@ pub fn localnet_config() -> Result<ChainSpec, String> {
2626
},
2727
)
2828
.with_name("Bittensor")
29+
.with_protocol_id("bittensor")
2930
.with_id("bittensor")
3031
.with_chain_type(ChainType::Development)
3132
.with_genesis_config_patch(localnet_genesis(

node/src/chain_spec/testnet.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn finney_testnet_config() -> Result<ChainSpec, String> {
2020
};
2121

2222
let old_state: ColdkeyHotkeys =
23-
json::from_slice(&bytes).map_err(|e| format!("Error parsing genesis file: {}", e))?;
23+
json::from_slice(&bytes).map_err(|e| format!("Error parsing genesis file: {e}"))?;
2424

2525
let mut processed_stakes: Vec<(
2626
sp_runtime::AccountId32,
@@ -53,14 +53,16 @@ pub fn finney_testnet_config() -> Result<ChainSpec, String> {
5353
let key_account = sp_runtime::AccountId32::from(key);
5454

5555
processed_balances.push((key_account, *amount));
56-
balances_issuance += *amount;
56+
balances_issuance = balances_issuance
57+
.checked_add(*amount)
58+
.ok_or("Balances issuance overflowed".to_string())?;
5759
}
5860

5961
// Give front-ends necessary data to present to users
6062
let mut properties = sc_service::Properties::new();
6163
properties.insert("tokenSymbol".into(), "TAO".into());
6264
properties.insert("tokenDecimals".into(), 9.into());
63-
properties.insert("ss58Format".into(), 13116.into());
65+
properties.insert("ss58Format".into(), 42.into());
6466

6567
Ok(ChainSpec::builder(
6668
wasm_binary,
@@ -70,6 +72,12 @@ pub fn finney_testnet_config() -> Result<ChainSpec, String> {
7072
},
7173
)
7274
.with_name("Bittensor")
75+
.with_boot_nodes(vec![
76+
"/dns/bootnode.test.chain.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr"
77+
.parse()
78+
.unwrap(),
79+
])
80+
.with_protocol_id("bittensor")
7381
.with_id("bittensor")
7482
.with_chain_type(ChainType::Development)
7583
.with_genesis_config_patch(testnet_genesis(

pallets/admin-utils/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ workspace = true
1616
targets = ["x86_64-unknown-linux-gnu"]
1717

1818
[dependencies]
19+
subtensor-macros.workspace = true
1920
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
2021
"derive",
2122
] }

pallets/admin-utils/src/benchmarking.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Benchmarking setup
22
#![cfg(feature = "runtime-benchmarks")]
3+
#![allow(clippy::arithmetic_side_effects)]
34
use super::*;
45

56
#[allow(unused)]

pallets/admin-utils/tests/mock.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::arithmetic_side_effects, clippy::unwrap_used)]
2+
13
use frame_support::{
24
assert_ok, derive_impl, parameter_types,
35
traits::{Everything, Hooks},

pallets/collective/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ workspace = true
1616
targets = ["x86_64-unknown-linux-gnu"]
1717

1818
[dependencies]
19+
subtensor-macros.workspace = true
1920
codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [
2021
"derive",
2122
] }

pallets/collective/src/benchmarking.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// limitations under the License.
1717

1818
//! Staking pallet benchmarking.
19+
#![allow(clippy::arithmetic_side_effects, clippy::indexing_slicing)]
1920

2021
use super::*;
2122
use crate::Pallet as Collective;
@@ -70,7 +71,7 @@ benchmarks_instance_pallet! {
7071
// Proposals should be different so that different proposal hashes are generated
7172
let proposal: T::Proposal = SystemCall::<T>::remark { remark: id_to_remark_data(i, length) }.into();
7273
Collective::<T, I>::propose(
73-
SystemOrigin::Signed(old_members.last().unwrap().clone()).into(),
74+
SystemOrigin::Signed(old_members.last().expect("m is greater than 0; old_members must have at least 1 element; qed").clone()).into(),
7475
Box::new(proposal.clone()),
7576
MAX_BYTES,
7677
TryInto::<BlockNumberFor<T>>::try_into(3u64).ok().expect("convert u64 to block number.")

0 commit comments

Comments
 (0)