Skip to content

Commit

Permalink
Merge pull request #493 from opentensor/fix/chainspecs
Browse files Browse the repository at this point in the history
fix: chainspec irregularities
  • Loading branch information
orriin authored Jul 2, 2024
2 parents f62d824 + 0ce8638 commit ce6793d
Show file tree
Hide file tree
Showing 15 changed files with 104,235 additions and 255,853 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/update-chainspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Update Chainspecs

concurrency:
group: update-chainspec-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches: [main, testnet, staging, staging-ready]

workflow_dispatch:
inputs:
verbose:
description: "Output more information when triggered manually"
required: false
default: ""

env:
CARGO_TERM_COLOR: always
VERBOSE: ${{ github.events.input.verbose }}

jobs:
update-chainspecs:
runs-on: SubtensorCI
permissions:
contents: write

strategy:
matrix:
rust-branch:
- nightly-2024-03-05
rust-target:
- x86_64-unknown-linux-gnu
os:
- ubuntu-latest
include:
- os: ubuntu-latest
env:
RELEASE_NAME: development
RUSTV: ${{ matrix.rust-branch }}
RUST_BACKTRACE: full
RUST_BIN_DIR: target/${{ matrix.rust-target }}
TARGET: ${{ matrix.rust-target }}
steps:
- name: Check-out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update &&
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
- name: Install Rust ${{ matrix.rust-branch }}
uses: actions-rs/[email protected]
with:
toolchain: ${{ matrix.rust-branch }}
components: rustfmt, clippy
profile: minimal

- name: Utilize Shared Rust Cache
uses: Swatinem/[email protected]
with:
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}

- name: Build chainspecs
run: ./scripts/build_all_chainspecs.sh

- uses: stefanzweifel/git-auto-commit-action@v5
name: Commit any updated chainspecs
with:
commit_message: Update chainspecs
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ COPY Cargo.lock Cargo.toml /subtensor/

# Specs
COPY ./snapshot.json /subtensor/snapshot.json
COPY ./raw_spec.json /subtensor/raw_spec.json
COPY ./raw_testspec.json /subtensor/raw_testspec.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 @@ -59,6 +59,6 @@ EXPOSE 30333 9933 9944
FROM $BASE_IMAGE AS subtensor

COPY --from=builder /subtensor/snapshot.json /
COPY --from=builder /subtensor/raw_spec.json /
COPY --from=builder /subtensor/raw_testspec.json /
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 docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: "3.8"

volumes:
mainnet-lite-volume:
Expand Down Expand Up @@ -38,7 +38,7 @@ services:
- |
node-subtensor \
--base-path /tmp/blockchain \
--chain raw_spec.json \
--chain raw_spec_finney.json \
--rpc-external --rpc-cors all \
--no-mdns \
--in-peers 500 --out-peers 500 \
Expand All @@ -56,7 +56,7 @@ services:
- |
node-subtensor \
--base-path /tmp/blockchain \
--chain raw_spec.json \
--chain raw_spec_finney.json \
--rpc-external --rpc-cors all \
--no-mdns \
--in-peers 500 --out-peers 500 \
Expand All @@ -74,7 +74,7 @@ services:
- |
node-subtensor \
--base-path /tmp/blockchain \
--chain raw_testspec.json \
--chain raw_spec_testfinney.json \
--rpc-external --rpc-cors all \
--no-mdns \
--in-peers 500 --out-peers 500 \
Expand All @@ -94,7 +94,7 @@ services:
- |
node-subtensor \
--base-path /tmp/blockchain \
--chain raw_testspec.json \
--chain raw_spec_testfinney.json \
--rpc-external --rpc-cors all \
--no-mdns \
--in-peers 500 --out-peers 500 \
Expand Down
103,931 changes: 0 additions & 103,931 deletions finney_plain_spec.json

This file was deleted.

12 changes: 9 additions & 3 deletions node/src/chain_spec/finney.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn finney_mainnet_config() -> Result<ChainSpec, String> {
let mut properties = sc_service::Properties::new();
properties.insert("tokenSymbol".into(), "TAO".into());
properties.insert("tokenDecimals".into(), 9.into());
properties.insert("ss58Format".into(), 13116.into());
properties.insert("ss58Format".into(), 42.into());

Ok(ChainSpec::builder(
wasm_binary,
Expand All @@ -72,8 +72,14 @@ pub fn finney_mainnet_config() -> Result<ChainSpec, String> {
},
)
.with_name("Bittensor")
.with_protocol_id("bittensor")
.with_id("bittensor")
.with_chain_type(ChainType::Live)
.with_boot_nodes(vec![
"/dns/bootnode.finney.chain.opentensor.ai/tcp/30333/ws/p2p/12D3KooWRwbMb85RWnT8DSXSYMWQtuDwh4LJzndoRrTDotTR5gDC"
.parse()
.unwrap(),
])
.with_genesis_config_patch(finney_genesis(
// Initial PoA authorities (Validators)
// aura | grandpa
Expand Down Expand Up @@ -193,9 +199,9 @@ fn finney_genesis(
.collect::<Vec<_>>(),
},
"sudo": { "key": Some(<AccountId32 as Ss58Codec>::from_ss58check("5FCM3DBXWiGcwYYQtT8z4ZD93TqYpYxjaAfgv6aMStV1FTCT").unwrap()) },
"subtensor_module": {
"subtensorModule": {
"stakes": stakes,
"balances_issuance": balances_issuance,
"balancesIssuance": balances_issuance,
}
})
}
3 changes: 2 additions & 1 deletion node/src/chain_spec/localnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn localnet_config() -> Result<ChainSpec, String> {
let mut properties = sc_service::Properties::new();
properties.insert("tokenSymbol".into(), "TAO".into());
properties.insert("tokenDecimals".into(), 9.into());
properties.insert("ss58Format".into(), 13116.into());
properties.insert("ss58Format".into(), 42.into());

Ok(ChainSpec::builder(
wasm_binary,
Expand All @@ -26,6 +26,7 @@ pub fn localnet_config() -> Result<ChainSpec, String> {
},
)
.with_name("Bittensor")
.with_protocol_id("bittensor")
.with_id("bittensor")
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(localnet_genesis(
Expand Down
8 changes: 7 additions & 1 deletion node/src/chain_spec/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn finney_testnet_config() -> Result<ChainSpec, String> {
let mut properties = sc_service::Properties::new();
properties.insert("tokenSymbol".into(), "TAO".into());
properties.insert("tokenDecimals".into(), 9.into());
properties.insert("ss58Format".into(), 13116.into());
properties.insert("ss58Format".into(), 42.into());

Ok(ChainSpec::builder(
wasm_binary,
Expand All @@ -72,6 +72,12 @@ pub fn finney_testnet_config() -> Result<ChainSpec, String> {
},
)
.with_name("Bittensor")
.with_boot_nodes(vec![
"/dns/bootnode.test.chain.opentensor.ai/tcp/30333/p2p/12D3KooWPM4mLcKJGtyVtkggqdG84zWrd7Rij6PGQDoijh1X86Vr"
.parse()
.unwrap(),
])
.with_protocol_id("bittensor")
.with_id("bittensor")
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(testnet_genesis(
Expand Down
208,068 changes: 104,030 additions & 104,038 deletions plain_spec_finney.json

Large diffs are not rendered by default.

113 changes: 55 additions & 58 deletions plain_spec_testfinney.json

Large diffs are not rendered by default.

Loading

0 comments on commit ce6793d

Please sign in to comment.