Skip to content

Commit

Permalink
fix: readme, chane specs, dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
MohsenNz committed Jan 8, 2025
1 parent 23f22e2 commit 4d08f10
Show file tree
Hide file tree
Showing 16 changed files with 183 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cargo-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
jobs:
cargo-audit:
name: cargo audit
runs-on: SubtensorCI
runs-on: JungochainCI
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-cargo-audit') }}
steps:
- name: Check-out repositoroy under $GITHUB_WORKSPACE
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
jobs:
check-spec-version:
name: Check spec_version bump
runs-on: SubtensorCI
runs-on: JungochainCI
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }}
steps:
- name: Dependencies
Expand All @@ -31,7 +31,7 @@ jobs:
spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://dev.chain.opentensor.ai:443 | tr -d '\n')
echo "network spec_version: $spec_version"
: ${spec_version:?bad spec version}
local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
local_spec_version=$(cargo run -p jungochain-runtime --bin spec_version | tr -d '\n')
echo "local spec_version: $local_spec_version"
echo "network spec_version: $spec_version"
if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version ≯ $spec_version ❌"; exit 1; fi
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-finney.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
jobs:
check-spec-version:
name: Check spec_version bump
runs-on: SubtensorCI
runs-on: JungochainCI
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }}
steps:
- name: Dependencies
Expand All @@ -31,7 +31,7 @@ jobs:
spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://entrypoint-finney.opentensor.ai:443 | tr -d '\n')
echo "network spec_version: $spec_version"
: ${spec_version:?bad spec version}
local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
local_spec_version=$(cargo run -p jungochain-runtime --bin spec_version | tr -d '\n')
echo "local spec_version: $local_spec_version"
echo "network spec_version: $spec_version"
if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version ≯ $spec_version ❌"; exit 1; fi
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/check-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# runs cargo fmt
cargo-fmt:
name: cargo fmt
runs-on: SubtensorCI
runs-on: JungochainCI
strategy:
matrix:
rust-branch:
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:

cargo-clippy-default-features:
name: cargo clippy
runs-on: SubtensorCI
runs-on: JungochainCI
strategy:
matrix:
rust-branch:
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:

cargo-check-lints:
name: check custom lints
runs-on: SubtensorCI
runs-on: JungochainCI
strategy:
matrix:
rust-branch:
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
cargo-clippy-all-features:
name: cargo clippy --all-features
runs-on: SubtensorCI
runs-on: JungochainCI
strategy:
matrix:
rust-target:
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
# runs cargo test --workspace
cargo-test:
name: cargo test
runs-on: SubtensorCI
runs-on: JungochainCI
strategy:
matrix:
rust-target:
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
# ensures cargo fix has no trivial changes that can be applied
cargo-fix:
name: cargo fix
runs-on: SubtensorCI
runs-on: JungochainCI
strategy:
matrix:
rust-branch:
Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:
check-feature-propagation:
name: zepter run check
runs-on: SubtensorCI
runs-on: JungochainCI

steps:
- name: Install Zepter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
jobs:
check-spec-version:
name: Check spec_version bump
runs-on: SubtensorCI
runs-on: JungochainCI
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }}
steps:
- name: Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:

jobs:
publish:
runs-on: SubtensorCI
runs-on: JungochainCI

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-bittensor-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:

jobs:
run:
runs-on: SubtensorCI
runs-on: JungochainCI
strategy:
matrix:
rust-branch:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,44 @@ env:
jobs:
check-devnet:
name: check devnet
runs-on: SubtensorCI
runs-on: JungochainCI
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Run Try Runtime Checks
uses: "paritytech/[email protected]"
with:
runtime-package: "node-subtensor-runtime"
runtime-package: "jungochain-runtime"
node-uri: "wss://dev.chain.opentensor.ai:443"
checks: "all"
extra-args: "--disable-spec-version-check --no-weight-warnings"

check-testnet:
name: check testnet
runs-on: SubtensorCI
runs-on: JungochainCI
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Run Try Runtime Checks
uses: "paritytech/[email protected]"
with:
runtime-package: "node-subtensor-runtime"
runtime-package: "jungochain-runtime"
node-uri: "wss://test.chain.opentensor.ai:443"
checks: "all"
extra-args: "--disable-spec-version-check --no-weight-warnings"

check-finney:
name: check finney
runs-on: SubtensorCI
runs-on: JungochainCI
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Run Try Runtime Checks
uses: "paritytech/[email protected]"
with:
runtime-package: "node-subtensor-runtime"
runtime-package: "jungochain-runtime"
node-uri: "wss://archive.chain.opentensor.ai:443"
checks: "all"
extra-args: "--disable-spec-version-check --no-weight-warnings"
2 changes: 1 addition & 1 deletion .github/workflows/update-chainspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:

jobs:
update-chainspecs:
runs-on: SubtensorCI
runs-on: JungochainCI
permissions:
contents: write
if: >
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ scripts/specs/local.json

# TODO rename temp to sth else
temp/

archive
20 changes: 9 additions & 11 deletions Dockerfile → Dockerfile.devnet
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
ARG BASE_IMAGE=ubuntu:20.04
ARG BASE_IMAGE=ubuntu:24.04

