Skip to content

Commit

Permalink
Merge branch 'devnet-ready' into junius/remove-stake-check-set-weights
Browse files Browse the repository at this point in the history
  • Loading branch information
open-junius committed Sep 20, 2024
2 parents a6374a6 + 2069a48 commit 59276d3
Show file tree
Hide file tree
Showing 14 changed files with 212 additions and 77 deletions.
1 change: 1 addition & 0 deletions .github/workflows/check-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Devnet Deploy Check
on:
pull_request:
branches: [devnet, devnet-ready]
types: [labeled, unlabeled, synchronize]

env:
CARGO_TERM_COLOR: always
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/check-finney.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Finney Deploy Check
on:
pull_request:
branches: [finney, main]
types: [labeled, unlabeled, synchronize]

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -51,4 +52,4 @@ jobs:
runtime-package: "node-subtensor-runtime"
node-uri: "wss://entrypoint-finney.opentensor.ai:443"
checks: "pre-and-post"
extra-args: "--disable-spec-version-check --no-weight-warnings"
extra-args: "--disable-spec-version-check --no-weight-warnings"
53 changes: 2 additions & 51 deletions .github/workflows/check-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,57 +254,8 @@ jobs:
with:
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}

- name: cargo test --workspace
run: cargo test --workspace

# runs cargo test --workspace --features=runtime-benchmarks
cargo-test-benchmarks:
name: cargo test w/benchmarks
runs-on: SubtensorCI
strategy:
matrix:
rust-branch:
- stable
rust-target:
- x86_64-unknown-linux-gnu
# - x86_64-apple-darwin
os:
- ubuntu-latest
# - macos-latest
include:
- os: ubuntu-latest
# - os: macos-latest
env:
RELEASE_NAME: development
# RUSTFLAGS: -A warnings
RUSTV: ${{ matrix.rust-branch }}
RUST_BACKTRACE: full
RUST_BIN_DIR: target/${{ matrix.rust-target }}
SKIP_WASM_BUILD: 1
TARGET: ${{ matrix.rust-target }}
steps:
- name: Check-out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v4

- 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/toolchain@v1.0.6
with:
toolchain: ${{ matrix.rust-branch }}
components: rustfmt, clippy
profile: minimal

- name: Utilize Rust shared cached
uses: Swatinem/rust-cache@v2.2.1
with:
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}

- name: cargo test --workspace --features=runtime-benchmarks
run: cargo test --workspace --features=runtime-benchmarks
- name: cargo test --workspace --all-features
run: cargo test --workspace --all-features

# ensures cargo fix has no trivial changes that can be applied
cargo-fix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Testnet Deploy Check
on:
pull_request:
branches: [testnet, testnet-ready]
types: [labeled, unlabeled, synchronize]

env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ indexing-slicing = "deny"
arithmetic-side-effects = "deny"
type_complexity = "allow"
unwrap-used = "deny"
manual_inspect = "allow"

[workspace.dependencies]
cargo-husky = { version = "1", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ COPY . /build
WORKDIR /build

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

# Verify the binary was produced
RUN test -e /build/target/production/node-subtensor
Expand Down
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ fn collect_rust_files(dir: &Path) -> Vec<PathBuf> {
let mut rust_files = Vec::new();

for entry in WalkDir::new(dir) {
let entry = entry.unwrap();
let Ok(entry) = entry else {
continue;
};
let path = entry.path();

// Skip any path that contains "target" directory
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ lint:

production:
@echo "Running cargo build with metadata-hash generation..."
cargo +{{RUSTV}} build --profile production --features="runtime-benchmarks metadata-hash"
cargo +{{RUSTV}} build --profile production --features="metadata-hash"
10 changes: 5 additions & 5 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ impl HostFunctions for ExecutorDispatch {
}

impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
// Only enable the benchmarking host functions when we actually want to benchmark.
#[cfg(feature = "runtime-benchmarks")]
// Always enable runtime benchmark host functions, the genesis state
// was built with them so we're stuck with them forever.
//
// They're just a noop, never actually get used if the runtime was not compiled with
// `runtime-benchmarks`.
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
// Otherwise we only use the default Substrate host functions.
#[cfg(not(feature = "runtime-benchmarks"))]
type ExtendHostFunctions = ();

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
node_subtensor_runtime::api::dispatch(method, data)
Expand Down
6 changes: 6 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ pub enum ProxyType {
Registration,
Transfer,
SmallTransfer,
RootWeights,
}
// Transfers below SMALL_TRANSFER_LIMIT are considered small transfers
pub const SMALL_TRANSFER_LIMIT: Balance = 500_000_000; // 0.5 TAO
Expand Down Expand Up @@ -673,6 +674,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::root_register { .. })
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::burned_register { .. })
| RuntimeCall::Triumvirate(..)
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_root_weights { .. })
),
ProxyType::Triumvirate => matches!(
c,
Expand All @@ -695,6 +697,10 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::SubtensorModule(pallet_subtensor::Call::burned_register { .. })
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::register { .. })
),
ProxyType::RootWeights => matches!(
c,
RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_root_weights { .. })
),
}
}
fn is_superset(&self, o: &Self) -> bool {
Expand Down
3 changes: 1 addition & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
cargo build --profile production --features "runtime-benchmarks metadata-hash"

cargo build --profile production --features "metadata-hash"
12 changes: 6 additions & 6 deletions scripts/localnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Check if `--no-purge` passed as a parameter
NO_PURGE=0
for arg in "$@"; do
if [ "$arg" = "--no-purge" ]; then
NO_PURGE=1
break
fi
if [ "$arg" = "--no-purge" ]; then
NO_PURGE=1
break
fi
done

# Determine the directory this script resides in. This allows invoking it from any location.
Expand All @@ -25,13 +25,13 @@ if [ "$fast_blocks" == "False" ]; then
echo "fast_blocks is Off"
: "${CHAIN:=local}"
: "${BUILD_BINARY:=1}"
: "${FEATURES:="pow-faucet runtime-benchmarks"}"
: "${FEATURES:="pow-faucet"}"
else
# Block of code to execute if fast_blocks is not False
echo "fast_blocks is On"
: "${CHAIN:=local}"
: "${BUILD_BINARY:=1}"
: "${FEATURES:="pow-faucet runtime-benchmarks fast-blocks"}"
: "${FEATURES:="pow-faucet fast-blocks"}"
fi

SPEC_PATH="${SCRIPT_DIR}/specs/"
Expand Down
18 changes: 9 additions & 9 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#!/bin/bash
set -ex
cd support/macros
cargo publish
cargo publish --token $1
cd ../..
cd pallets/commitments
cargo publish
cargo publish --token $1
cd ..
cd collective
cargo publish
cargo publish --token $1
cd ..
cd registry
cargo publish
cargo publish --token $1
cd ..
cd subtensor
cargo publish
cargo publish --token $1
cd runtime-api
cargo publish
cargo publish --token $1
cd ../..
cd admin-utils
cargo publish
cargo publish --token $1
cd ../..
cd runtime
cargo publish
cargo publish --token $1
cd ..
cd node
cargo publish
cargo publish --token $1
echo "published successfully."
Loading

0 comments on commit 59276d3

Please sign in to comment.