Skip to content

Commit 97b11de

Browse files
authored
Merge pull request #769 from opentensor/devnet
Testnet Deployment 280824
2 parents 1f3851f + aaf9149 commit 97b11de

File tree

6 files changed

+69
-87
lines changed

6 files changed

+69
-87
lines changed

Diff for: .dockerignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.devcontainer
22
.github
33
.vscode
4-
!scripts/init.sh
5-
target
4+
target/
5+
.dockerignore
6+
Dockerfile

Diff for: .github/workflows/docker.yml

+13-20
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,42 @@
11
name: Publish Docker Image
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
tags:
8-
- '*'
9-
pull_request:
10-
branches:
11-
- main
12-
workflow_dispatch:
4+
release:
5+
types: [published]
136

147
permissions:
15-
contents: read
16-
packages: write
17-
actions: read
18-
security-events: write
8+
contents: read
9+
packages: write
10+
actions: read
11+
security-events: write
1912

2013
jobs:
2114
publish:
2215
runs-on: SubtensorCI
23-
16+
2417
steps:
2518
- name: Checkout code
2619
uses: actions/checkout@v4
27-
20+
2821
- name: Set up QEMU
2922
uses: docker/setup-qemu-action@v2
30-
23+
3124
- name: Set up Docker Buildx
3225
uses: docker/setup-buildx-action@v2
33-
26+
3427
- name: Login to GHCR
3528
uses: docker/login-action@v2
3629
with:
3730
registry: ghcr.io
3831
username: ${{ github.actor }}
3932
password: ${{ secrets.GITHUB_TOKEN }}
40-
33+
4134
- name: Extract metadata (tags, labels) for Docker
4235
id: meta
4336
uses: docker/metadata-action@v4
4437
with:
4538
images: ghcr.io/${{ github.repository }}
46-
39+
4740
- name: Build and push Docker image
4841
uses: docker/build-push-action@v4
4942
with:
@@ -52,4 +45,4 @@ jobs:
5245
tags: |
5346
${{ steps.meta.outputs.tags }}
5447
ghcr.io/${{ github.repository }}:latest
55-
labels: ${{ steps.meta.outputs.labels }}
48+
labels: ${{ steps.meta.outputs.labels }}

Diff for: Cargo.toml

+9-2
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,12 @@ codegen-units = 1
167167

168168
[features]
169169
default = []
170-
try-runtime = ["node-subtensor/try-runtime", "node-subtensor-runtime/try-runtime"]
171-
runtime-benchmarks = ["node-subtensor/runtime-benchmarks", "node-subtensor-runtime/runtime-benchmarks"]
170+
try-runtime = [
171+
"node-subtensor/try-runtime",
172+
"node-subtensor-runtime/try-runtime",
173+
]
174+
runtime-benchmarks = [
175+
"node-subtensor/runtime-benchmarks",
176+
"node-subtensor-runtime/runtime-benchmarks",
177+
]
178+
metadata-hash = ["node-subtensor-runtime/metadata-hash"]

Diff for: Dockerfile

+18-39
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,44 @@
1-
21
ARG BASE_IMAGE=ubuntu:20.04
32

4-
FROM $BASE_IMAGE as builder
3+
FROM $BASE_IMAGE AS builder
54
SHELL ["/bin/bash", "-c"]
65

7-
# This is being set so that no interactive components are allowed when updating.
6+
# Set noninteractive mode for apt-get
87
ARG DEBIAN_FRONTEND=noninteractive
98

109
LABEL ai.opentensor.image.authors="operations@opentensor.ai" \
1110
ai.opentensor.image.vendor="Opentensor Foundation" \
1211
ai.opentensor.image.title="opentensor/subtensor" \
1312
ai.opentensor.image.description="Opentensor Subtensor Blockchain" \
14-
ai.opentensor.image.revision="${VCS_REF}" \
15-
ai.opentensor.image.created="${BUILD_DATE}" \
1613
ai.opentensor.image.documentation="https://docs.bittensor.com"
1714