FROM $BASE_IMAGE AS builder
SHELL ["/bin/bash", "-c"]

# Set noninteractive mode for apt-get
ARG DEBIAN_FRONTEND=noninteractive

LABEL ai.opentensor.image.authors="[email protected]" \
ai.opentensor.image.vendor="Opentensor Foundation" \
ai.opentensor.image.title="opentensor/subtensor" \
ai.opentensor.image.description="Opentensor Subtensor Blockchain" \
ai.opentensor.image.documentation="https://docs.bittensor.com"
# LABEL maintainer="[email protected]" # TODO

# Set up Rust environment
ENV RUST_BACKTRACE=1
RUN apt-get update && \
apt-get install -y curl build-essential protobuf-compiler clang git && \
apt-get install -y curl build-essential protobuf-compiler clang git libssl-dev pkg-config && \
rm -rf /var/lib/apt/lists/*

RUN set -o pipefail && curl https://sh.rustup.rs -sSf | sh -s -- -y
Expand All @@ -28,17 +24,19 @@ COPY . /build
WORKDIR /build

# Build the project
RUN cargo build -p node-subtensor --profile production --features="metadata-hash" --locked
RUN cargo build -p jungochain-node --profile production --features metadata-hash --locked

# Verify the binary was produced
RUN test -e /build/target/production/node-subtensor
RUN test -e /build/target/production/jungochain-node

EXPOSE 30333 9933 9944

FROM $BASE_IMAGE AS subtensor
FROM $BASE_IMAGE AS jungochain

# Copy all chainspec files
COPY --from=builder /build/*.json /

# Copy final binary
COPY --from=builder /build/target/production/node-subtensor /usr/local/bin
COPY --from=builder /build/target/production/jungochain-node /usr/local/bin

ENTRYPOINT ["/usr/local/bin/jungochain-node"]
50 changes: 30 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ This repository contains Jungoai's jungochain. Jungochain contains the trusted l

## System Requirements

* The binaries in ./bin/release are x86_64 binaries to be used with the Linux kernel.
* Jungochain needs ~286 MiB to run.
* Architectures other than x86_64 are currently not supported.
* OSs other than Linux and MacOS are currently not supported.
Expand Down Expand Up @@ -82,32 +81,42 @@ nix develop
Use the following command to build the node without launching it:

```sh
cargo build --release
cargo build -p jungochain-node --release
```

Or to enable local faucet:
```sh
cargo build -p jungochain-node --release --features pow-faucet
```

For development it's good to enable fast-blocks to reduce the time of block creation:
```sh
cargo build -p jungochain-node --release --features pow-faucet,fast-blocks
```

### Single-Node Development Chain

This command will start the single-node development chain with non-persistent state:

```bash
./target/release/jungochain --dev
./target/release/jungochain-node --dev
```

Purge the development chain's state:

```bash
./target/release/jungochain purge-chain --dev
./target/release/jungochain-node purge-chain --dev
```

Start the development chain with detailed logging:

```bash
RUST_BACKTRACE=1 ./target/release/jungochain-ldebug --dev
RUST_BACKTRACE=1 ./target/release/jungochain-node -ldebug --dev
```

Running debug with logs.
```bash
SKIP_WASM_BUILD=1 RUST_LOG=runtime=debug -- --nocapture
RUST_LOG=runtime=debug ./target/release/jungochain-node -- --nocapture
```

Running individual tests
Expand Down Expand Up @@ -146,20 +155,21 @@ SKIP_WASM_BUILD=1 \
</details>


Running code coverage
```bash
bash scripts/code-coverage.sh
```

> Note: They above requires `cargo-tarpaulin` is installed to the host, eg. `cargo install cargo-tarpaulin`
> Development chain means that the state of our chain will be in a tmp folder while the nodes are
> running. Also, **alice** account will be authority and sudo account as declared in the
> [genesis state](https://github.com/substrate-developer-hub/substrate-node-template/blob/main/node/src/chain_spec.rs#L49).
> At the same time the following accounts will be pre-funded:
> - Alice
> - Bob
> - Alice//stash
> - Bob//stash
<!-- TODO -->
<!-- Running code coverage -->
<!-- ```bash -->
<!-- bash scripts/code-coverage.sh -->
<!-- ``` -->

<!-- > Note: They above requires `cargo-tarpaulin` is installed to the host, eg. `cargo install cargo-tarpaulin` -->
<!-- > Development chain means that the state of our chain will be in a tmp folder while the nodes are -->
<!-- > running. Also, **alice** account will be authority and sudo account as declared in the -->
<!-- > [genesis state](https://github.com/substrate-developer-hub/substrate-node-template/blob/main/node/src/chain_spec.rs#L49). -->
<!-- > At the same time the following accounts will be pre-funded: -->
<!-- > - Alice -->
<!-- > - Bob -->
<!-- > - Alice//stash -->
<!-- > - Bob//stash -->

If we want to maintain the chain state between runs, a base path must be added
so the db can be stored in the provided folder instead of a temporal one. We could use this folder
Expand Down
Loading

0 comments on commit 4d08f10

Please sign in to comment.