18-
# show backtraces
19-
ENV RUST_BACKTRACE 1
20-
21-
# Necessary libraries for Rust execution
15+
# Set up Rust environment
16+
ENV RUST_BACKTRACE=1
2217
RUN apt-get update && \
2318
apt-get install -y curl build-essential protobuf-compiler clang git && \
2419
rm -rf /var/lib/apt/lists/*
2520

26-
# Install cargo and Rust
2721
RUN set -o pipefail && curl https://sh.rustup.rs -sSf | sh -s -- -y
2822
ENV PATH="/root/.cargo/bin:${PATH}"
23+
RUN rustup update stable
24+
RUN rustup target add wasm32-unknown-unknown --toolchain stable
2925

30-
RUN mkdir -p /subtensor && \
31-
mkdir /subtensor/scripts
32-
33-
# Scripts
34-
COPY ./scripts/init.sh /subtensor/scripts/
35-
36-
# Capture dependencies
37-
COPY Cargo.lock Cargo.toml /subtensor/
26+
# Copy entire repository
27+
COPY . /build
28+
WORKDIR /build
3829

39-
# Specs
40-
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
30+
# Build the project
31+
RUN cargo build -p node-subtensor --profile production --features="runtime-benchmarks metadata-hash" --locked
4332

44-
# Copy our sources
45-
COPY ./node /subtensor/node
46-
COPY ./pallets /subtensor/pallets
47-
COPY ./runtime /subtensor/runtime
48-
COPY ./support /subtensor/support
33+
# Verify the binary was produced
34+
RUN test -e /build/target/production/node-subtensor
4935

50-
# Copy our toolchain
51-
COPY rust-toolchain.toml /subtensor/
52-
RUN /subtensor/scripts/init.sh
53-
54-
# Cargo build
55-
WORKDIR /subtensor
56-
RUN cargo build --profile production --features runtime-benchmarks --locked
5736
EXPOSE 30333 9933 9944
5837

59-
6038
FROM $BASE_IMAGE AS subtensor
6139

62-
COPY --from=builder /subtensor/snapshot.json /
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
40+
# Copy all chainspec files
41+
COPY --from=builder /build/*.json /
42+
43+
# Copy final binary
44+
COPY --from=builder /build/target/production/node-subtensor /usr/local/bin

Diff for: node/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ runtime-benchmarks = [
9292
"frame-system/runtime-benchmarks",
9393
"sc-service/runtime-benchmarks",
9494
"sp-runtime/runtime-benchmarks",
95-
"pallet-commitments/runtime-benchmarks"
95+
"pallet-commitments/runtime-benchmarks",
9696
]
9797
pow-faucet = []
9898

@@ -103,5 +103,7 @@ try-runtime = [
103103
"frame-system/try-runtime",
104104
"pallet-transaction-payment/try-runtime",
105105
"sp-runtime/try-runtime",
106-
"pallet-commitments/try-runtime"
106+
"pallet-commitments/try-runtime",
107107
]
108+
109+
metadata-hash = ["node-subtensor-runtime/metadata-hash"]

Diff for: runtime/src/lib.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
142142
// `spec_version`, and `authoring_version` are the same between Wasm and native.
143143
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
144144
// the compatible custom types.
145-
spec_version: 192,
145+
spec_version: 195,
146146
impl_version: 1,
147147
apis: RUNTIME_API_VERSIONS,
148148
transaction_version: 1,
@@ -1030,27 +1030,27 @@ impl pallet_admin_utils::Config for Runtime {
10301030
construct_runtime!(
10311031
pub struct Runtime
10321032
{
1033-
System: frame_system,
1034-
RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip,
1035-
Timestamp: pallet_timestamp,
1036-
Aura: pallet_aura,
1037-
Grandpa: pallet_grandpa,
1038-
Balances: pallet_balances,
1039-
TransactionPayment: pallet_transaction_payment,
1040-
SubtensorModule: pallet_subtensor,
1041-
Triumvirate: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>},
1042-
TriumvirateMembers: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>},
1043-
SenateMembers: pallet_membership::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>},
1044-
Utility: pallet_utility,
1045-
Sudo: pallet_sudo,
1046-
Multisig: pallet_multisig,
1047-
Preimage: pallet_preimage,
1048-
Proxy: pallet_proxy,
1049-
Registry: pallet_registry,
1050-
Commitments: pallet_commitments,
1051-
AdminUtils: pallet_admin_utils,
1052-
SafeMode: pallet_safe_mode,
1053-
Scheduler: pallet_scheduler,
1033+
System: frame_system = 0,
1034+
RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip = 1,
1035+
Timestamp: pallet_timestamp = 2,
1036+
Aura: pallet_aura = 3,
1037+
Grandpa: pallet_grandpa = 4,
1038+
Balances: pallet_balances = 5,
1039+
TransactionPayment: pallet_transaction_payment = 6,
1040+
SubtensorModule: pallet_subtensor = 7,
1041+
Triumvirate: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 8,
1042+
TriumvirateMembers: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 9,
1043+
SenateMembers: pallet_membership::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>} = 10,
1044+
Utility: pallet_utility = 11,
1045+
Sudo: pallet_sudo = 12,
1046+
Multisig: pallet_multisig = 13,
1047+
Preimage: pallet_preimage = 14,
1048+
Scheduler: pallet_scheduler = 15,
1049+
Proxy: pallet_proxy = 16,
1050+
Registry: pallet_registry = 17,
1051+
Commitments: pallet_commitments = 18,
1052+
AdminUtils: pallet_admin_utils = 19,
1053+
SafeMode: pallet_safe_mode = 20,
10541054
}
10551055
);
10561056

0 commit comments

Comments
 (0)