diff --git a/.github/workflows/apply-benchmark-patch.yml b/.github/workflows/apply-benchmark-patch.yml new file mode 100644 index 0000000000..16b499bea6 --- /dev/null +++ b/.github/workflows/apply-benchmark-patch.yml @@ -0,0 +1,110 @@ +# .github/workflows/apply-benchmark-patch.yml +name: Apply-Benchmark-Patch + +on: + pull_request: + types: [labeled] + +permissions: + contents: write + pull-requests: write + actions: read # required to list & download artifacts across workflows + +jobs: + apply: + if: ${{ github.event.label.name == 'apply-benchmark-patch' }} + runs-on: Benchmarking + + steps: + - name: Check out PR branch + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + fetch-depth: 0 + + - name: Install GitHub CLI + run: | + sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get update + sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install -y --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" gh + echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token + + - name: Download latest bench patch artifact from heavy workflow + uses: dawidd6/action-download-artifact@v3 + with: + workflow: run-benchmarks.yml + pr: ${{ github.event.pull_request.number }} + name: bench-patch + path: . + allow_forks: true + check_artifacts: true + search_artifacts: true + workflow_conclusion: "" + if_no_artifact_found: warn + + - name: Extract bench patch archive + run: | + set -euo pipefail + if [ -f "bench-patch.tgz" ]; then + tar -xzf bench-patch.tgz + elif [ -f "bench-patch/bench-patch.tgz" ]; then + tar -xzf bench-patch/bench-patch.tgz + else + echo "No bench-patch.tgz found after download." + exit 0 + fi + ls -la .bench_patch || true + + - name: Apply and commit patch + run: | + set -euo pipefail + + if [ ! -d ".bench_patch" ]; then + echo "No .bench_patch directory found after extraction." + exit 0 + fi + + if [ -f ".bench_patch/summary.txt" ]; then + echo "==== summary.txt ====" + sed -n '1,200p' .bench_patch/summary.txt || true + echo "=====================" + fi + + if [ ! -f ".bench_patch/benchmark_patch.diff" ]; then + echo "No benchmark_patch.diff found (no auto-patch created)." + exit 0 + fi + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + if ! git apply --index --3way .bench_patch/benchmark_patch.diff; then + echo "Patch failed to apply cleanly. Please re-run Validate-Benchmarks to regenerate." + exit 1 + fi + + if git diff --cached --quiet; then + echo "Patch applied but produced no changes (already up to date)." + exit 0 + fi + + echo "==== diff preview ====" + git diff --cached --stat + git diff --cached | head -n 120 || true + echo "======================" + + branch=$(git symbolic-ref --quiet --short HEAD || true) + if [ -z "$branch" ]; then + echo "Not on a branch - cannot push" >&2 + exit 1 + fi + + git commit -m "auto-update benchmark weights" + git push origin "HEAD:${branch}" + + - name: Remove apply-benchmark-patch label + if: ${{ success() }} + run: | + gh pr edit ${{ github.event.pull_request.number }} \ + --repo "${{ github.repository }}" \ + --remove-label "apply-benchmark-patch" || true diff --git a/.github/workflows/docker-localnet.yml b/.github/workflows/docker-localnet.yml index 96f3ca56a0..da9732f186 100644 --- a/.github/workflows/docker-localnet.yml +++ b/.github/workflows/docker-localnet.yml @@ -28,7 +28,7 @@ permissions: jobs: publish: - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, type-ccx53, type-ccx43, type-ccx33] steps: - name: Determine Docker tag and ref diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f0cfd84853..a60f0f9d82 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,7 +27,7 @@ permissions: jobs: publish: - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, type-ccx53, type-ccx43, type-ccx33] steps: - name: Determine Docker tag and ref diff --git a/.github/workflows/evm-tests.yml b/.github/workflows/evm-tests.yml index 7df1eb9733..b818695237 100644 --- a/.github/workflows/evm-tests.yml +++ b/.github/workflows/evm-tests.yml @@ -40,7 +40,7 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: "22" diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index 2e9980532b..12df3f8ab6 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -1,4 +1,4 @@ -# .github/workflows/benchmarks.yml +# .github/workflows/run-benchmarks.yml name: Validate-Benchmarks on: @@ -20,10 +20,8 @@ jobs: env: SKIP_BENCHMARKS: "0" - AUTO_COMMIT_WEIGHTS: "1" steps: - # ────────────────────────────────────────────────────────────────── - name: Check out PR branch if: ${{ env.SKIP_BENCHMARKS != '1' }} uses: actions/checkout@v4 @@ -124,16 +122,45 @@ jobs: echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV" fi + - name: Ensure artifact folder exists + if: ${{ env.SKIP_BENCHMARKS != '1' }} + run: mkdir -p .bench_patch + - name: Run & validate benchmarks if: ${{ env.SKIP_BENCHMARKS != '1' }} - uses: nick-fields/retry@v3 + timeout-minutes: 180 + run: | + chmod +x scripts/benchmark_action.sh + scripts/benchmark_action.sh + + - name: List artifact contents (for debugging) + if: ${{ always() }} + run: | + echo "Workspace: $GITHUB_WORKSPACE" + if [ -d ".bench_patch" ]; then + echo "== .bench_patch ==" + ls -la .bench_patch || true + else + echo ".bench_patch directory is missing" + fi + + - name: Archive bench patch + if: ${{ always() }} + run: | + if [ -d ".bench_patch" ]; then + tar -czf bench-patch.tgz .bench_patch + ls -lh bench-patch.tgz + else + echo "No .bench_patch directory to archive." + fi + + - name: Upload patch artifact (if prepared) + if: ${{ always() }} + uses: actions/upload-artifact@v4 with: - timeout_minutes: 180 - max_attempts: 3 - retry_wait_seconds: 60 - command: | - chmod +x scripts/benchmark_action.sh - scripts/benchmark_action.sh + name: bench-patch + path: bench-patch.tgz + if-no-files-found: warn # (6) — final check after run - name: Check skip label after run diff --git a/Cargo.lock b/Cargo.lock index 7d65c7aac9..b2048237da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -972,11 +972,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.4.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 5.4.1", + "event-listener 5.4.0", "event-listener-strategy", "pin-project-lite", ] @@ -1005,7 +1005,7 @@ dependencies = [ "async-task", "blocking", "cfg-if", - "event-listener 5.4.1", + "event-listener 5.4.0", "futures-lite", "rustix 1.0.8", ] @@ -1544,9 +1544,9 @@ checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c" [[package]] name = "cc" -version = "1.2.31" +version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" +checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ "jobserver", "libc", @@ -1639,7 +1639,6 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-link", ] @@ -2508,7 +2507,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -3052,9 +3050,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "5.4.1" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" dependencies = [ "concurrent-queue", "parking", @@ -3067,7 +3065,7 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" dependencies = [ - "event-listener 5.4.1", + "event-listener 5.4.0", "pin-project-lite", ] @@ -3501,12 +3499,6 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - [[package]] name = "flume" version = "0.11.1" @@ -4114,9 +4106,9 @@ checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.6.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532" dependencies = [ "fastrand", "futures-core", @@ -5118,7 +5110,6 @@ checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown 0.15.4", - "serde", ] [[package]] @@ -6688,19 +6679,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ndarray" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32" -dependencies = [ - "matrixmultiply", - "num-complex", - "num-integer", - "num-traits", - "rawpointer", -] - [[package]] name = "netlink-packet-core" version = "0.7.0" @@ -7313,7 +7291,7 @@ dependencies = [ "expander", "indexmap 2.10.0", "itertools 0.11.0", - "petgraph 0.6.5", + "petgraph", "proc-macro-crate 3.3.0", "proc-macro2", "quote", @@ -7557,7 +7535,6 @@ dependencies = [ "log", "pallet-balances", "pallet-drand", - "pallet-subtensor", "parity-scale-codec", "rand_chacha 0.3.1", "scale-info", @@ -8138,7 +8115,6 @@ name = "pallet-subtensor" version = "4.0.0-dev" dependencies = [ "approx", - "ark-bls12-381 0.4.0", "ark-serialize 0.4.2", "frame-benchmarking", "frame-support", @@ -8147,18 +8123,16 @@ dependencies = [ "hex-literal", "libsecp256k1", "log", - "ndarray", "num-traits", "pallet-balances", "pallet-collective", + "pallet-commitments", "pallet-crowdloan", "pallet-drand", "pallet-membership", "pallet-preimage", - "pallet-proxy 38.0.0", "pallet-scheduler", "pallet-subtensor-swap", - "pallet-transaction-payment", "pallet-utility 38.0.0", "parity-scale-codec", "parity-util-mem", @@ -8168,10 +8142,7 @@ dependencies = [ "safe-math", "scale-info", "serde", - "serde-tuple-vec-map", - "serde_bytes", "serde_json", - "serde_with", "sha2 0.10.9", "share-pool", "sp-core", @@ -8646,17 +8617,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ - "fixedbitset 0.4.2", - "indexmap 2.10.0", -] - -[[package]] -name = "petgraph" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" -dependencies = [ - "fixedbitset 0.5.7", + "fixedbitset", "indexmap 2.10.0", ] @@ -9185,9 +9146,9 @@ checksum = "23eff02c070c70f31878a3d915e88a914ecf3e153741e2fb572dde28cce20fde" [[package]] name = "polling" -version = "3.10.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5bd19146350fe804f7cb2669c851c03d69da628803dab0d98018142aaa5d829" +checksum = "8ee9b2fa7a4517d2c91ff5bc6c297a427a96749d15f98fcdbb22c05571a4d4b7" dependencies = [ "cfg-if", "concurrent-queue", @@ -9560,7 +9521,7 @@ dependencies = [ "log", "multimap", "once_cell", - "petgraph 0.7.1", + "petgraph", "prettyplease", "prost 0.13.5", "prost-types", @@ -10128,9 +10089,9 @@ dependencies = [ [[package]] name = "ruint" -version = "1.16.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecb38f82477f20c5c3d62ef52d7c4e536e38ea9b73fb570a20c5cae0e14bcf6" +checksum = "11256b5fe8c68f56ac6f39ef0720e592f33d2367a4782740d9c9142e889c7fb4" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", @@ -11502,7 +11463,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2503-6#598feddb893f5ad3923a62e41a2f179b6e10c30c" +source = "git+https://github.com/opentensor/transaction-pool.git?rev=5cc8837d4c237d02c013c50b0a0eb70fdcba75bf#5cc8837d4c237d02c013c50b0a0eb70fdcba75bf" dependencies = [ "async-trait", "futures", @@ -11720,30 +11681,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "schemars" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - [[package]] name = "schnellru" version = "0.2.4" @@ -11989,15 +11926,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-tuple-vec-map" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a04d0ebe0de77d7d445bb729a895dcb0a288854b267ca85f030ce51cdc578c82" -dependencies = [ - "serde", -] - [[package]] name = "serde_bytes" version = "0.11.17" @@ -12030,9 +11958,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.142" +version = "1.0.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" +checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" dependencies = [ "itoa", "memchr", @@ -12061,38 +11989,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_with" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" -dependencies = [ - "base64 0.22.1", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.10.0", - "schemars 0.9.0", - "schemars 1.0.4", - "serde", - "serde_derive", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.104", -] - [[package]] name = "serdect" version = "0.2.0" @@ -12184,9 +12080,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.6" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" dependencies = [ "libc", ] @@ -12305,7 +12201,7 @@ dependencies = [ "derive_more 0.99.20", "ed25519-zebra", "either", - "event-listener 5.4.1", + "event-listener 5.4.0", "fnv", "futures-lite", "futures-util", @@ -12354,7 +12250,7 @@ dependencies = [ "bs58", "derive_more 0.99.20", "either", - "event-listener 5.4.1", + "event-listener 5.4.0", "fnv", "futures-channel", "futures-lite", @@ -12674,7 +12570,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -12770,7 +12666,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" dependencies = [ "proc-macro2", "quote", @@ -12780,7 +12676,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" dependencies = [ "environmental", "parity-scale-codec", @@ -12990,7 +12886,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13027,7 +12923,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" dependencies = [ "Inflector", "expander", @@ -13129,12 +13025,12 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" dependencies = [ "impl-serde 0.5.0", "parity-scale-codec", @@ -13170,7 +13066,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" dependencies = [ "parity-scale-codec", "regex", @@ -13267,7 +13163,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#59fb2e7482d471a7ec4e8d3b30499497efa7b34c" +source = "git+https://github.com/paritytech/polkadot-sdk#177b03958c766fe053f28424ee6f6748644bb794" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13357,7 +13253,7 @@ dependencies = [ "crc", "crossbeam-queue", "either", - "event-listener 5.4.1", + "event-listener 5.4.0", "futures-core", "futures-intrusive", "futures-io", @@ -13749,12 +13645,9 @@ name = "subtensor-custom-rpc" version = "0.0.2" dependencies = [ "jsonrpsee", - "pallet-subtensor", "parity-scale-codec", - "serde", "sp-api", "sp-blockchain", - "sp-rpc", "sp-runtime", "subtensor-custom-rpc-runtime-api", "subtensor-runtime-common", @@ -13764,10 +13657,8 @@ dependencies = [ name = "subtensor-custom-rpc-runtime-api" version = "0.0.2" dependencies = [ - "frame-support", "pallet-subtensor", "parity-scale-codec", - "serde", "sp-api", "sp-runtime", "subtensor-runtime-common", @@ -13814,7 +13705,6 @@ dependencies = [ "pallet-proxy 38.0.0", "pallet-subtensor", "pallet-subtensor-swap", - "parity-scale-codec", "precompile-utils", "sp-core", "sp-io", @@ -14380,9 +14270,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.47.1" +version = "1.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +checksum = "43864ed400b6043a4757a25c7a64a8efde741aed79a056a2fb348a406701bb35" dependencies = [ "backtrace", "bytes", @@ -14449,9 +14339,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.16" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" dependencies = [ "bytes", "futures-core", @@ -16200,9 +16090,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.3" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbb9122ea75b11bf96e7492afb723e8a7fbe12c67417aa95e7e3d18144d37cd" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" dependencies = [ "yoke", "zerofrom", diff --git a/Cargo.toml b/Cargo.toml index 291edb8c29..3415b8624d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -295,6 +295,7 @@ pow-faucet = [] [patch."https://github.com/paritytech/polkadot-sdk.git"] sc-consensus-grandpa = { git = "https://github.com/opentensor/grandpa.git", rev = "67ff75e915bd44586b8f8443e457b5b101920da8" } +sc-transaction-pool = { git = "https://github.com/opentensor/transaction-pool.git", rev = "5cc8837d4c237d02c013c50b0a0eb70fdcba75bf" } [patch.crates-io] w3f-bls = { git = "https://github.com/opentensor/bls", branch = "fix-no-std" } diff --git a/common/src/lib.rs b/common/src/lib.rs index a3882a88fc..82f0916894 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -154,7 +154,7 @@ pub enum ProxyType { Registration, Transfer, SmallTransfer, - RootWeights, + RootWeights, // deprecated ChildKeys, SudoUncheckedSetCode, SwapHotkey, @@ -174,6 +174,7 @@ pub trait SubnetInfo { fn exists(netuid: NetUid) -> bool; fn mechanism(netuid: NetUid) -> u16; fn is_owner(account_id: &AccountId, netuid: NetUid) -> bool; + fn is_subtoken_enabled(netuid: NetUid) -> bool; } pub trait BalanceOps { diff --git a/evm-tests/package.json b/evm-tests/package.json index 9970967a88..ae756ae55f 100644 --- a/evm-tests/package.json +++ b/evm-tests/package.json @@ -7,15 +7,15 @@ "license": "ISC", "dependencies": { "@polkadot-api/descriptors": "file:.papi/descriptors", - "@polkadot-labs/hdkd": "^0.0.10", - "@polkadot-labs/hdkd-helpers": "^0.0.11", - "@polkadot/api": "15.1.1", + "@polkadot-labs/hdkd": "^0.0.23", + "@polkadot-labs/hdkd-helpers": "^0.0.23", + "@polkadot/api": "^16.4.6", "@types/mocha": "^10.0.10", - "crypto": "^1.0.1", - "dotenv": "16.4.7", + "dotenv": "17.2.1", "ethers": "^6.13.5", "mocha": "^11.1.0", "polkadot-api": "^1.9.5", + "rxjs": "^7.8.2", "scale-ts": "^1.6.1", "viem": "2.23.4", "ws": "^8.18.2" @@ -23,11 +23,12 @@ "devDependencies": { "@types/bun": "^1.1.13", "@types/chai": "^5.0.1", + "@types/node": "^22.18.0", "assert": "^2.1.0", - "chai": "^5.2.0", + "chai": "^6.0.1", "prettier": "^3.3.3", "ts-node": "^10.9.2", "typescript": "^5.7.2", - "vite": "^5.4.8" + "vite": "^7.1.4" } } diff --git a/evm-tests/src/contracts/alpha.ts b/evm-tests/src/contracts/alpha.ts index a87702eb80..ae24298048 100644 --- a/evm-tests/src/contracts/alpha.ts +++ b/evm-tests/src/contracts/alpha.ts @@ -315,5 +315,18 @@ export const IAlphaABI = [ ], "stateMutability": "view", "type": "function" + }, + { + "inputs": [], + "name": "getCKBurn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" } ] \ No newline at end of file diff --git a/evm-tests/src/subtensor.ts b/evm-tests/src/subtensor.ts index b1ff818038..9b351628d0 100644 --- a/evm-tests/src/subtensor.ts +++ b/evm-tests/src/subtensor.ts @@ -268,15 +268,6 @@ export async function setMinDelegateTake(api: TypedApi, minDelega assert.equal(minDelegateTake, await api.query.SubtensorModule.MinDelegateTake.getValue()) } -export async function becomeDelegate(api: TypedApi, ss58Address: string, keypair: KeyPair) { - const signer = getSignerFromKeypair(keypair) - - const tx = api.tx.SubtensorModule.become_delegate({ - hotkey: ss58Address - }) - await waitForTransactionWithRetry(api, tx, signer) -} - export async function addStake(api: TypedApi, netuid: number, ss58Address: string, amount_staked: bigint, keypair: KeyPair) { const signer = getSignerFromKeypair(keypair) let tx = api.tx.SubtensorModule.add_stake({ diff --git a/evm-tests/test/alpha.precompile.test.ts b/evm-tests/test/alpha.precompile.test.ts index 31b31da135..1ca3c755af 100644 --- a/evm-tests/test/alpha.precompile.test.ts +++ b/evm-tests/test/alpha.precompile.test.ts @@ -8,6 +8,7 @@ import { PublicClient } from "viem"; import { PolkadotSigner, TypedApi } from "polkadot-api"; import { toViemAddress, convertPublicKeyToSs58 } from "../src/address-utils" import { IAlphaABI, IALPHA_ADDRESS } from "../src/contracts/alpha" +import { u64 } from "@polkadot-api/substrate-bindings"; describe("Test Alpha Precompile", () => { // init substrate part @@ -209,6 +210,24 @@ describe("Test Alpha Precompile", () => { assert.ok(typeof alphaIssuance === 'bigint', "Alpha issuance should be a bigint"); assert.ok(alphaIssuance >= BigInt(0), "Alpha issuance should be non-negative"); }); + + it("getCKBurn returns valid CK burn rate", async () => { + const ckBurn = await publicClient.readContract({ + abi: IAlphaABI, + address: toViemAddress(IALPHA_ADDRESS), + functionName: "getCKBurn", + args: [] + }) + + const ckBurnOnChain = await api.query.SubtensorModule.CKBurn.getValue() + + assert.strictEqual(ckBurn, ckBurnOnChain, "CK burn should match on chain"); + assert.ok(ckBurn !== undefined, "CK burn should be defined"); + const ckBurnPercentage = BigInt(ckBurn) * BigInt(100) / BigInt(2 ** 64 - 1) + assert.ok(ckBurnPercentage >= BigInt(0), "CK burn percentage should be non-negative"); + assert.ok(ckBurnPercentage <= BigInt(100), "CK burn percentage should be less than or equal to 100"); + assert.ok(typeof ckBurn === 'bigint', "CK burn should be a bigint"); + }); }); describe("Global Functions", () => { diff --git a/evm-tests/test/staking.precompile.reward.test.ts b/evm-tests/test/staking.precompile.reward.test.ts index 3735329ff2..79ad977515 100644 --- a/evm-tests/test/staking.precompile.reward.test.ts +++ b/evm-tests/test/staking.precompile.reward.test.ts @@ -7,7 +7,7 @@ import { tao } from "../src/balance-math" import { forceSetBalanceToSs58Address, addNewSubnetwork, burnedRegister, setTxRateLimit, setTempo, setWeightsSetRateLimit, setSubnetOwnerCut, setMaxAllowedUids, - setMinDelegateTake, becomeDelegate, setActivityCutoff, addStake, setWeight, rootRegister, + setMinDelegateTake, setActivityCutoff, addStake, setWeight, rootRegister, startCall } from "../src/subtensor" @@ -52,8 +52,6 @@ describe("Test neuron precompile reward", () => { await setActivityCutoff(api, netuid, 65535) await setMaxAllowedUids(api, netuid, 65535) await setMinDelegateTake(api, 0) - await becomeDelegate(api, convertPublicKeyToSs58(validator.publicKey), coldkey) - await becomeDelegate(api, convertPublicKeyToSs58(miner.publicKey), coldkey) }) it("Staker receives rewards", async () => { diff --git a/evm-tests/yarn.lock b/evm-tests/yarn.lock index 38c4c5bde2..678576deb6 100644 --- a/evm-tests/yarn.lock +++ b/evm-tests/yarn.lock @@ -38,171 +38,86 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@esbuild/aix-ppc64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f" - integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ== - "@esbuild/aix-ppc64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz#4e0f91776c2b340e75558f60552195f6fad09f18" integrity sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA== -"@esbuild/android-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz#09d9b4357780da9ea3a7dfb833a1f1ff439b4052" - integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A== - "@esbuild/android-arm64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz#bc766407f1718923f6b8079c8c61bf86ac3a6a4f" integrity sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg== -"@esbuild/android-arm@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz#9b04384fb771926dfa6d7ad04324ecb2ab9b2e28" - integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg== - "@esbuild/android-arm@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.25.5.tgz#4290d6d3407bae3883ad2cded1081a234473ce26" integrity sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA== -"@esbuild/android-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz#29918ec2db754cedcb6c1b04de8cd6547af6461e" - integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA== - "@esbuild/android-x64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.25.5.tgz#40c11d9cbca4f2406548c8a9895d321bc3b35eff" integrity sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw== -"@esbuild/darwin-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz#e495b539660e51690f3928af50a76fb0a6ccff2a" - integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== - "@esbuild/darwin-arm64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz#49d8bf8b1df95f759ac81eb1d0736018006d7e34" integrity sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ== -"@esbuild/darwin-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz#c13838fa57372839abdddc91d71542ceea2e1e22" - integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw== - "@esbuild/darwin-x64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz#e27a5d92a14886ef1d492fd50fc61a2d4d87e418" integrity sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ== -"@esbuild/freebsd-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz#646b989aa20bf89fd071dd5dbfad69a3542e550e" - integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g== - "@esbuild/freebsd-arm64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz#97cede59d638840ca104e605cdb9f1b118ba0b1c" integrity sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw== -"@esbuild/freebsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz#aa615cfc80af954d3458906e38ca22c18cf5c261" - integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ== - "@esbuild/freebsd-x64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz#71c77812042a1a8190c3d581e140d15b876b9c6f" integrity sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw== -"@esbuild/linux-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz#70ac6fa14f5cb7e1f7f887bcffb680ad09922b5b" - integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q== - "@esbuild/linux-arm64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz#f7b7c8f97eff8ffd2e47f6c67eb5c9765f2181b8" integrity sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg== -"@esbuild/linux-arm@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz#fc6fd11a8aca56c1f6f3894f2bea0479f8f626b9" - integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA== - "@esbuild/linux-arm@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz#2a0be71b6cd8201fa559aea45598dffabc05d911" integrity sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw== -"@esbuild/linux-ia32@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz#3271f53b3f93e3d093d518d1649d6d68d346ede2" - integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg== - "@esbuild/linux-ia32@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz#763414463cd9ea6fa1f96555d2762f9f84c61783" integrity sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA== -"@esbuild/linux-loong64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz#ed62e04238c57026aea831c5a130b73c0f9f26df" - integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg== - "@esbuild/linux-loong64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz#428cf2213ff786a502a52c96cf29d1fcf1eb8506" integrity sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg== -"@esbuild/linux-mips64el@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz#e79b8eb48bf3b106fadec1ac8240fb97b4e64cbe" - integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg== - "@esbuild/linux-mips64el@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz#5cbcc7fd841b4cd53358afd33527cd394e325d96" integrity sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg== -"@esbuild/linux-ppc64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz#5f2203860a143b9919d383ef7573521fb154c3e4" - integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w== - "@esbuild/linux-ppc64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz#0d954ab39ce4f5e50f00c4f8c4fd38f976c13ad9" integrity sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ== -"@esbuild/linux-riscv64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz#07bcafd99322d5af62f618cb9e6a9b7f4bb825dc" - integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA== - "@esbuild/linux-riscv64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz#0e7dd30730505abd8088321e8497e94b547bfb1e" integrity sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA== -"@esbuild/linux-s390x@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz#b7ccf686751d6a3e44b8627ababc8be3ef62d8de" - integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A== - "@esbuild/linux-s390x@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz#5669af81327a398a336d7e40e320b5bbd6e6e72d" integrity sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ== -"@esbuild/linux-x64@0.21.5": - version "0.21.5" - resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz" - integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== - "@esbuild/linux-x64@0.25.5": version "0.25.5" resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz" @@ -213,11 +128,6 @@ resolved "https://registry.yarnpkg.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz#53b4dfb8fe1cee93777c9e366893bd3daa6ba63d" integrity sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw== -"@esbuild/netbsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz#bbe430f60d378ecb88decb219c602667387a6047" - integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg== - "@esbuild/netbsd-x64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz#a0206f6314ce7dc8713b7732703d0f58de1d1e79" @@ -228,51 +138,26 @@ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz#2a796c87c44e8de78001d808c77d948a21ec22fd" integrity sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw== -"@esbuild/openbsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz#99d1cf2937279560d2104821f5ccce220cb2af70" - integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow== - "@esbuild/openbsd-x64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz#28d0cd8909b7fa3953af998f2b2ed34f576728f0" integrity sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg== -"@esbuild/sunos-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz#08741512c10d529566baba837b4fe052c8f3487b" - integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg== - "@esbuild/sunos-x64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz#a28164f5b997e8247d407e36c90d3fd5ddbe0dc5" integrity sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA== -"@esbuild/win32-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz#675b7385398411240735016144ab2e99a60fc75d" - integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A== - "@esbuild/win32-arm64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz#6eadbead38e8bd12f633a5190e45eff80e24007e" integrity sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw== -"@esbuild/win32-ia32@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz#1bfc3ce98aa6ca9a0969e4d2af72144c59c1193b" - integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA== - "@esbuild/win32-ia32@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz#bab6288005482f9ed2adb9ded7e88eba9a62cc0d" integrity sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ== -"@esbuild/win32-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" - integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== - "@esbuild/win32-x64@0.25.5": version "0.25.5" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz#7fc114af5f6563f19f73324b5d5ff36ece0803d1" @@ -337,44 +222,46 @@ dependencies: "@noble/hashes" "1.3.2" -"@noble/curves@1.8.1", "@noble/curves@^1.3.0", "@noble/curves@^1.6.0", "@noble/curves@^1.7.0", "@noble/curves@^1.8.1", "@noble/curves@~1.8.1": +"@noble/curves@1.8.1", "@noble/curves@^1.6.0", "@noble/curves@~1.8.1": version "1.8.1" resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.8.1.tgz" integrity sha512-warwspo+UYUPep0Q+vtdVB4Ugn8GGQj8iyB3gnRWsztmUHTI3S1nhdiWNsPUGL0vud7JlRRk1XEu7Lq1KGTnMQ== dependencies: "@noble/hashes" "1.7.1" -"@noble/curves@~1.7.0": - version "1.7.0" - resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz" - integrity sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw== +"@noble/curves@^1.3.0": + version "1.9.7" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.7.tgz#79d04b4758a43e4bca2cbdc62e7771352fa6b951" + integrity sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw== dependencies: - "@noble/hashes" "1.6.0" + "@noble/hashes" "1.8.0" + +"@noble/curves@^2.0.0", "@noble/curves@~2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-2.0.0.tgz#1b1d75b447e5ccfaa6a4a3c34280f0c02a763f57" + integrity sha512-RiwZZeJnsTnhT+/gg2KvITJZhK5oagQrpZo+yQyd3mv3D5NAG2qEeEHpw7IkXRlpkoD45wl2o4ydHAvY9wyEfw== + dependencies: + "@noble/hashes" "2.0.0" "@noble/hashes@1.3.2": version "1.3.2" resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== -"@noble/hashes@1.6.0": - version "1.6.0" - resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz" - integrity sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ== - -"@noble/hashes@1.7.1", "@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3", "@noble/hashes@^1.5.0", "@noble/hashes@^1.6.1", "@noble/hashes@^1.7.1", "@noble/hashes@~1.7.1": +"@noble/hashes@1.7.1", "@noble/hashes@^1.5.0", "@noble/hashes@~1.7.1": version "1.7.1" resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.1.tgz" integrity sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ== -"@noble/hashes@^1.8.0": +"@noble/hashes@1.8.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3", "@noble/hashes@^1.8.0": version "1.8.0" resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz" integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== -"@noble/hashes@~1.6.0": - version "1.6.1" - resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.1.tgz" - integrity sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w== +"@noble/hashes@2.0.0", "@noble/hashes@^2.0.0", "@noble/hashes@~2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-2.0.0.tgz#5c39388259a0868cadb17d688cd8cf07eae344a4" + integrity sha512-h8VUBlE8R42+XIDO229cgisD287im3kdY6nbNZJFjc6ZvKIXPYXe6Vc/t+kyjFdMFyt5JpapzTsEg8n63w5/lw== "@pkgjs/parseargs@^0.11.0": version "0.11.0" @@ -425,7 +312,7 @@ "@polkadot-api/utils" "0.2.0" "@polkadot-api/descriptors@file:.papi/descriptors": - version "0.1.0-autogenerated.1186735750961316967" + version "0.1.0-autogenerated.1855018811236749851" "@polkadot-api/ink-contracts@0.3.7": version "0.3.7" @@ -443,12 +330,12 @@ "@polkadot-api/json-rpc-provider-proxy@^0.1.0": version "0.1.0" - resolved "https://registry.npmjs.org/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.1.0.tgz" + resolved "https://registry.yarnpkg.com/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.1.0.tgz#6e191f28e7d0fbbe8b540fc51d12a0adaeba297e" integrity sha512-8GSFE5+EF73MCuLQm8tjrbCqlgclcHBSRaswvXziJ0ZW7iw3UEMsKkkKvELayWyBuOPa2T5i1nj6gFOeIsqvrg== "@polkadot-api/json-rpc-provider@0.0.1", "@polkadot-api/json-rpc-provider@^0.0.1": version "0.0.1" - resolved "https://registry.npmjs.org/@polkadot-api/json-rpc-provider/-/json-rpc-provider-0.0.1.tgz" + resolved "https://registry.yarnpkg.com/@polkadot-api/json-rpc-provider/-/json-rpc-provider-0.0.1.tgz#333645d40ccd9bccfd1f32503f17e4e63e76e297" integrity sha512-/SMC/l7foRjpykLTUTacIH05H3mr9ip8b5xxfwXlVezXrNVLp3Cv0GX6uItkKd+ZjzVPf3PFrDF2B2/HLSNESA== "@polkadot-api/json-rpc-provider@0.0.4": @@ -492,7 +379,7 @@ "@polkadot-api/metadata-builders@0.3.2": version "0.3.2" - resolved "https://registry.npmjs.org/@polkadot-api/metadata-builders/-/metadata-builders-0.3.2.tgz" + resolved "https://registry.yarnpkg.com/@polkadot-api/metadata-builders/-/metadata-builders-0.3.2.tgz#007f158c9e0546cf79ba440befc0c753ab1a6629" integrity sha512-TKpfoT6vTb+513KDzMBTfCb/ORdgRnsS3TDFpOhAhZ08ikvK+hjHMt5plPiAX/OWkm1Wc9I3+K6W0hX5Ab7MVg== dependencies: "@polkadot-api/substrate-bindings" "0.6.0" @@ -517,7 +404,7 @@ "@polkadot-api/observable-client@^0.3.0": version "0.3.2" - resolved "https://registry.npmjs.org/@polkadot-api/observable-client/-/observable-client-0.3.2.tgz" + resolved "https://registry.yarnpkg.com/@polkadot-api/observable-client/-/observable-client-0.3.2.tgz#fd91efee350595a6e0ecfd3f294cc80de86c0cf7" integrity sha512-HGgqWgEutVyOBXoGOPp4+IAq6CNdK/3MfQJmhCJb8YaJiaK4W6aRGrdQuQSTPHfERHCARt9BrOmEvTXAT257Ug== dependencies: "@polkadot-api/metadata-builders" "0.3.2" @@ -604,7 +491,7 @@ "@polkadot-api/substrate-bindings@0.6.0": version "0.6.0" - resolved "https://registry.npmjs.org/@polkadot-api/substrate-bindings/-/substrate-bindings-0.6.0.tgz" + resolved "https://registry.yarnpkg.com/@polkadot-api/substrate-bindings/-/substrate-bindings-0.6.0.tgz#889b0c3ba19dc95282286506bf6e370a43ce119a" integrity sha512-lGuhE74NA1/PqdN7fKFdE5C1gNYX357j1tWzdlPXI0kQ7h3kN0zfxNOpPUN7dIrPcOFZ6C0tRRVrBylXkI6xPw== dependencies: "@noble/hashes" "^1.3.1" @@ -623,7 +510,7 @@ "@polkadot-api/substrate-client@^0.1.2": version "0.1.4" - resolved "https://registry.npmjs.org/@polkadot-api/substrate-client/-/substrate-client-0.1.4.tgz" + resolved "https://registry.yarnpkg.com/@polkadot-api/substrate-client/-/substrate-client-0.1.4.tgz#7a808e5cb85ecb9fa2b3a43945090a6c807430ce" integrity sha512-MljrPobN0ZWTpn++da9vOvt+Ex+NlqTlr/XT7zi9sqPtDJiQcYl+d29hFAgpaeTqbeQKZwz3WDE9xcEfLE8c5A== dependencies: "@polkadot-api/json-rpc-provider" "0.0.1" @@ -631,7 +518,7 @@ "@polkadot-api/utils@0.1.0": version "0.1.0" - resolved "https://registry.npmjs.org/@polkadot-api/utils/-/utils-0.1.0.tgz" + resolved "https://registry.yarnpkg.com/@polkadot-api/utils/-/utils-0.1.0.tgz#d36937cdc465c2ea302f3278cf53157340ab33a0" integrity sha512-MXzWZeuGxKizPx2Xf/47wx9sr/uxKw39bVJUptTJdsaQn/TGq+z310mHzf1RCGvC1diHM8f593KrnDgc9oNbJA== "@polkadot-api/utils@0.2.0": @@ -653,357 +540,346 @@ "@polkadot-api/json-rpc-provider-proxy" "0.2.4" ws "^8.18.3" -"@polkadot-labs/hdkd-helpers@0.0.10": - version "0.0.10" - resolved "https://registry.npmjs.org/@polkadot-labs/hdkd-helpers/-/hdkd-helpers-0.0.10.tgz" - integrity sha512-wBKenhN7TjNiMXxBvQWzFf+su8xTaRGqyOKAlAfpyY9oWTOt3G05yMvDHEZ4g/NRLoE4P3fQYQ0bdcMKl7KkDw== - dependencies: - "@noble/curves" "^1.7.0" - "@noble/hashes" "^1.6.1" - "@scure/base" "^1.2.1" - micro-sr25519 "^0.1.0" - scale-ts "^1.6.1" - -"@polkadot-labs/hdkd-helpers@^0.0.11": - version "0.0.11" - resolved "https://registry.npmjs.org/@polkadot-labs/hdkd-helpers/-/hdkd-helpers-0.0.11.tgz" - integrity sha512-qPlWqC3NNV/2NYc5GEy+Ovi4UBAgkMGvMfyiYuj2BQN4lW59Q1T9coNx0Yp6XzsnJ1ddaF9PWaUtxj3LdM0IDw== +"@polkadot-labs/hdkd-helpers@^0.0.23", "@polkadot-labs/hdkd-helpers@~0.0.23": + version "0.0.23" + resolved "https://registry.yarnpkg.com/@polkadot-labs/hdkd-helpers/-/hdkd-helpers-0.0.23.tgz#68b8ec8fb3e26e1eaeed289db2fa54eb13adefe9" + integrity sha512-wfayRSCqOhcg4eaTltdynQHrn53FftGZ3Ws1HmxlE4N6VJYTfsTrfHAWI7l3BZz14nUUDDZe7IlvyX14Qqaakw== dependencies: - "@noble/curves" "^1.8.1" - "@noble/hashes" "^1.7.1" - "@scure/base" "^1.2.4" - micro-sr25519 "^0.1.0" + "@noble/curves" "^2.0.0" + "@noble/hashes" "^2.0.0" + "@scure/base" "^2.0.0" + "@scure/sr25519" "^0.3.0" scale-ts "^1.6.1" -"@polkadot-labs/hdkd@^0.0.10": - version "0.0.10" - resolved "https://registry.npmjs.org/@polkadot-labs/hdkd/-/hdkd-0.0.10.tgz" - integrity sha512-jD8l+Ls/kZjvZja4T2Y0G6Be3rfGn0qNs3hvcNeV2CmOMtI7yRkkWPXI7WiJ8AyEoBwBuZt0rm6yzGla6o2HXQ== - dependencies: - "@polkadot-labs/hdkd-helpers" "0.0.10" - -"@polkadot/api-augment@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-15.1.1.tgz" - integrity sha512-tYASON7vVLz7FGcXVX9dWSd/9pR6FckayEkc08Z6RyjH7HfjtCZ3/Dz7MlGRNql4SnPi4+xpjSD6rwrZcETU1g== - dependencies: - "@polkadot/api-base" "15.1.1" - "@polkadot/rpc-augment" "15.1.1" - "@polkadot/types" "15.1.1" - "@polkadot/types-augment" "15.1.1" - "@polkadot/types-codec" "15.1.1" - "@polkadot/util" "^13.2.3" - tslib "^2.8.0" - -"@polkadot/api-base@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/api-base/-/api-base-15.1.1.tgz" - integrity sha512-OXLZ7/k2RXLIA8hKA8oyii6o8MuGlqujIDcLVaMdtWnQsBg26h8pv/mujT2YSz2OguLxrfdvD+lUGtwZC8kw4A== - dependencies: - "@polkadot/rpc-core" "15.1.1" - "@polkadot/types" "15.1.1" - "@polkadot/util" "^13.2.3" +"@polkadot-labs/hdkd@^0.0.23": + version "0.0.23" + resolved "https://registry.yarnpkg.com/@polkadot-labs/hdkd/-/hdkd-0.0.23.tgz#fecacb353c7f9d15aa9f826ba4208e8828935399" + integrity sha512-EyBNsdoX2SQrjp3PpBv2kvtkvL3714ydqKwXH1t3kWOuBq6VwnOm0zRMkmGawhFA+25aUEnBC/dmwI4Xb4hCYg== + dependencies: + "@polkadot-labs/hdkd-helpers" "~0.0.23" + +"@polkadot/api-augment@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-16.4.6.tgz#9c23c100736ccf469091153b992547037a2b1e06" + integrity sha512-YoNOKNk5dca/32Lu5aaLdafGkkUbMHjKRSzrOUAx48jVUWaQYz0WXps2zfx1zDM2hqIgcmkgCQfMdzwHRnj63w== + dependencies: + "@polkadot/api-base" "16.4.6" + "@polkadot/rpc-augment" "16.4.6" + "@polkadot/types" "16.4.6" + "@polkadot/types-augment" "16.4.6" + "@polkadot/types-codec" "16.4.6" + "@polkadot/util" "^13.5.6" + tslib "^2.8.1" + +"@polkadot/api-base@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-16.4.6.tgz#223b28f93b58734b3d3cb37874de0cbaf535ba01" + integrity sha512-tR7rtNmK+NSqqYLzj0C0OPBqqTMOFiyIxKRj2D3/d1IiS6/pUUo455xdwDPTyuUj7adAinSSUOcTtFOcI5BLOA== + dependencies: + "@polkadot/rpc-core" "16.4.6" + "@polkadot/types" "16.4.6" + "@polkadot/util" "^13.5.6" rxjs "^7.8.1" - tslib "^2.8.0" - -"@polkadot/api-derive@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-15.1.1.tgz" - integrity sha512-UPcKr9FplfYKPaP7FYEF917Sm1rKnQFX4AzQJn3f8ySp7DDf6EYiHrNICtGifPEAoANTSW+YHlSchhtnvfSIhw== - dependencies: - "@polkadot/api" "15.1.1" - "@polkadot/api-augment" "15.1.1" - "@polkadot/api-base" "15.1.1" - "@polkadot/rpc-core" "15.1.1" - "@polkadot/types" "15.1.1" - "@polkadot/types-codec" "15.1.1" - "@polkadot/util" "^13.2.3" - "@polkadot/util-crypto" "^13.2.3" + tslib "^2.8.1" + +"@polkadot/api-derive@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-16.4.6.tgz#bc7e9ba2695d6d5ed5347e911870aed89ca0912b" + integrity sha512-kh57AhyLtKU3dM2SLCitMEqUJ3cIjwtLtMpiMB7yNH/OvaE7BZ3VO1TuWoU2+kKgyL8DdX6vhdmM5G9/ni+B3w== + dependencies: + "@polkadot/api" "16.4.6" + "@polkadot/api-augment" "16.4.6" + "@polkadot/api-base" "16.4.6" + "@polkadot/rpc-core" "16.4.6" + "@polkadot/types" "16.4.6" + "@polkadot/types-codec" "16.4.6" + "@polkadot/util" "^13.5.6" + "@polkadot/util-crypto" "^13.5.6" rxjs "^7.8.1" - tslib "^2.8.0" - -"@polkadot/api@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/api/-/api-15.1.1.tgz" - integrity sha512-n3QeQ1CXlzjqyh2eFbEQPcnkXO3J4QYNTIj0Lnz/XFUpzKimHPDA2iUfaXuy5dXjnzS21jFANGSUFoZ+XKi/8g== - dependencies: - "@polkadot/api-augment" "15.1.1" - "@polkadot/api-base" "15.1.1" - "@polkadot/api-derive" "15.1.1" - "@polkadot/keyring" "^13.2.3" - "@polkadot/rpc-augment" "15.1.1" - "@polkadot/rpc-core" "15.1.1" - "@polkadot/rpc-provider" "15.1.1" - "@polkadot/types" "15.1.1" - "@polkadot/types-augment" "15.1.1" - "@polkadot/types-codec" "15.1.1" - "@polkadot/types-create" "15.1.1" - "@polkadot/types-known" "15.1.1" - "@polkadot/util" "^13.2.3" - "@polkadot/util-crypto" "^13.2.3" + tslib "^2.8.1" + +"@polkadot/api@16.4.6", "@polkadot/api@^16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-16.4.6.tgz#86fbecb60867ae6eae1ed11a7962819e4abdfd80" + integrity sha512-/RYqejRoAgTR0PJpxRYWgYO7iKMXS/mIhFr7vLKzYNOzEA0nePUHE3iYkrhAj2Rluwy1gPcVoUU8/EYGVsWLGQ== + dependencies: + "@polkadot/api-augment" "16.4.6" + "@polkadot/api-base" "16.4.6" + "@polkadot/api-derive" "16.4.6" + "@polkadot/keyring" "^13.5.6" + "@polkadot/rpc-augment" "16.4.6" + "@polkadot/rpc-core" "16.4.6" + "@polkadot/rpc-provider" "16.4.6" + "@polkadot/types" "16.4.6" + "@polkadot/types-augment" "16.4.6" + "@polkadot/types-codec" "16.4.6" + "@polkadot/types-create" "16.4.6" + "@polkadot/types-known" "16.4.6" + "@polkadot/util" "^13.5.6" + "@polkadot/util-crypto" "^13.5.6" eventemitter3 "^5.0.1" rxjs "^7.8.1" - tslib "^2.8.0" + tslib "^2.8.1" -"@polkadot/keyring@^13.2.3": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/keyring/-/keyring-13.5.4.tgz" - integrity sha512-dQ/yq2OAl6jvjH+drxyqcfprsU2J9h74GSy5X4499W6YNwCt/2pxAJbmsM3lDWUlGOV1Wnp/aNHHs9kjb8GaJw== +"@polkadot/keyring@^13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-13.5.6.tgz#b26d0cba323bb0520826211317701aa540428406" + integrity sha512-Ybe6Mflrh96FKR5tfEaf/93RxJD7x9UigseNOJW6Yd8LF+GesdxrqmZD7zh+53Hb7smGQWf/0FCfwhoWZVgPUQ== dependencies: - "@polkadot/util" "13.5.4" - "@polkadot/util-crypto" "13.5.4" + "@polkadot/util" "13.5.6" + "@polkadot/util-crypto" "13.5.6" tslib "^2.8.0" -"@polkadot/networks@13.5.4", "@polkadot/networks@^13.2.3": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/networks/-/networks-13.5.4.tgz" - integrity sha512-JD7brNZsWTWbT3bDnEsAYkJfESvmn1XcoFMLoivVrg8dPXqYxoWcYveKPORjPyMPP6wgJ498vJGq7Ce0ihZ8ig== +"@polkadot/networks@13.5.6", "@polkadot/networks@^13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-13.5.6.tgz#fc74b556dc2aa03a49ee6543df0ae74a280da7a5" + integrity sha512-9HqUIBOHnz9x/ssPb0aOD/7XcU8vGokEYpLoNgexFNIJzqDgrDHXR197iFpkbMqA/+98zagrvYUyPYj1yYs9Jw== dependencies: - "@polkadot/util" "13.5.4" + "@polkadot/util" "13.5.6" "@substrate/ss58-registry" "^1.51.0" tslib "^2.8.0" -"@polkadot/rpc-augment@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-15.1.1.tgz" - integrity sha512-s6i4nTy7/1Q5svIMT4TR55GLRv9asG7xbJcntHEsQ2nDs8zZV/mvPWfEUxgup0xVO8sDgyrf6KTTVRKJjySjUg== - dependencies: - "@polkadot/rpc-core" "15.1.1" - "@polkadot/types" "15.1.1" - "@polkadot/types-codec" "15.1.1" - "@polkadot/util" "^13.2.3" - tslib "^2.8.0" - -"@polkadot/rpc-core@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-15.1.1.tgz" - integrity sha512-KErbVgPChps7NsxcGch5JCArZHNqs81fDEzs+XoHnD05nzuxcO38v4Yu+M04lHLax2m8ky8K6o3gurBglJENlA== - dependencies: - "@polkadot/rpc-augment" "15.1.1" - "@polkadot/rpc-provider" "15.1.1" - "@polkadot/types" "15.1.1" - "@polkadot/util" "^13.2.3" +"@polkadot/rpc-augment@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-16.4.6.tgz#ee4c56c9c0feb281adbbdd23ec6768d487ff53e3" + integrity sha512-Fqx41st3KTCfk831OrAh69ftBzqxklEi5e5S/rB2l5F+OQYAsbGMfTSFWTRRVGgBliWZO+T/Tpw2zJqUwrgn3Q== + dependencies: + "@polkadot/rpc-core" "16.4.6" + "@polkadot/types" "16.4.6" + "@polkadot/types-codec" "16.4.6" + "@polkadot/util" "^13.5.6" + tslib "^2.8.1" + +"@polkadot/rpc-core@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-16.4.6.tgz#f46bd58e31f04846abc9e2bf02620f1cba1dc943" + integrity sha512-xi3VIGRXjebdz0jctZpa7y2A+JaI9LSBdUgkHoUOmGrpNzDpMXoE2xWdxg3M/0hql69mSLhatWS9JvSb5MrBTQ== + dependencies: + "@polkadot/rpc-augment" "16.4.6" + "@polkadot/rpc-provider" "16.4.6" + "@polkadot/types" "16.4.6" + "@polkadot/util" "^13.5.6" rxjs "^7.8.1" - tslib "^2.8.0" - -"@polkadot/rpc-provider@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-15.1.1.tgz" - integrity sha512-9OWV1dyX+vmAbKkhMU8J7Q0sCaovPrkwZqo2ejmEpZ/Lr12Hw5JAk4gdvB869QEVP7zj0gH3HuYVajmsxesYKg== - dependencies: - "@polkadot/keyring" "^13.2.3" - "@polkadot/types" "15.1.1" - "@polkadot/types-support" "15.1.1" - "@polkadot/util" "^13.2.3" - "@polkadot/util-crypto" "^13.2.3" - "@polkadot/x-fetch" "^13.2.3" - "@polkadot/x-global" "^13.2.3" - "@polkadot/x-ws" "^13.2.3" + tslib "^2.8.1" + +"@polkadot/rpc-provider@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-16.4.6.tgz#d0b47f4c67076a89a60857e8cc47881bf7a15eba" + integrity sha512-/ZD1rOWBRoMxnp039pOa8Czpjr/l4+3YYY5OcW9WZj16dRcJK84qVi1m91Hro+Gfe9Dus8VeOD/ncJB+a+haRA== + dependencies: + "@polkadot/keyring" "^13.5.6" + "@polkadot/types" "16.4.6" + "@polkadot/types-support" "16.4.6" + "@polkadot/util" "^13.5.6" + "@polkadot/util-crypto" "^13.5.6" + "@polkadot/x-fetch" "^13.5.6" + "@polkadot/x-global" "^13.5.6" + "@polkadot/x-ws" "^13.5.6" eventemitter3 "^5.0.1" mock-socket "^9.3.1" nock "^13.5.5" - tslib "^2.8.0" + tslib "^2.8.1" optionalDependencies: "@substrate/connect" "0.8.11" -"@polkadot/types-augment@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-15.1.1.tgz" - integrity sha512-6v/FsN/JYCupyGYW+MbS0iOCiWvf6PXJ5+m8ORYYYDPFgQqaQPxKMKWJpnO0s9cCR33QcyNYhErPGuZ62UMJjw== - dependencies: - "@polkadot/types" "15.1.1" - "@polkadot/types-codec" "15.1.1" - "@polkadot/util" "^13.2.3" - tslib "^2.8.0" - -"@polkadot/types-codec@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-15.1.1.tgz" - integrity sha512-cm99CFvDf4UXmw7DeMkRqa/hf7wEgjJZoZZW/B12Js0ObwRmSXMk/gDbyiT6hqPnQ81sU726E72p39DolaEatQ== - dependencies: - "@polkadot/util" "^13.2.3" - "@polkadot/x-bigint" "^13.2.3" - tslib "^2.8.0" - -"@polkadot/types-create@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/types-create/-/types-create-15.1.1.tgz" - integrity sha512-AOgz+UsUqsGSENrc+p/dHyXH2TC9qVtUTAxlqaHfOnwqjMWfEqc78mc5a1mk0a+RqxmIHw8nQNSdBdhv+UdtyQ== - dependencies: - "@polkadot/types-codec" "15.1.1" - "@polkadot/util" "^13.2.3" - tslib "^2.8.0" - -"@polkadot/types-known@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/types-known/-/types-known-15.1.1.tgz" - integrity sha512-L934pYxXdHB3GHlVu57ihO6llhxuggSuQZuJ9kHunG0I6tezXLIgAhwaPgACMVbmBYlkJPqm4Nr6pC3kpIsGow== - dependencies: - "@polkadot/networks" "^13.2.3" - "@polkadot/types" "15.1.1" - "@polkadot/types-codec" "15.1.1" - "@polkadot/types-create" "15.1.1" - "@polkadot/util" "^13.2.3" - tslib "^2.8.0" - -"@polkadot/types-support@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/types-support/-/types-support-15.1.1.tgz" - integrity sha512-uyn5N7XERHosVq0+aCpEwYnkUroOr7OX8B8/00UkgmfVOXskp/cukEVcGlmI/YGAS+9+V2BZN2GBX7Lz0eeKmw== - dependencies: - "@polkadot/util" "^13.2.3" - tslib "^2.8.0" - -"@polkadot/types@15.1.1": - version "15.1.1" - resolved "https://registry.npmjs.org/@polkadot/types/-/types-15.1.1.tgz" - integrity sha512-n6lg/quhLp3Zmt/6gHAg2uoSmMmXk3NR19I7qCyeDJ30pP1UhOjtmuWOQDl6SwSEwuHtudLp3p2nCJsymXjgsw== - dependencies: - "@polkadot/keyring" "^13.2.3" - "@polkadot/types-augment" "15.1.1" - "@polkadot/types-codec" "15.1.1" - "@polkadot/types-create" "15.1.1" - "@polkadot/util" "^13.2.3" - "@polkadot/util-crypto" "^13.2.3" +"@polkadot/types-augment@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-16.4.6.tgz#6b9f712dd755b6bc1d771b6238521698e4ff0261" + integrity sha512-ZFe6j+HHK+ST4D2MwV7oC4y6pyBMZV1b8ZZT2htTtWf03PE0W2ziQVM+Fg42iSHpgmCyJLSABU11QkGSGtRfyQ== + dependencies: + "@polkadot/types" "16.4.6" + "@polkadot/types-codec" "16.4.6" + "@polkadot/util" "^13.5.6" + tslib "^2.8.1" + +"@polkadot/types-codec@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-16.4.6.tgz#54ef45a84b807c73054d739cf77cb21f62acb462" + integrity sha512-KCDDJNPTrScQV1HEMNjBIvtx12/J+DPV/niC+klb39wqeBAt7+wYNd8zSnFQzrLvx+n2eWlJjq0dxQiK+Ljc5A== + dependencies: + "@polkadot/util" "^13.5.6" + "@polkadot/x-bigint" "^13.5.6" + tslib "^2.8.1" + +"@polkadot/types-create@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-16.4.6.tgz#55bf3178daeb82345f9e858c007aac0b4aa4974d" + integrity sha512-+ABF/SKX+xuCPyKvcHIFNybQYQID7bTfvQPkRhK1QxssMwdVtpYCb6RxYU7gYQhlMBAyEZUwele6/JwT/J5VqA== + dependencies: + "@polkadot/types-codec" "16.4.6" + "@polkadot/util" "^13.5.6" + tslib "^2.8.1" + +"@polkadot/types-known@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-16.4.6.tgz#6b2c028f19dcf55dc5272b9038f99edd9177db9d" + integrity sha512-aYCWhn0l+19Vasn32SbXbxf19RX1IHaCizYtSW02FlNKpVlZGfOdqebtpQZUz5TmPIkvk1LGPo+qF0xiJSVlOA== + dependencies: + "@polkadot/networks" "^13.5.6" + "@polkadot/types" "16.4.6" + "@polkadot/types-codec" "16.4.6" + "@polkadot/types-create" "16.4.6" + "@polkadot/util" "^13.5.6" + tslib "^2.8.1" + +"@polkadot/types-support@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-16.4.6.tgz#35fc46454193b73df150040b8f268c9e3c9f87c7" + integrity sha512-e83H4MzamzNzxZdxf104xqzsl1YUCF24i2pw19I/6zPVxpt6a9zn4+7VzSVMclaztxxSTITCLbks7/9dLiNhEw== + dependencies: + "@polkadot/util" "^13.5.6" + tslib "^2.8.1" + +"@polkadot/types@16.4.6": + version "16.4.6" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-16.4.6.tgz#9594f6f80e249f270f9092016957860a4554de5e" + integrity sha512-vfZSOxs64oy1XOcMY3fAbSCBwqLeWvsUYSOhDkZaaC5zIbKdtimPQgbV1QA2fMli568rehmmpLXpZZtj2CNnmA== + dependencies: + "@polkadot/keyring" "^13.5.6" + "@polkadot/types-augment" "16.4.6" + "@polkadot/types-codec" "16.4.6" + "@polkadot/types-create" "16.4.6" + "@polkadot/util" "^13.5.6" + "@polkadot/util-crypto" "^13.5.6" rxjs "^7.8.1" - tslib "^2.8.0" + tslib "^2.8.1" -"@polkadot/util-crypto@13.5.4", "@polkadot/util-crypto@^13.2.3": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-13.5.4.tgz" - integrity sha512-XkKtiUi6I60DxT0dblGajZsqX4jWTnMpj4Pqxddz61KbpmvyybtAUqgmXOmO/Mob6TgGTutPuFeE7uMNEdFdJw== +"@polkadot/util-crypto@13.5.6", "@polkadot/util-crypto@^13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-13.5.6.tgz#aef44d6c201d7c47897288aa268532f396e4cd5f" + integrity sha512-1l+t5lVc9UWxvbJe7/3V+QK8CwrDPuQjDK6FKtDZgZCU0JRrjySOxV0J4PeDIv8TgXZtbIcQFVUhIsJTyKZZJQ== dependencies: "@noble/curves" "^1.3.0" "@noble/hashes" "^1.3.3" - "@polkadot/networks" "13.5.4" - "@polkadot/util" "13.5.4" - "@polkadot/wasm-crypto" "^7.4.1" - "@polkadot/wasm-util" "^7.4.1" - "@polkadot/x-bigint" "13.5.4" - "@polkadot/x-randomvalues" "13.5.4" + "@polkadot/networks" "13.5.6" + "@polkadot/util" "13.5.6" + "@polkadot/wasm-crypto" "^7.5.1" + "@polkadot/wasm-util" "^7.5.1" + "@polkadot/x-bigint" "13.5.6" + "@polkadot/x-randomvalues" "13.5.6" "@scure/base" "^1.1.7" tslib "^2.8.0" -"@polkadot/util@13.5.4", "@polkadot/util@^13.2.3": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/util/-/util-13.5.4.tgz" - integrity sha512-w/D7tqfx5a+yHcVBTb+CWGwpJTwcFRNJaVIBxl/MjF3x8JUZCtcKNwklpWJH5HtwaXT1Mt2aBKjoxlNdnd6FYg== +"@polkadot/util@13.5.6", "@polkadot/util@^13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-13.5.6.tgz#fceb7fe823724535516b304a5675566974cb60e6" + integrity sha512-V+CkW2VdhcMWvl7eXdmlCLGqLxrKvXZtXE76KBbPP5n0Z+8DqQ58IHNOE9xe2LOgqDwIzdLlOUwkyF9Zj19y+Q== dependencies: - "@polkadot/x-bigint" "13.5.4" - "@polkadot/x-global" "13.5.4" - "@polkadot/x-textdecoder" "13.5.4" - "@polkadot/x-textencoder" "13.5.4" + "@polkadot/x-bigint" "13.5.6" + "@polkadot/x-global" "13.5.6" + "@polkadot/x-textdecoder" "13.5.6" + "@polkadot/x-textencoder" "13.5.6" "@types/bn.js" "^5.1.6" bn.js "^5.2.1" tslib "^2.8.0" -"@polkadot/wasm-bridge@7.4.1": - version "7.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-7.4.1.tgz" - integrity sha512-tdkJaV453tezBxhF39r4oeG0A39sPKGDJmN81LYLf+Fihb7astzwju+u75BRmDrHZjZIv00un3razJEWCxze6g== +"@polkadot/wasm-bridge@7.5.1": + version "7.5.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-7.5.1.tgz#f738858213a8a599ae8bf6a6c179b325dcf091f4" + integrity sha512-E+N3CSnX3YaXpAmfIQ+4bTyiAqJQKvVcMaXjkuL8Tp2zYffClWLG5e+RY15Uh+EWfUl9If4y6cLZi3D5NcpAGQ== dependencies: - "@polkadot/wasm-util" "7.4.1" + "@polkadot/wasm-util" "7.5.1" tslib "^2.7.0" -"@polkadot/wasm-crypto-asmjs@7.4.1": - version "7.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.4.1.tgz" - integrity sha512-pwU8QXhUW7IberyHJIQr37IhbB6DPkCG5FhozCiNTq4vFBsFPjm9q8aZh7oX1QHQaiAZa2m2/VjIVE+FHGbvHQ== +"@polkadot/wasm-crypto-asmjs@7.5.1": + version "7.5.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.5.1.tgz#87e07aa340249d5c978cd03eb58b395563066a4c" + integrity sha512-jAg7Uusk+xeHQ+QHEH4c/N3b1kEGBqZb51cWe+yM61kKpQwVGZhNdlWetW6U23t/BMyZArIWMsZqmK/Ij0PHog== dependencies: tslib "^2.7.0" -"@polkadot/wasm-crypto-init@7.4.1": - version "7.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.4.1.tgz" - integrity sha512-AVka33+f7MvXEEIGq5U0dhaA2SaXMXnxVCQyhJTaCnJ5bRDj0Xlm3ijwDEQUiaDql7EikbkkRtmlvs95eSUWYQ== +"@polkadot/wasm-crypto-init@7.5.1": + version "7.5.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.5.1.tgz#0434850b7f05619ff312d5cbfd33629a54f9b31a" + integrity sha512-Obu4ZEo5jYO6sN31eqCNOXo88rPVkP9TrUOyynuFCnXnXr8V/HlmY/YkAd9F87chZnkTJRlzak17kIWr+i7w3A== dependencies: - "@polkadot/wasm-bridge" "7.4.1" - "@polkadot/wasm-crypto-asmjs" "7.4.1" - "@polkadot/wasm-crypto-wasm" "7.4.1" - "@polkadot/wasm-util" "7.4.1" + "@polkadot/wasm-bridge" "7.5.1" + "@polkadot/wasm-crypto-asmjs" "7.5.1" + "@polkadot/wasm-crypto-wasm" "7.5.1" + "@polkadot/wasm-util" "7.5.1" tslib "^2.7.0" -"@polkadot/wasm-crypto-wasm@7.4.1": - version "7.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.4.1.tgz" - integrity sha512-PE1OAoupFR0ZOV2O8tr7D1FEUAwaggzxtfs3Aa5gr+yxlSOaWUKeqsOYe1KdrcjmZVV3iINEAXxgrbzCmiuONg== +"@polkadot/wasm-crypto-wasm@7.5.1": + version "7.5.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.5.1.tgz#b3996007875db6945d29f94f4d4719fce2b3bb8f" + integrity sha512-S2yQSGbOGTcaV6UdipFVyEGanJvG6uD6Tg7XubxpiGbNAblsyYKeFcxyH1qCosk/4qf+GIUwlOL4ydhosZflqg== dependencies: - "@polkadot/wasm-util" "7.4.1" + "@polkadot/wasm-util" "7.5.1" tslib "^2.7.0" -"@polkadot/wasm-crypto@^7.4.1": - version "7.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-7.4.1.tgz" - integrity sha512-kHN/kF7hYxm1y0WeFLWeWir6oTzvcFmR4N8fJJokR+ajYbdmrafPN+6iLgQVbhZnDdxyv9jWDuRRsDnBx8tPMQ== +"@polkadot/wasm-crypto@^7.5.1": + version "7.5.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-7.5.1.tgz#324ebf9a86a30fd19bf4b02a6582367bdddb62c9" + integrity sha512-acjt4VJ3w19v7b/SIPsV/5k9s6JsragHKPnwoZ0KTfBvAFXwzz80jUzVGxA06SKHacfCUe7vBRlz7M5oRby1Pw== dependencies: - "@polkadot/wasm-bridge" "7.4.1" - "@polkadot/wasm-crypto-asmjs" "7.4.1" - "@polkadot/wasm-crypto-init" "7.4.1" - "@polkadot/wasm-crypto-wasm" "7.4.1" - "@polkadot/wasm-util" "7.4.1" + "@polkadot/wasm-bridge" "7.5.1" + "@polkadot/wasm-crypto-asmjs" "7.5.1" + "@polkadot/wasm-crypto-init" "7.5.1" + "@polkadot/wasm-crypto-wasm" "7.5.1" + "@polkadot/wasm-util" "7.5.1" tslib "^2.7.0" -"@polkadot/wasm-util@7.4.1", "@polkadot/wasm-util@^7.4.1": - version "7.4.1" - resolved "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-7.4.1.tgz" - integrity sha512-RAcxNFf3zzpkr+LX/ItAsvj+QyM56TomJ0xjUMo4wKkHjwsxkz4dWJtx5knIgQz/OthqSDMR59VNEycQeNuXzA== +"@polkadot/wasm-util@7.5.1", "@polkadot/wasm-util@^7.5.1": + version "7.5.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-7.5.1.tgz#4568a9bf8d02d2d68fc139f331719865300e5233" + integrity sha512-sbvu71isFhPXpvMVX+EkRnUg/+54Tx7Sf9BEMqxxoPj7cG1I/MKeDEwbQz6MaU4gm7xJqvEWCAemLFcXfHQ/2A== dependencies: tslib "^2.7.0" -"@polkadot/x-bigint@13.5.4", "@polkadot/x-bigint@^13.2.3": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-13.5.4.tgz" - integrity sha512-vA4vjHWDUAnoAxzp1kSQMCzaArdagGXCNlooI2EOZ0pcFnEf4NkKCVjYg8i5L1QOYRAeJjgoKjKwCFBx63vtRw== +"@polkadot/x-bigint@13.5.6", "@polkadot/x-bigint@^13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-13.5.6.tgz#1468aab88e9bc41ea7ca118ab72d111681d7a4be" + integrity sha512-HpqZJ9ud94iK/+0Ofacw7QdtvzFp6SucBBml4XwWZTWoLaLOGDsO7FoWE7yCuwPbX8nLgIM6YmQBeUoZmBtVqQ== dependencies: - "@polkadot/x-global" "13.5.4" + "@polkadot/x-global" "13.5.6" tslib "^2.8.0" -"@polkadot/x-fetch@^13.2.3": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-13.5.4.tgz" - integrity sha512-VVhmfPaQwFVopgtMUCNhodyZXBy9P4wkQwwYWpkQv2KqYOEQVck/Hhq8IVhGdbtPJxCAWsj/EyYTzUIHZ9aBlw== +"@polkadot/x-fetch@^13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-13.5.6.tgz#39393a4873199320c2474d48af883be853c6deca" + integrity sha512-gqx8c6lhnD7Qht+56J+4oeTA8YZ9bAPqzOt2cRJf9MTplMy44W6671T2p6hA3QMvzy4aBTxMie3uKc4tGpLu4A== dependencies: - "@polkadot/x-global" "13.5.4" + "@polkadot/x-global" "13.5.6" node-fetch "^3.3.2" tslib "^2.8.0" -"@polkadot/x-global@13.5.4", "@polkadot/x-global@^13.2.3": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/x-global/-/x-global-13.5.4.tgz" - integrity sha512-oRUdO8/uKOEmLoPUFYgGascE/nyjT2ObRdf7jgwXOd9f+uUHPiE3K/MNAEi9t9sRKs8dbqgyaGWLTRYCDyzMag== +"@polkadot/x-global@13.5.6", "@polkadot/x-global@^13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-13.5.6.tgz#37a52d1cd32fde6d385cb745c0cec534753be1e5" + integrity sha512-iw97n0Bnl2284WgAK732LYR4DW6w5+COfBfHzkhiHqs5xwPEwWMgWGrf2hM8WAQqNIz6Ni8w/jagucPyQBur3Q== dependencies: tslib "^2.8.0" -"@polkadot/x-randomvalues@13.5.4": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-13.5.4.tgz" - integrity sha512-jKVEj+wVO83drbFFGGxhHJqwsOZCzyy6HVwQ/M9G6zhNXHrT46OWK+myd3dB4KbHoxWuH03Nvh540vMC3ah8Fw== +"@polkadot/x-randomvalues@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-13.5.6.tgz#a05e0e4fb188c99c5a84043668a27ae6f05259bc" + integrity sha512-w1F9G7FxrJ7+hGC8bh9/VpPH4KN8xmyzgiQdR7+rVB2V8KsKQBQidG69pj5Kwsh3oODOz0yQYsTG6Rm6TAJbGA== dependencies: - "@polkadot/x-global" "13.5.4" + "@polkadot/x-global" "13.5.6" tslib "^2.8.0" -"@polkadot/x-textdecoder@13.5.4": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-13.5.4.tgz" - integrity sha512-+5rWIs+mhvBR2D7+/gWQyKKDoQzyHRIUrygphxdpBsFSvsJkTTGeGXLiD/ls0gTTE31Kb6StQJi1b9h6ywOvfg== +"@polkadot/x-textdecoder@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-13.5.6.tgz#a9c37f1033e41747856674d47ce149f71a0cbb1b" + integrity sha512-jTGeYCxFh89KRrP7bNj1CPqKO36Onsi0iA6A+5YtRS5wjdQU+/OFM/EHLTP2nvkvZo/tOkOewMR9sausisUvVQ== dependencies: - "@polkadot/x-global" "13.5.4" + "@polkadot/x-global" "13.5.6" tslib "^2.8.0" -"@polkadot/x-textencoder@13.5.4": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-13.5.4.tgz" - integrity sha512-GQ4kVJLtiirjI3NAKCnXCSIRudpTKog5SFPqouImV4X5rSsxnLf2xOqLwgYobdv3SIpTHBA1vy2RpQqUQUF6vw== +"@polkadot/x-textencoder@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-13.5.6.tgz#e6468a0a97a0cb9e64363aae35e932baad1abe37" + integrity sha512-iVwz9+OrYCEF9QbNfr9M206mmWvY/AhDmGPfAIeTR4fRgKGVYqcP8RIF8iu/x0MVQWqiVO3vlhlUk7MfrmAnoQ== dependencies: - "@polkadot/x-global" "13.5.4" + "@polkadot/x-global" "13.5.6" tslib "^2.8.0" -"@polkadot/x-ws@^13.2.3": - version "13.5.4" - resolved "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-13.5.4.tgz" - integrity sha512-tznbRjPnb3QW8v6+7zUoJINL84DW2dHJjwd0rkU0dtwzc9Y92faxz3bgOrCpgC2oVDpyUUg2PsyjokVBQHqLSA== +"@polkadot/x-ws@^13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-13.5.6.tgz#394bc6c5408e2cecbd8742c883c1b73ce1b23258" + integrity sha512-247ktVp/iE57NTXjFpHaoPoDcvoEPb8+16r2Eq0IBQ2umOV7P6KmxvdNx5eFUvRsgXvBpNwUXE1WVnXjK/eDtA== dependencies: - "@polkadot/x-global" "13.5.4" + "@polkadot/x-global" "13.5.6" tslib "^2.8.0" ws "^8.18.0" @@ -1012,111 +888,221 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz#731df27dfdb77189547bcef96ada7bf166bbb2fb" integrity sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw== +"@rollup/rollup-android-arm-eabi@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.50.0.tgz#939c1be9625d428d8513e4ab60d406fe8db23718" + integrity sha512-lVgpeQyy4fWN5QYebtW4buT/4kn4p4IJ+kDNB4uYNT5b8c8DLJDg6titg20NIg7E8RWwdWZORW6vUFfrLyG3KQ== + "@rollup/rollup-android-arm64@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz#4bea6db78e1f6927405df7fe0faf2f5095e01343" integrity sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q== +"@rollup/rollup-android-arm64@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.50.0.tgz#b74005775903f7a8f4e363d2840c1dcef3776ff3" + integrity sha512-2O73dR4Dc9bp+wSYhviP6sDziurB5/HCym7xILKifWdE9UsOe2FtNcM+I4xZjKrfLJnq5UR8k9riB87gauiQtw== + "@rollup/rollup-darwin-arm64@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz#a7aab77d44be3c44a20f946e10160f84e5450e7f" integrity sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q== +"@rollup/rollup-darwin-arm64@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.50.0.tgz#8c04603cdcf1ec0cd6b27152b3827e49295f2962" + integrity sha512-vwSXQN8T4sKf1RHr1F0s98Pf8UPz7pS6P3LG9NSmuw0TVh7EmaE+5Ny7hJOZ0M2yuTctEsHHRTMi2wuHkdS6Hg== + "@rollup/rollup-darwin-x64@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz#c572c024b57ee8ddd1b0851703ace9eb6cc0dd82" integrity sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw== +"@rollup/rollup-darwin-x64@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.50.0.tgz#19ec976f1cc663def2692cd7ffb32981f2b0b733" + integrity sha512-cQp/WG8HE7BCGyFVuzUg0FNmupxC+EPZEwWu2FCGGw5WDT1o2/YlENbm5e9SMvfDFR6FRhVCBePLqj0o8MN7Vw== + "@rollup/rollup-freebsd-arm64@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz#cf74f8113b5a83098a5c026c165742277cbfb88b" integrity sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA== +"@rollup/rollup-freebsd-arm64@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.50.0.tgz#a96b4ad8346229f6fcbd9d57f1c53040b037c2da" + integrity sha512-UR1uTJFU/p801DvvBbtDD7z9mQL8J80xB0bR7DqW7UGQHRm/OaKzp4is7sQSdbt2pjjSS72eAtRh43hNduTnnQ== + "@rollup/rollup-freebsd-x64@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz#39561f3a2f201a4ad6a01425b1ff5928154ecd7c" integrity sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q== +"@rollup/rollup-freebsd-x64@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.50.0.tgz#fa565a282bc57967ee6668607b181678bdd74e4a" + integrity sha512-G/DKyS6PK0dD0+VEzH/6n/hWDNPDZSMBmqsElWnCRGrYOb2jC0VSupp7UAHHQ4+QILwkxSMaYIbQ72dktp8pKA== + "@rollup/rollup-linux-arm-gnueabihf@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz#980d6061e373bfdaeb67925c46d2f8f9b3de537f" integrity sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g== +"@rollup/rollup-linux-arm-gnueabihf@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.50.0.tgz#dfc88f7295e1f98d77f25296be787e8a5d6ced75" + integrity sha512-u72Mzc6jyJwKjJbZZcIYmd9bumJu7KNmHYdue43vT1rXPm2rITwmPWF0mmPzLm9/vJWxIRbao/jrQmxTO0Sm9w== + "@rollup/rollup-linux-arm-musleabihf@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz#f91a90f30dc00d5a64ac2d9bbedc829cd3cfaa78" integrity sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA== +"@rollup/rollup-linux-arm-musleabihf@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.50.0.tgz#32cd70c87455ca031f0361090cf17da5a2ef66d5" + integrity sha512-S4UefYdV0tnynDJV1mdkNawp0E5Qm2MtSs330IyHgaccOFrwqsvgigUD29uT+B/70PDY1eQ3t40+xf6wIvXJyg== + "@rollup/rollup-linux-arm64-gnu@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz#fac700fa5c38bc13a0d5d34463133093da4c92a0" integrity sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A== +"@rollup/rollup-linux-arm64-gnu@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.50.0.tgz#0e7e1fe7241e3384f6c6b4ccdbcfa8ad8c78b869" + integrity sha512-1EhkSvUQXJsIhk4msxP5nNAUWoB4MFDHhtc4gAYvnqoHlaL9V3F37pNHabndawsfy/Tp7BPiy/aSa6XBYbaD1g== + "@rollup/rollup-linux-arm64-musl@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz#f50ecccf8c78841ff6df1706bc4782d7f62bf9c3" integrity sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q== +"@rollup/rollup-linux-arm64-musl@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.50.0.tgz#5d421f2f3e4a84786c4dfd9ce97e595c9b59e7f4" + integrity sha512-EtBDIZuDtVg75xIPIK1l5vCXNNCIRM0OBPUG+tbApDuJAy9mKago6QxX+tfMzbCI6tXEhMuZuN1+CU8iDW+0UQ== + "@rollup/rollup-linux-loongarch64-gnu@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz#5869dc0b28242da6553e2b52af41374f4038cd6e" integrity sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ== +"@rollup/rollup-linux-loongarch64-gnu@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.50.0.tgz#a0fb5c7d0e88319e18acfd9436f19ee39354b027" + integrity sha512-BGYSwJdMP0hT5CCmljuSNx7+k+0upweM2M4YGfFBjnFSZMHOLYR0gEEj/dxyYJ6Zc6AiSeaBY8dWOa11GF/ppQ== + "@rollup/rollup-linux-powerpc64le-gnu@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz#5cdd9f851ce1bea33d6844a69f9574de335f20b1" integrity sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw== +"@rollup/rollup-linux-ppc64-gnu@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.50.0.tgz#a65b598af12f25210c3295da551a6e3616ea488d" + integrity sha512-I1gSMzkVe1KzAxKAroCJL30hA4DqSi+wGc5gviD0y3IL/VkvcnAqwBf4RHXHyvH66YVHxpKO8ojrgc4SrWAnLg== + "@rollup/rollup-linux-riscv64-gnu@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz#ef5dc37f4388f5253f0def43e1440ec012af204d" integrity sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw== +"@rollup/rollup-linux-riscv64-gnu@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.50.0.tgz#10ba776214ae2857c5bf4389690dabb2fbaf7d98" + integrity sha512-bSbWlY3jZo7molh4tc5dKfeSxkqnf48UsLqYbUhnkdnfgZjgufLS/NTA8PcP/dnvct5CCdNkABJ56CbclMRYCA== + +"@rollup/rollup-linux-riscv64-musl@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.50.0.tgz#c2a46cbaa329d5f21e5808f5a66bb9c78cf68aac" + integrity sha512-LSXSGumSURzEQLT2e4sFqFOv3LWZsEF8FK7AAv9zHZNDdMnUPYH3t8ZlaeYYZyTXnsob3htwTKeWtBIkPV27iQ== + "@rollup/rollup-linux-s390x-gnu@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz#7dbc3ccbcbcfb3e65be74538dfb6e8dd16178fde" integrity sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA== +"@rollup/rollup-linux-s390x-gnu@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.50.0.tgz#a07447be069d64462e30c66611be20c4513963ed" + integrity sha512-CxRKyakfDrsLXiCyucVfVWVoaPA4oFSpPpDwlMcDFQvrv3XY6KEzMtMZrA+e/goC8xxp2WSOxHQubP8fPmmjOQ== + "@rollup/rollup-linux-x64-gnu@4.34.8": version "4.34.8" resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz" integrity sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA== +"@rollup/rollup-linux-x64-gnu@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.50.0.tgz#8887c58bd51242754ae9c56947d6e883332dcc74" + integrity sha512-8PrJJA7/VU8ToHVEPu14FzuSAqVKyo5gg/J8xUerMbyNkWkO9j2ExBho/68RnJsMGNJq4zH114iAttgm7BZVkA== + "@rollup/rollup-linux-x64-musl@4.34.8": version "4.34.8" resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz" integrity sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ== +"@rollup/rollup-linux-x64-musl@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.50.0.tgz#6403fda72a2b3b9fbbeeff93d14f1c45ef9775f3" + integrity sha512-SkE6YQp+CzpyOrbw7Oc4MgXFvTw2UIBElvAvLCo230pyxOLmYwRPwZ/L5lBe/VW/qT1ZgND9wJfOsdy0XptRvw== + +"@rollup/rollup-openharmony-arm64@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.50.0.tgz#52809afccaff47e731b965a0c16e5686be819d5f" + integrity sha512-PZkNLPfvXeIOgJWA804zjSFH7fARBBCpCXxgkGDRjjAhRLOR8o0IGS01ykh5GYfod4c2yiiREuDM8iZ+pVsT+Q== + "@rollup/rollup-win32-arm64-msvc@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz#cbfee01f1fe73791c35191a05397838520ca3cdd" integrity sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ== +"@rollup/rollup-win32-arm64-msvc@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.50.0.tgz#23fe00ddbb40b27a3889bc1e99e6310d97353ad5" + integrity sha512-q7cIIdFvWQoaCbLDUyUc8YfR3Jh2xx3unO8Dn6/TTogKjfwrax9SyfmGGK6cQhKtjePI7jRfd7iRYcxYs93esg== + "@rollup/rollup-win32-ia32-msvc@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz#95cdbdff48fe6c948abcf6a1d500b2bd5ce33f62" integrity sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w== +"@rollup/rollup-win32-ia32-msvc@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.50.0.tgz#520b588076b593413d919912d69dfd5728a1f305" + integrity sha512-XzNOVg/YnDOmFdDKcxxK410PrcbcqZkBmz+0FicpW5jtjKQxcW1BZJEQOF0NJa6JO7CZhett8GEtRN/wYLYJuw== + "@rollup/rollup-win32-x64-msvc@4.34.8": version "4.34.8" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz#4cdb2cfae69cdb7b1a3cc58778e820408075e928" integrity sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g== +"@rollup/rollup-win32-x64-msvc@4.50.0": + version "4.50.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.50.0.tgz#d81efe6a12060c7feddf9805e2a94c3ab0679f48" + integrity sha512-xMmiWRR8sp72Zqwjgtf3QbZfF1wdh8X2ABu3EaozvZcyHJeU0r+XAnXdKgs4cCAp6ORoYoCygipYP1mjmbjrsg== + "@rx-state/core@^0.1.4": version "0.1.4" resolved "https://registry.npmjs.org/@rx-state/core/-/core-0.1.4.tgz" integrity sha512-Z+3hjU2xh1HisLxt+W5hlYX/eGSDaXXP+ns82gq/PLZpkXLu0uwcNUh9RLY3Clq4zT+hSsA3vcpIGt6+UAb8rQ== -"@scure/base@^1.1.1", "@scure/base@^1.1.7", "@scure/base@^1.2.1", "@scure/base@^1.2.4", "@scure/base@~1.2.2", "@scure/base@~1.2.4": - version "1.2.5" - resolved "https://registry.npmjs.org/@scure/base/-/base-1.2.5.tgz" - integrity sha512-9rE6EOVeIQzt5TSu4v+K523F8u6DhBsoZWPGKlnCshhlDhy0kJzUX4V+tr2dWmzF1GdekvThABoEQBGBQI7xZw== - -"@scure/base@^1.2.6": +"@scure/base@^1.1.1", "@scure/base@^1.1.7", "@scure/base@^1.2.6": version "1.2.6" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.2.6.tgz#ca917184b8231394dd8847509c67a0be522e59f6" integrity sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg== +"@scure/base@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-2.0.0.tgz#ba6371fddf92c2727e88ad6ab485db6e624f9a98" + integrity sha512-3E1kpuZginKkek01ovG8krQ0Z44E3DHPjc5S2rjJw9lZn3KSQOs8S7wqikF/AH7iRanHypj85uGyxk0XAyC37w== + +"@scure/base@~1.2.2", "@scure/base@~1.2.4": + version "1.2.5" + resolved "https://registry.npmjs.org/@scure/base/-/base-1.2.5.tgz" + integrity sha512-9rE6EOVeIQzt5TSu4v+K523F8u6DhBsoZWPGKlnCshhlDhy0kJzUX4V+tr2dWmzF1GdekvThABoEQBGBQI7xZw== + "@scure/bip32@1.6.2", "@scure/bip32@^1.5.0": version "1.6.2" resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.6.2.tgz" @@ -1134,6 +1120,14 @@ "@noble/hashes" "~1.7.1" "@scure/base" "~1.2.4" +"@scure/sr25519@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@scure/sr25519/-/sr25519-0.3.0.tgz#1fb075ef05086c1dc59f16bdda1327627a552352" + integrity sha512-SKsinX2sImunfcsH3seGrwH/OayBwwaJqVN8J1cJBNRCfbBq5q0jyTKGa9PcW1HWv9vXT6Yuq41JsxFLvF59ew== + dependencies: + "@noble/curves" "~2.0.0" + "@noble/hashes" "~2.0.0" + "@sec-ant/readable-stream@^0.4.1": version "0.4.1" resolved "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz" @@ -1146,17 +1140,17 @@ "@substrate/connect-extension-protocol@^2.0.0": version "2.2.2" - resolved "https://registry.npmjs.org/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.2.2.tgz" + resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.2.2.tgz#2cf8f2eaf1879308d307a1a08df83cd5db918fe0" integrity sha512-t66jwrXA0s5Goq82ZtjagLNd7DPGCNjHeehRlE/gcJmJ+G56C0W+2plqOMRicJ8XGR1/YFnUSEqUFiSNbjGrAA== "@substrate/connect-known-chains@^1.1.5": version "1.10.3" - resolved "https://registry.npmjs.org/@substrate/connect-known-chains/-/connect-known-chains-1.10.3.tgz" + resolved "https://registry.yarnpkg.com/@substrate/connect-known-chains/-/connect-known-chains-1.10.3.tgz#71a89864f13626c412fa0a9d0ffc4f6ca39fdcec" integrity sha512-OJEZO1Pagtb6bNE3wCikc2wrmvEU5x7GxFFLqqbz1AJYYxSlrPCGu4N2og5YTExo4IcloNMQYFRkBGue0BKZ4w== "@substrate/connect@0.8.11": version "0.8.11" - resolved "https://registry.npmjs.org/@substrate/connect/-/connect-0.8.11.tgz" + resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.8.11.tgz#983ec69a05231636e217b573b8130a6b942af69f" integrity sha512-ofLs1PAO9AtDdPbdyTYj217Pe+lBfTLltdHDs3ds8no0BseoLeAGxpz1mHfi7zB4IxI3YyAiLjH6U8cw4pj4Nw== dependencies: "@substrate/connect-extension-protocol" "^2.0.0" @@ -1166,7 +1160,7 @@ "@substrate/light-client-extension-helpers@^1.0.0": version "1.0.0" - resolved "https://registry.npmjs.org/@substrate/light-client-extension-helpers/-/light-client-extension-helpers-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/@substrate/light-client-extension-helpers/-/light-client-extension-helpers-1.0.0.tgz#7b60368c57e06e5cf798c6557422d12e6d81f1ff" integrity sha512-TdKlni1mBBZptOaeVrKnusMg/UBpWUORNDv5fdCaJklP4RJiFOzBCrzC+CyVI5kQzsXBisZ+2pXm+rIjS38kHg== dependencies: "@polkadot-api/json-rpc-provider" "^0.0.1" @@ -1179,7 +1173,7 @@ "@substrate/ss58-registry@^1.51.0": version "1.51.0" - resolved "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.51.0.tgz" + resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.51.0.tgz#39e0341eb4069c2d3e684b93f0d8cb0bec572383" integrity sha512-TWDurLiPxndFgKjVavCniytBIw+t4ViOi7TYp9h/D0NMmkEc9klFTo+827eyEJ0lELpqO207Ey7uGxUa+BS1jQ== "@tsconfig/node10@^1.0.7": @@ -1204,7 +1198,7 @@ "@types/bn.js@^5.1.6": version "5.2.0" - resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.2.0.tgz" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.2.0.tgz#4349b9710e98f9ab3cdc50f1c5e4dcbd8ef29c80" integrity sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q== dependencies: "@types/node" "*" @@ -1233,6 +1227,11 @@ resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz" integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== +"@types/estree@1.0.8": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" + integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== + "@types/mocha@^10.0.10": version "10.0.10" resolved "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz" @@ -1259,6 +1258,13 @@ dependencies: undici-types "~6.21.0" +"@types/node@^22.18.0": + version "22.18.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.18.0.tgz#9e4709be4f104e3568f7dd1c71e2949bf147a47b" + integrity sha512-m5ObIqwsUp6BZzyiy4RdZpzWGub9bqLJMvZDD0QMXhxjqMHMENlj+SqF5QxoUwaQNFe+8kz8XM8ZQhqkQPTgMQ== + dependencies: + undici-types "~6.21.0" + "@types/node@^24.0.14": version "24.2.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-24.2.0.tgz#cde712f88c5190006d6b069232582ecd1f94a760" @@ -1361,11 +1367,6 @@ assert@^2.1.0: object.assign "^4.1.4" util "^0.12.5" -assertion-error@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz" - integrity sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA== - available-typed-arrays@^1.0.7: version "1.0.7" resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz" @@ -1385,7 +1386,7 @@ binary-extensions@^2.0.0: bn.js@^5.2.1: version "5.2.2" - resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.2.tgz" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.2.tgz#82c09f9ebbb17107cd72cb7fd39bd1f9d0aaa566" integrity sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw== brace-expansion@^2.0.1: @@ -1458,16 +1459,10 @@ camelcase@^6.0.0: resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -chai@^5.2.0: - version "5.2.0" - resolved "https://registry.npmjs.org/chai/-/chai-5.2.0.tgz" - integrity sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw== - dependencies: - assertion-error "^2.0.1" - check-error "^2.1.1" - deep-eql "^5.0.1" - loupe "^3.1.0" - pathval "^2.0.0" +chai@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/chai/-/chai-6.0.1.tgz#88c2b4682fb56050647e222d2cf9d6772f2607b3" + integrity sha512-/JOoU2//6p5vCXh00FpNgtlw0LjvhGttaWc+y7wpW9yjBm3ys0dI8tSKZxIOgNruz5J0RleccatSIC3uxEZP0g== chalk@^4.1.0: version "4.1.2" @@ -1482,11 +1477,6 @@ chalk@^5.3.0: resolved "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz" integrity sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w== -check-error@^2.1.1: - version "2.1.1" - resolved "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz" - integrity sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw== - chokidar@^3.5.3: version "3.6.0" resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz" @@ -1576,17 +1566,19 @@ cross-spawn@^7.0.6: shebang-command "^2.0.0" which "^2.0.1" -crypto@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz" - integrity sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig== - data-uri-to-buffer@^4.0.0: version "4.0.1" - resolved "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== -debug@^4.1.0, debug@^4.3.5, debug@^4.4.0: +debug@^4.1.0: + version "4.4.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" + integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== + dependencies: + ms "^2.1.3" + +debug@^4.3.5, debug@^4.4.0: version "4.4.0" resolved "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz" integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== @@ -1598,11 +1590,6 @@ decamelize@^4.0.0: resolved "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -deep-eql@^5.0.1: - version "5.0.2" - resolved "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz" - integrity sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q== - deepmerge-ts@^7.1.0: version "7.1.5" resolved "https://registry.npmjs.org/deepmerge-ts/-/deepmerge-ts-7.1.5.tgz" @@ -1641,10 +1628,10 @@ diff@^5.2.0: resolved "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz" integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== -dotenv@16.4.7: - version "16.4.7" - resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz" - integrity sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ== +dotenv@17.2.1: + version "17.2.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-17.2.1.tgz#6f32e10faf014883515538dc922a0fb8765d9b32" + integrity sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ== dunder-proto@^1.0.1: version "1.0.1" @@ -1692,35 +1679,6 @@ es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: dependencies: es-errors "^1.3.0" -esbuild@^0.21.3: - version "0.21.5" - resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz" - integrity sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw== - optionalDependencies: - "@esbuild/aix-ppc64" "0.21.5" - "@esbuild/android-arm" "0.21.5" - "@esbuild/android-arm64" "0.21.5" - "@esbuild/android-x64" "0.21.5" - "@esbuild/darwin-arm64" "0.21.5" - "@esbuild/darwin-x64" "0.21.5" - "@esbuild/freebsd-arm64" "0.21.5" - "@esbuild/freebsd-x64" "0.21.5" - "@esbuild/linux-arm" "0.21.5" - "@esbuild/linux-arm64" "0.21.5" - "@esbuild/linux-ia32" "0.21.5" - "@esbuild/linux-loong64" "0.21.5" - "@esbuild/linux-mips64el" "0.21.5" - "@esbuild/linux-ppc64" "0.21.5" - "@esbuild/linux-riscv64" "0.21.5" - "@esbuild/linux-s390x" "0.21.5" - "@esbuild/linux-x64" "0.21.5" - "@esbuild/netbsd-x64" "0.21.5" - "@esbuild/openbsd-x64" "0.21.5" - "@esbuild/sunos-x64" "0.21.5" - "@esbuild/win32-arm64" "0.21.5" - "@esbuild/win32-ia32" "0.21.5" - "@esbuild/win32-x64" "0.21.5" - esbuild@^0.25.0: version "0.25.5" resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz" @@ -1803,9 +1761,14 @@ fdir@^6.4.4: resolved "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz" integrity sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg== +fdir@^6.5.0: + version "6.5.0" + resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.5.0.tgz#ed2ab967a331ade62f18d077dae192684d50d350" + integrity sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg== + fetch-blob@^3.1.2, fetch-blob@^3.1.4: version "3.2.0" - resolved "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz" + resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== dependencies: node-domexception "^1.0.0" @@ -1864,7 +1827,7 @@ foreground-child@^3.1.0: formdata-polyfill@^4.0.10: version "4.0.10" - resolved "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz" + resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== dependencies: fetch-blob "^3.1.2" @@ -2163,7 +2126,7 @@ js-yaml@^4.1.0: json-stringify-safe@^5.0.1: version "5.0.1" - resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== lilconfig@^3.1.1: @@ -2209,11 +2172,6 @@ log-symbols@^6.0.0: chalk "^5.3.0" is-unicode-supported "^1.3.0" -loupe@^3.1.0: - version "3.1.3" - resolved "https://registry.npmjs.org/loupe/-/loupe-3.1.3.tgz" - integrity sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug== - lru-cache@^10.0.1, lru-cache@^10.2.0: version "10.4.3" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz" @@ -2236,14 +2194,6 @@ math-intrinsics@^1.1.0: resolved "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz" integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== -micro-sr25519@^0.1.0: - version "0.1.0" - resolved "https://registry.npmjs.org/micro-sr25519/-/micro-sr25519-0.1.0.tgz" - integrity sha512-at5zfxiKNhh07v4GPb8Sc6wCW+jd18FMMgPM0ACIQMcgvMfB9a34mfOlXr5B04J4yFZ6imlvJfRaFbOxMA7ytw== - dependencies: - "@noble/curves" "~1.7.0" - "@noble/hashes" "~1.6.0" - mimic-function@^5.0.0: version "5.0.1" resolved "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz" @@ -2306,7 +2256,7 @@ mocha@^11.1.0: mock-socket@^9.3.1: version "9.3.1" - resolved "https://registry.npmjs.org/mock-socket/-/mock-socket-9.3.1.tgz" + resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.3.1.tgz#24fb00c2f573c84812aa4a24181bb025de80cc8e" integrity sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw== ms@^2.1.3: @@ -2323,14 +2273,14 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nanoid@^3.3.8: - version "3.3.8" - resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz" - integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w== +nanoid@^3.3.11: + version "3.3.11" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b" + integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w== nock@^13.5.5: version "13.5.6" - resolved "https://registry.npmjs.org/nock/-/nock-13.5.6.tgz" + resolved "https://registry.yarnpkg.com/nock/-/nock-13.5.6.tgz#5e693ec2300bbf603b61dae6df0225673e6c4997" integrity sha512-o2zOYiCpzRqSzPj0Zt/dQ/DqZeYoaQ7TUonc/xUPjCGl9WeHpNbxgVvOquXYAaJzI0M9BXV3HTzG0p8IUAbBTQ== dependencies: debug "^4.1.0" @@ -2339,12 +2289,12 @@ nock@^13.5.5: node-domexception@^1.0.0: version "1.0.0" - resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== node-fetch@^3.3.2: version "3.3.2" - resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b" integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== dependencies: data-uri-to-buffer "^4.0.0" @@ -2499,11 +2449,6 @@ pathe@^2.0.1: resolved "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz" integrity sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w== -pathval@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz" - integrity sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA== - picocolors@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz" @@ -2519,6 +2464,11 @@ picomatch@^4.0.2: resolved "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz" integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== +picomatch@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.3.tgz#796c76136d1eead715db1e7bad785dedd695a042" + integrity sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q== + pirates@^4.0.1: version "4.0.7" resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz" @@ -2570,12 +2520,12 @@ postcss-load-config@^6.0.1: dependencies: lilconfig "^3.1.1" -postcss@^8.4.43: - version "8.5.3" - resolved "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz" - integrity sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A== +postcss@^8.5.6: + version "8.5.6" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.6.tgz#2825006615a619b4f62a9e7426cc120b349a8f3c" + integrity sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg== dependencies: - nanoid "^3.3.8" + nanoid "^3.3.11" picocolors "^1.1.1" source-map-js "^1.2.1" @@ -2593,7 +2543,7 @@ pretty-ms@^9.2.0: propagate@^2.0.0: version "2.0.1" - resolved "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz" + resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45" integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag== punycode@^2.1.0: @@ -2649,7 +2599,7 @@ restore-cursor@^5.0.0: onetime "^7.0.0" signal-exit "^4.1.0" -rollup@^4.20.0, rollup@^4.34.8: +rollup@^4.34.8: version "4.34.8" resolved "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz" integrity sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ== @@ -2677,9 +2627,39 @@ rollup@^4.20.0, rollup@^4.34.8: "@rollup/rollup-win32-x64-msvc" "4.34.8" fsevents "~2.3.2" +rollup@^4.43.0: + version "4.50.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.50.0.tgz#6f237f598b7163ede33ce827af8534c929aaa186" + integrity sha512-/Zl4D8zPifNmyGzJS+3kVoyXeDeT/GrsJM94sACNg9RtUE0hrHa1bNPtRSrfHTMH5HjRzce6K7rlTh3Khiw+pw== + dependencies: + "@types/estree" "1.0.8" + optionalDependencies: + "@rollup/rollup-android-arm-eabi" "4.50.0" + "@rollup/rollup-android-arm64" "4.50.0" + "@rollup/rollup-darwin-arm64" "4.50.0" + "@rollup/rollup-darwin-x64" "4.50.0" + "@rollup/rollup-freebsd-arm64" "4.50.0" + "@rollup/rollup-freebsd-x64" "4.50.0" + "@rollup/rollup-linux-arm-gnueabihf" "4.50.0" + "@rollup/rollup-linux-arm-musleabihf" "4.50.0" + "@rollup/rollup-linux-arm64-gnu" "4.50.0" + "@rollup/rollup-linux-arm64-musl" "4.50.0" + "@rollup/rollup-linux-loongarch64-gnu" "4.50.0" + "@rollup/rollup-linux-ppc64-gnu" "4.50.0" + "@rollup/rollup-linux-riscv64-gnu" "4.50.0" + "@rollup/rollup-linux-riscv64-musl" "4.50.0" + "@rollup/rollup-linux-s390x-gnu" "4.50.0" + "@rollup/rollup-linux-x64-gnu" "4.50.0" + "@rollup/rollup-linux-x64-musl" "4.50.0" + "@rollup/rollup-openharmony-arm64" "4.50.0" + "@rollup/rollup-win32-arm64-msvc" "4.50.0" + "@rollup/rollup-win32-ia32-msvc" "4.50.0" + "@rollup/rollup-win32-x64-msvc" "4.50.0" + fsevents "~2.3.2" + rxjs@^7.8.1, rxjs@^7.8.2: version "7.8.2" - resolved "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.2.tgz#955bc473ed8af11a002a2be52071bf475638607b" integrity sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA== dependencies: tslib "^2.1.0" @@ -2746,7 +2726,7 @@ signal-exit@^4.0.1, signal-exit@^4.1.0: smoldot@2.0.26: version "2.0.26" - resolved "https://registry.npmjs.org/smoldot/-/smoldot-2.0.26.tgz" + resolved "https://registry.yarnpkg.com/smoldot/-/smoldot-2.0.26.tgz#0e64c7fcd26240fbe4c8d6b6e4b9a9aca77e00f6" integrity sha512-F+qYmH4z2s2FK+CxGj8moYcd1ekSIKH8ywkdqlOz88Dat35iB1DIYL11aILN46YSGMzQW/lbJNS307zBSDN5Ig== dependencies: ws "^8.8.1" @@ -2921,7 +2901,7 @@ tinyexec@^0.3.2: resolved "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz" integrity sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA== -tinyglobby@^0.2.11: +tinyglobby@^0.2.11, tinyglobby@^0.2.14: version "0.2.14" resolved "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz" integrity sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ== @@ -2982,7 +2962,7 @@ tslib@2.7.0: resolved "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz" integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== -tslib@^2.1.0, tslib@^2.7.0, tslib@^2.8.0: +tslib@^2.1.0, tslib@^2.7.0, tslib@^2.8.0, tslib@^2.8.1: version "2.8.1" resolved "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== @@ -3088,20 +3068,23 @@ viem@2.23.4: ox "0.6.7" ws "8.18.0" -vite@^5.4.8: - version "5.4.14" - resolved "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz" - integrity sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA== +vite@^7.1.4: + version "7.1.4" + resolved "https://registry.yarnpkg.com/vite/-/vite-7.1.4.tgz#354944affb55e1aff0157406b74e0d0a3232df9a" + integrity sha512-X5QFK4SGynAeeIt+A7ZWnApdUyHYm+pzv/8/A57LqSGcI88U6R6ipOs3uCesdc6yl7nl+zNO0t8LmqAdXcQihw== dependencies: - esbuild "^0.21.3" - postcss "^8.4.43" - rollup "^4.20.0" + esbuild "^0.25.0" + fdir "^6.5.0" + picomatch "^4.0.3" + postcss "^8.5.6" + rollup "^4.43.0" + tinyglobby "^0.2.14" optionalDependencies: fsevents "~2.3.3" web-streams-polyfill@^3.0.3: version "3.3.3" - resolved "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== webidl-conversions@^4.0.2: diff --git a/pallets/admin-utils/src/benchmarking.rs b/pallets/admin-utils/src/benchmarking.rs index 61df5d55f8..c824a879a5 100644 --- a/pallets/admin-utils/src/benchmarking.rs +++ b/pallets/admin-utils/src/benchmarking.rs @@ -266,7 +266,7 @@ mod benchmarks { ); #[extrinsic_call] - _(RawOrigin::Root, 1u16.into()/*netuid*/, 10.into()/*max_burn*/)/*sudo_set_max_burn*/; + _(RawOrigin::Root, 1u16.into()/*netuid*/, 2_000_000_000.into()/*max_burn*/)/*sudo_set_max_burn*/; } #[benchmark] @@ -346,5 +346,16 @@ mod benchmarks { _(RawOrigin::Root, 5u16/*version*/)/*sudo_set_commit_reveal_version()*/; } + #[benchmark] + fn sudo_set_owner_immune_neuron_limit() { + pallet_subtensor::Pallet::::init_new_network( + 1u16.into(), /*netuid*/ + 1u16, /*sudo_tempo*/ + ); + + #[extrinsic_call] + _(RawOrigin::Root, 1u16.into()/*netuid*/, 5u16/*immune_neurons*/)/*sudo_set_owner_immune_neuron_limit()*/; + } + //impl_benchmark_test_suite!(AdminUtils, crate::mock::new_test_ext(), crate::mock::Test); } diff --git a/pallets/admin-utils/src/lib.rs b/pallets/admin-utils/src/lib.rs index 03a20a5f21..2a785d7c88 100644 --- a/pallets/admin-utils/src/lib.rs +++ b/pallets/admin-utils/src/lib.rs @@ -107,6 +107,8 @@ pub mod pallet { BondsMovingAverageMaxReached, /// Only root can set negative sigmoid steepness values NegativeSigmoidSteepness, + /// Value not in allowed bounds. + ValueNotInBounds, } /// Enum for specifying the type of precompile operation. #[derive( @@ -376,13 +378,11 @@ pub mod pallet { /// It is only callable by the root account or subnet owner. /// The extrinsic will call the Subtensor pallet to set the adjustment alpha. #[pallet::call_index(9)] - #[pallet::weight(( + #[pallet::weight( Weight::from_parts(14_000_000, 0) .saturating_add(::DbWeight::get().writes(1)) - .saturating_add(::DbWeight::get().reads(1)), - DispatchClass::Operational, - Pays::No - ))] + .saturating_add(::DbWeight::get().reads(1)) + )] pub fn sudo_set_adjustment_alpha( origin: OriginFor, netuid: NetUid, @@ -602,12 +602,10 @@ pub mod pallet { /// It is only callable by the root account or subnet owner. /// The extrinsic will call the Subtensor pallet to set the network PoW registration allowed. #[pallet::call_index(20)] - #[pallet::weight(( + #[pallet::weight( Weight::from_parts(14_000_000, 0) - .saturating_add(::DbWeight::get().writes(1)), - DispatchClass::Operational, - Pays::No - ))] + .saturating_add(::DbWeight::get().writes(1)) + )] pub fn sudo_set_network_pow_registration_allowed( origin: OriginFor, netuid: NetUid, @@ -654,46 +652,62 @@ pub mod pallet { } /// The extrinsic sets the minimum burn for a subnet. - /// It is only callable by the root account. + /// It is only callable by root and subnet owner. /// The extrinsic will call the Subtensor pallet to set the minimum burn. #[pallet::call_index(22)] - #[pallet::weight(Weight::from_parts(15_440_000, 0) - .saturating_add(::DbWeight::get().reads(1_u64)) + #[pallet::weight(Weight::from_parts(18_870_000, 0) + .saturating_add(::DbWeight::get().reads(2_u64)) .saturating_add(::DbWeight::get().writes(1_u64)))] pub fn sudo_set_min_burn( origin: OriginFor, netuid: NetUid, min_burn: TaoCurrency, ) -> DispatchResult { - ensure_root(origin)?; - + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin.clone(), netuid)?; ensure!( pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); + ensure!( + min_burn < T::MinBurnUpperBound::get(), + Error::::ValueNotInBounds + ); + // Min burn must be less than max burn + ensure!( + min_burn < pallet_subtensor::Pallet::::get_max_burn(netuid), + Error::::ValueNotInBounds + ); pallet_subtensor::Pallet::::set_min_burn(netuid, min_burn); log::debug!("MinBurnSet( netuid: {netuid:?} min_burn: {min_burn:?} ) "); Ok(()) } /// The extrinsic sets the maximum burn for a subnet. - /// It is only callable by the root account or subnet owner. + /// It is only callable by root and subnet owner. /// The extrinsic will call the Subtensor pallet to set the maximum burn. #[pallet::call_index(23)] - #[pallet::weight(Weight::from_parts(15_940_000, 0) - .saturating_add(::DbWeight::get().reads(1_u64)) + #[pallet::weight(Weight::from_parts(19_420_000, 0) + .saturating_add(::DbWeight::get().reads(2_u64)) .saturating_add(::DbWeight::get().writes(1_u64)))] pub fn sudo_set_max_burn( origin: OriginFor, netuid: NetUid, max_burn: TaoCurrency, ) -> DispatchResult { - ensure_root(origin)?; - + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin.clone(), netuid)?; ensure!( pallet_subtensor::Pallet::::if_subnet_exist(netuid), Error::::SubnetDoesNotExist ); + ensure!( + max_burn > T::MaxBurnLowerBound::get(), + Error::::ValueNotInBounds + ); + // Max burn must be greater than min burn + ensure!( + max_burn > pallet_subtensor::Pallet::::get_min_burn(netuid), + Error::::ValueNotInBounds + ); pallet_subtensor::Pallet::::set_max_burn(netuid, max_burn); log::debug!("MaxBurnSet( netuid: {netuid:?} max_burn: {max_burn:?} ) "); Ok(()) @@ -957,21 +971,6 @@ pub mod pallet { Ok(()) } - /// The extrinsic sets the subnet limit for the network. - /// It is only callable by the root account. - /// The extrinsic will call the Subtensor pallet to set the subnet limit. - #[pallet::call_index(37)] - #[pallet::weight(( - Weight::from_parts(14_000_000, 0) - .saturating_add(::DbWeight::get().writes(1)), - DispatchClass::Operational, - Pays::No - ))] - pub fn sudo_set_subnet_limit(origin: OriginFor, _max_subnets: u16) -> DispatchResult { - ensure_root(origin)?; - Ok(()) - } - /// The extrinsic sets the lock reduction interval for the network. /// It is only callable by the root account. /// The extrinsic will call the Subtensor pallet to set the lock reduction interval. @@ -1076,26 +1075,6 @@ pub mod pallet { Ok(()) } - // The extrinsic sets the target stake per interval. - // It is only callable by the root account. - // The extrinsic will call the Subtensor pallet to set target stake per interval. - // #[pallet::call_index(47)] - // #[pallet::weight((0, DispatchClass::Operational, Pays::No))] - // pub fn sudo_set_target_stakes_per_interval( - // origin: OriginFor, - // target_stakes_per_interval: u64, - // ) -> DispatchResult { - // ensure_root(origin)?; - // pallet_subtensor::Pallet::::set_target_stakes_per_interval( - // target_stakes_per_interval, - // ); - // log::debug!( - // "TxTargetStakesPerIntervalSet( set_target_stakes_per_interval: {:?} ) ", - // target_stakes_per_interval - // ); (DEPRECATED) - // Ok(()) - // } (DEPRECATED) - /// The extrinsic enabled/disables commit/reaveal for a given subnet. /// It is only callable by the root account or subnet owner. /// The extrinsic will call the Subtensor pallet to set the value. @@ -1130,7 +1109,7 @@ pub mod pallet { /// # Weight /// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees. #[pallet::call_index(50)] - #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + #[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights pub fn sudo_set_liquid_alpha_enabled( origin: OriginFor, netuid: NetUid, @@ -1144,7 +1123,7 @@ pub mod pallet { /// Sets values for liquid alpha #[pallet::call_index(51)] - #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + #[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights pub fn sudo_set_alpha_values( origin: OriginFor, netuid: NetUid, @@ -1157,62 +1136,6 @@ pub mod pallet { ) } - // DEPRECATED - // #[pallet::call_index(52)] - // #[pallet::weight((0, DispatchClass::Operational, Pays::No))] - // pub fn sudo_set_hotkey_emission_tempo( - // origin: OriginFor, - // emission_tempo: u64, - // ) -> DispatchResult { - // ensure_root(origin)?; - // pallet_subtensor::Pallet::::set_hotkey_emission_tempo(emission_tempo); - // log::debug!( - // "HotkeyEmissionTempoSet( emission_tempo: {:?} )", - // emission_tempo - // ); - // Ok(()) - // } - - /// Sets the maximum stake allowed for a specific network. - /// - /// This function allows the root account to set the maximum stake for a given network. - /// It updates the network's maximum stake value and logs the change. - /// - /// # Arguments - /// - /// * `origin` - The origin of the call, which must be the root account. - /// * `netuid` - The unique identifier of the network. - /// * `max_stake` - The new maximum stake value to set. - /// - /// # Returns - /// - /// Returns `Ok(())` if the operation is successful, or an error if it fails. - /// - /// # Example - /// - /// - /// # Notes - /// - /// - This function can only be called by the root account. - /// - The `netuid` should correspond to an existing network. - /// - /// # TODO - /// - // - Consider adding a check to ensure the `netuid` corresponds to an existing network. - // - Implement a mechanism to gradually adjust the max stake to prevent sudden changes. - // #[pallet::weight(::WeightInfo::sudo_set_network_max_stake())] - #[pallet::call_index(53)] - #[pallet::weight((0, DispatchClass::Operational, Pays::No))] - pub fn sudo_set_network_max_stake( - origin: OriginFor, - _netuid: NetUid, - _max_stake: u64, - ) -> DispatchResult { - // Ensure the call is made by the root account - ensure_root(origin)?; - Ok(()) - } - /// Sets the duration of the coldkey swap schedule. /// /// This extrinsic allows the root account to set the duration for the coldkey swap schedule. @@ -1379,7 +1302,7 @@ pub mod pallet { /// # Weight /// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees. #[pallet::call_index(61)] - #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + #[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights pub fn sudo_set_toggle_transfer( origin: OriginFor, netuid: NetUid, @@ -1509,7 +1432,7 @@ pub mod pallet { /// # Weight /// Weight is handled by the `#[pallet::weight]` attribute. #[pallet::call_index(68)] - #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + #[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights pub fn sudo_set_alpha_sigmoid_steepness( origin: OriginFor, netuid: NetUid, @@ -1544,7 +1467,7 @@ pub mod pallet { /// # Weight /// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees. #[pallet::call_index(69)] - #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + #[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights pub fn sudo_set_yuma3_enabled( origin: OriginFor, netuid: NetUid, @@ -1568,7 +1491,7 @@ pub mod pallet { /// # Weight /// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees. #[pallet::call_index(70)] - #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + #[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights pub fn sudo_set_bonds_reset_enabled( origin: OriginFor, netuid: NetUid, @@ -1613,7 +1536,7 @@ pub mod pallet { /// # Rate Limiting /// This function is rate-limited to one call per subnet per interval (e.g., one week). #[pallet::call_index(67)] - #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + #[pallet::weight((1_000_000, DispatchClass::Normal, Pays::Yes))] // TODO: add proper weights pub fn sudo_set_sn_owner_hotkey( origin: OriginFor, netuid: NetUid, @@ -1670,8 +1593,8 @@ pub mod pallet { /// Sets the number of immune owner neurons #[pallet::call_index(72)] - #[pallet::weight(Weight::from_parts(15_000_000, 0) - .saturating_add(::DbWeight::get().reads(1_u64)) + #[pallet::weight(Weight::from_parts(4_639_000, 0) + .saturating_add(::DbWeight::get().reads(0_u64)) .saturating_add(::DbWeight::get().writes(1_u64)))] pub fn sudo_set_owner_immune_neuron_limit( origin: OriginFor, @@ -1682,6 +1605,20 @@ pub mod pallet { pallet_subtensor::Pallet::::set_owner_immune_neuron_limit(netuid, immune_neurons)?; Ok(()) } + + /// Sets the childkey burn for a subnet. + /// It is only callable by the root account. + /// The extrinsic will call the Subtensor pallet to set the childkey burn. + #[pallet::call_index(73)] + #[pallet::weight(Weight::from_parts(15_650_000, 0) + .saturating_add(::DbWeight::get().reads(1_u64)) + .saturating_add(::DbWeight::get().writes(1_u64)))] + pub fn sudo_set_ck_burn(origin: OriginFor, burn: u64) -> DispatchResult { + ensure_root(origin)?; + pallet_subtensor::Pallet::::set_ck_burn(burn); + log::debug!("CKBurnSet( burn: {burn:?} ) "); + Ok(()) + } } } diff --git a/pallets/admin-utils/src/tests/mock.rs b/pallets/admin-utils/src/tests/mock.rs index 35934bc846..7bba7929dd 100644 --- a/pallets/admin-utils/src/tests/mock.rs +++ b/pallets/admin-utils/src/tests/mock.rs @@ -19,7 +19,7 @@ use sp_runtime::{ }; use sp_std::cmp::Ordering; use sp_weights::Weight; -use subtensor_runtime_common::NetUid; +use subtensor_runtime_common::{NetUid, TaoCurrency}; type Block = frame_system::mocking::MockBlock; // Configure a mock runtime to test the pallet. @@ -110,6 +110,8 @@ parameter_types! { pub const InitialBurn: u64 = 0; pub const InitialMinBurn: u64 = 500_000; pub const InitialMaxBurn: u64 = 1_000_000_000; + pub const MinBurnUpperBound: TaoCurrency = TaoCurrency::new(1_000_000_000); // 1 TAO + pub const MaxBurnLowerBound: TaoCurrency = TaoCurrency::new(100_000_000); // 0.1 TAO pub const InitialValidatorPruneLen: u64 = 0; pub const InitialScalingLawPower: u16 = 50; pub const InitialMaxAllowedValidators: u16 = 100; @@ -198,6 +200,8 @@ impl pallet_subtensor::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type MinBurnUpperBound = MinBurnUpperBound; + type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; type InitialSenateRequiredStakePercentage = InitialSenateRequiredStakePercentage; type InitialNetworkImmunityPeriod = InitialNetworkImmunityPeriod; @@ -223,6 +227,7 @@ impl pallet_subtensor::Config for Test { type HotkeySwapOnSubnetInterval = HotkeySwapOnSubnetInterval; type ProxyInterface = (); type LeaseDividendsDistributionInterval = LeaseDividendsDistributionInterval; + type GetCommitments = (); } parameter_types! { diff --git a/pallets/admin-utils/src/tests/mod.rs b/pallets/admin-utils/src/tests/mod.rs index 5290d3ddfc..ef36bb7856 100644 --- a/pallets/admin-utils/src/tests/mod.rs +++ b/pallets/admin-utils/src/tests/mod.rs @@ -1227,8 +1227,8 @@ fn test_set_alpha_values_dispatch_info_ok() { let dispatch_info = call.get_dispatch_info(); - assert_eq!(dispatch_info.class, DispatchClass::Operational); - assert_eq!(dispatch_info.pays_fee, Pays::No); + assert_eq!(dispatch_info.class, DispatchClass::Normal); + assert_eq!(dispatch_info.pays_fee, Pays::Yes); }); } @@ -1951,3 +1951,121 @@ fn test_sudo_set_commit_reveal_version() { ); }); } + +#[test] +fn test_sudo_set_min_burn() { + new_test_ext().execute_with(|| { + let netuid = NetUid::from(1); + let to_be_set = TaoCurrency::from(1_000_000); + add_network(netuid, 10); + let init_value = SubtensorModule::get_min_burn(netuid); + + // Simple case + assert_ok!(AdminUtils::sudo_set_min_burn( + <::RuntimeOrigin>::root(), + netuid, + TaoCurrency::from(to_be_set) + )); + assert_ne!(SubtensorModule::get_min_burn(netuid), init_value); + assert_eq!(SubtensorModule::get_min_burn(netuid), to_be_set); + + // Unknown subnet + assert_err!( + AdminUtils::sudo_set_min_burn( + <::RuntimeOrigin>::root(), + NetUid::from(42), + TaoCurrency::from(to_be_set) + ), + Error::::SubnetDoesNotExist + ); + + // Non subnet owner + assert_err!( + AdminUtils::sudo_set_min_burn( + <::RuntimeOrigin>::signed(U256::from(1)), + netuid, + TaoCurrency::from(to_be_set) + ), + DispatchError::BadOrigin + ); + + // Above upper bound + assert_err!( + AdminUtils::sudo_set_min_burn( + <::RuntimeOrigin>::root(), + netuid, + ::MinBurnUpperBound::get() + 1.into() + ), + Error::::ValueNotInBounds + ); + + // Above max burn + assert_err!( + AdminUtils::sudo_set_min_burn( + <::RuntimeOrigin>::root(), + netuid, + SubtensorModule::get_max_burn(netuid) + 1.into() + ), + Error::::ValueNotInBounds + ); + }); +} + +#[test] +fn test_sudo_set_max_burn() { + new_test_ext().execute_with(|| { + let netuid = NetUid::from(1); + let to_be_set = TaoCurrency::from(100_000_001); + add_network(netuid, 10); + let init_value = SubtensorModule::get_max_burn(netuid); + + // Simple case + assert_ok!(AdminUtils::sudo_set_max_burn( + <::RuntimeOrigin>::root(), + netuid, + TaoCurrency::from(to_be_set) + )); + assert_ne!(SubtensorModule::get_max_burn(netuid), init_value); + assert_eq!(SubtensorModule::get_max_burn(netuid), to_be_set); + + // Unknown subnet + assert_err!( + AdminUtils::sudo_set_max_burn( + <::RuntimeOrigin>::root(), + NetUid::from(42), + TaoCurrency::from(to_be_set) + ), + Error::::SubnetDoesNotExist + ); + + // Non subnet owner + assert_err!( + AdminUtils::sudo_set_max_burn( + <::RuntimeOrigin>::signed(U256::from(1)), + netuid, + TaoCurrency::from(to_be_set) + ), + DispatchError::BadOrigin + ); + + // Below lower bound + assert_err!( + AdminUtils::sudo_set_max_burn( + <::RuntimeOrigin>::root(), + netuid, + ::MaxBurnLowerBound::get() - 1.into() + ), + Error::::ValueNotInBounds + ); + + // Below min burn + assert_err!( + AdminUtils::sudo_set_max_burn( + <::RuntimeOrigin>::root(), + netuid, + SubtensorModule::get_min_burn(netuid) - 1.into() + ), + Error::::ValueNotInBounds + ); + }); +} diff --git a/pallets/commitments/Cargo.toml b/pallets/commitments/Cargo.toml index bedc0d945c..d2873673bc 100644 --- a/pallets/commitments/Cargo.toml +++ b/pallets/commitments/Cargo.toml @@ -35,8 +35,6 @@ hex.workspace = true sha2.workspace = true log.workspace = true - -pallet-subtensor.workspace = true subtensor-runtime-common.workspace = true [dev-dependencies] @@ -57,7 +55,6 @@ std = [ "log/std", "pallet-balances/std", "pallet-drand/std", - "pallet-subtensor/std", "rand_chacha/std", "scale-info/std", "sha2/std", @@ -76,7 +73,6 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-drand/runtime-benchmarks", - "pallet-subtensor/runtime-benchmarks", ] try-runtime = [ "frame-support/try-runtime", @@ -84,5 +80,4 @@ try-runtime = [ "pallet-balances/try-runtime", "sp-runtime/try-runtime", "pallet-drand/try-runtime", - "pallet-subtensor/try-runtime", ] diff --git a/pallets/commitments/src/lib.rs b/pallets/commitments/src/lib.rs index 34192b6fa2..6d0d826ab4 100644 --- a/pallets/commitments/src/lib.rs +++ b/pallets/commitments/src/lib.rs @@ -10,15 +10,18 @@ mod mock; pub mod types; pub mod weights; -pub use pallet::*; -pub use types::*; -pub use weights::WeightInfo; - use ark_serialize::CanonicalDeserialize; -use frame_support::{BoundedVec, traits::Currency}; +use codec::Encode; +use frame_support::IterableStorageDoubleMap; +use frame_support::{ + BoundedVec, + traits::{Currency, Get}, +}; +use frame_system::pallet_prelude::BlockNumberFor; +pub use pallet::*; use scale_info::prelude::collections::BTreeSet; use sp_runtime::SaturatedConversion; -use sp_runtime::{Saturating, traits::Zero}; +use sp_runtime::{Saturating, Weight, traits::Zero}; use sp_std::{boxed::Box, vec::Vec}; use subtensor_runtime_common::NetUid; use tle::{ @@ -26,7 +29,9 @@ use tle::{ stream_ciphers::AESGCMStreamCipherProvider, tlock::{TLECiphertext, tld}, }; +pub use types::*; use w3f_bls::EngineBLS; +pub use weights::WeightInfo; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; @@ -325,21 +330,6 @@ pub mod pallet { Ok(()) } - /// *DEPRECATED* Sudo-set the commitment rate limit - #[pallet::call_index(1)] - #[pallet::weight(( - Weight::from_parts(3_596_000, 0) - .saturating_add(T::DbWeight::get().reads(0_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)), - DispatchClass::Operational, - Pays::No - ))] - pub fn set_rate_limit(origin: OriginFor, _rate_limit_blocks: u32) -> DispatchResult { - ensure_root(origin)?; - // RateLimit::::set(rate_limit_blocks.into()); - Ok(()) - } - /// Sudo-set MaxSpace #[pallet::call_index(2)] #[pallet::weight(( @@ -359,10 +349,13 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { fn on_initialize(n: BlockNumberFor) -> Weight { - if let Err(e) = Self::reveal_timelocked_commitments() { - log::debug!("Failed to unveil matured commitments on block {n:?}: {e:?}"); + match Self::reveal_timelocked_commitments() { + Ok(w) => w, + Err(e) => { + log::debug!("Failed to unveil matured commitments on block {n:?}: {e:?}"); + Weight::from_parts(0, 0) + } } - Weight::from_parts(0, 0) } } } @@ -399,13 +392,22 @@ pub enum CallType { use frame_support::{dispatch::DispatchResult, pallet_prelude::TypeInfo}; impl Pallet { - pub fn reveal_timelocked_commitments() -> DispatchResult { + pub fn reveal_timelocked_commitments() -> Result { + let mut total_weight = Weight::from_parts(0, 0); + let index = TimelockedIndex::::get(); + total_weight = total_weight.saturating_add(T::DbWeight::get().reads(1)); + for (netuid, who) in index.clone() { - let Some(mut registration) = >::get(netuid, &who) else { + let maybe_registration = >::get(netuid, &who); + total_weight = total_weight.saturating_add(T::DbWeight::get().reads(1)); + + let Some(mut registration) = maybe_registration else { TimelockedIndex::::mutate(|idx| { idx.remove(&(netuid, who.clone())); }); + + total_weight = total_weight.saturating_add(T::DbWeight::get().reads_writes(1, 1)); continue; }; @@ -419,6 +421,7 @@ impl Pallet { encrypted, reveal_round, } => { + total_weight = total_weight.saturating_add(T::DbWeight::get().reads(1)); let pulse = match pallet_drand::Pulses::::get(reveal_round) { Some(p) => p, None => { @@ -486,6 +489,7 @@ impl Pallet { if !revealed_fields.is_empty() { let mut existing_reveals = RevealedCommitments::::get(netuid, &who).unwrap_or_default(); + total_weight = total_weight.saturating_add(T::DbWeight::get().reads(1)); let current_block = >::block_number(); let block_u64 = current_block.saturated_into::(); @@ -507,6 +511,7 @@ impl Pallet { } RevealedCommitments::::insert(netuid, &who, existing_reveals); + total_weight = total_weight.saturating_add(T::DbWeight::get().writes(1)); } registration.info.fields = BoundedVec::try_from(remain_fields) @@ -515,12 +520,19 @@ impl Pallet { match registration.info.fields.is_empty() { true => { >::remove(netuid, &who); + total_weight = total_weight.saturating_add(T::DbWeight::get().writes(1)); + TimelockedIndex::::mutate(|idx| { idx.remove(&(netuid, who.clone())); }); + + total_weight = + total_weight.saturating_add(T::DbWeight::get().reads_writes(1, 1)); } false => { >::insert(netuid, &who, ®istration); + total_weight = total_weight.saturating_add(T::DbWeight::get().writes(1)); + let has_timelock = registration .info .fields @@ -530,11 +542,38 @@ impl Pallet { TimelockedIndex::::mutate(|idx| { idx.remove(&(netuid, who.clone())); }); + + total_weight = + total_weight.saturating_add(T::DbWeight::get().reads_writes(1, 1)); } } } } - Ok(()) + Ok(total_weight) + } + pub fn get_commitments(netuid: NetUid) -> Vec<(T::AccountId, Vec)> { + let commitments: Vec<(T::AccountId, Vec)> = + as IterableStorageDoubleMap< + NetUid, + T::AccountId, + Registration, T::MaxFields, BlockNumberFor>, + >>::iter_prefix(netuid) + .map(|(account, registration)| { + let bytes = registration.encode(); + (account, bytes) + }) + .collect(); + commitments + } +} + +pub trait GetCommitments { + fn get_commitments(netuid: NetUid) -> Vec<(AccountId, Vec)>; +} + +impl GetCommitments for () { + fn get_commitments(_netuid: NetUid) -> Vec<(AccountId, Vec)> { + Vec::new() } } diff --git a/pallets/subtensor/Cargo.toml b/pallets/subtensor/Cargo.toml index 44d873c8a6..ed40d8d36f 100644 --- a/pallets/subtensor/Cargo.toml +++ b/pallets/subtensor/Cargo.toml @@ -27,17 +27,12 @@ frame-system.workspace = true sp-io.workspace = true serde = { workspace = true, features = ["derive"] } serde_json.workspace = true -serde-tuple-vec-map.workspace = true -serde_bytes = { workspace = true, features = ["alloc"] } -serde_with = { workspace = true, features = ["macros"] } sp-runtime.workspace = true sp-std.workspace = true libsecp256k1.workspace = true log.workspace = true substrate-fixed.workspace = true -pallet-transaction-payment.workspace = true pallet-utility.workspace = true -ndarray.workspace = true hex.workspace = true share-pool.workspace = true safe-math.workspace = true @@ -47,18 +42,17 @@ runtime-common.workspace = true subtensor-runtime-common = { workspace = true, features = ["approx"] } pallet-drand.workspace = true +pallet-commitments.workspace = true pallet-collective.workspace = true pallet-membership.workspace = true hex-literal.workspace = true num-traits = { workspace = true, features = ["libm"] } tle.workspace = true -ark-bls12-381 = { workspace = true, features = ["curve"] } ark-serialize = { workspace = true, features = ["derive"] } w3f-bls.workspace = true sha2.workspace = true rand_chacha.workspace = true pallet-crowdloan.workspace = true -pallet-proxy.workspace = true [dev-dependencies] pallet-balances = { workspace = true, features = ["std"] } @@ -75,7 +69,6 @@ pallet-preimage.workspace = true [features] std = [ - "ark-bls12-381/std", "ark-serialize/std", "codec/std", "frame-benchmarking/std", @@ -84,24 +77,21 @@ std = [ "hex/std", "libsecp256k1/std", "log/std", - "ndarray/std", "num-traits/std", "pallet-balances/std", + "pallet-commitments/std", "pallet-collective/std", "pallet-drand/std", "pallet-membership/std", "pallet-preimage/std", "pallet-scheduler/std", "pallet-subtensor-swap/std", - "pallet-transaction-payment/std", "pallet-utility/std", "rand_chacha/std", "safe-math/std", "scale-info/std", "serde/std", - "serde_bytes/std", "serde_json/std", - "serde_with/std", "sha2/std", "share-pool/std", "sp-core/std", @@ -121,7 +111,6 @@ std = [ "sha2/std", "share-pool/std", "subtensor-runtime-common/std", - "pallet-proxy/std", "pallet-crowdloan/std", "runtime-common/std" ] @@ -132,13 +121,12 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collective/runtime-benchmarks", + "pallet-commitments/runtime-benchmarks", "pallet-drand/runtime-benchmarks", "pallet-membership/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "pallet-subtensor-swap/runtime-benchmarks", - "pallet-transaction-payment/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", "pallet-crowdloan/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "sp-runtime/runtime-benchmarks", @@ -151,12 +139,11 @@ try-runtime = [ "pallet-membership/try-runtime", "pallet-preimage/try-runtime", "pallet-scheduler/try-runtime", - "pallet-transaction-payment/try-runtime", "pallet-utility/try-runtime", "sp-runtime/try-runtime", "pallet-collective/try-runtime", "pallet-drand/try-runtime", - "pallet-proxy/try-runtime", + "pallet-commitments/try-runtime", "pallet-crowdloan/try-runtime", "runtime-common/try-runtime" ] diff --git a/pallets/subtensor/rpc/Cargo.toml b/pallets/subtensor/rpc/Cargo.toml index e3512b82d1..80fc0eb908 100644 --- a/pallets/subtensor/rpc/Cargo.toml +++ b/pallets/subtensor/rpc/Cargo.toml @@ -14,25 +14,20 @@ workspace = true [dependencies] codec = { workspace = true, features = ["derive"] } jsonrpsee = { workspace = true, features = ["client-core", "server", "macros"] } -serde = { workspace = true, features = ["derive"] } # Substrate packages sp-api.workspace = true sp-blockchain.workspace = true -sp-rpc.workspace = true sp-runtime.workspace = true # local packages subtensor-runtime-common.workspace = true subtensor-custom-rpc-runtime-api.workspace = true -pallet-subtensor.workspace = true [features] default = ["std"] std = [ "codec/std", - "pallet-subtensor/std", - "serde/std", "sp-api/std", "sp-runtime/std", "subtensor-custom-rpc-runtime-api/std", diff --git a/pallets/subtensor/runtime-api/Cargo.toml b/pallets/subtensor/runtime-api/Cargo.toml index 1951f77fd3..b427fc333c 100644 --- a/pallets/subtensor/runtime-api/Cargo.toml +++ b/pallets/subtensor/runtime-api/Cargo.toml @@ -14,8 +14,6 @@ workspace = true [dependencies] sp-api.workspace = true sp-runtime.workspace = true -frame-support.workspace = true -serde = { workspace = true, features = ["derive"] } codec = { workspace = true, features = ["derive"] } subtensor-runtime-common.workspace = true # local @@ -25,9 +23,7 @@ pallet-subtensor.workspace = true default = ["std"] std = [ "codec/std", - "frame-support/std", "pallet-subtensor/std", - "serde/std", "sp-api/std", "sp-runtime/std", "subtensor-runtime-common/std", diff --git a/pallets/subtensor/src/benchmarks.rs b/pallets/subtensor/src/benchmarks.rs index 5cdb47685d..98307f5213 100644 --- a/pallets/subtensor/src/benchmarks.rs +++ b/pallets/subtensor/src/benchmarks.rs @@ -98,33 +98,6 @@ mod pallet_benchmarks { ); } - #[benchmark] - fn become_delegate() { - let netuid = NetUid::from(1); - let tempo: u16 = 1; - - Subtensor::::init_new_network(netuid, tempo); - SubtokenEnabled::::insert(netuid, true); - Subtensor::::set_burn(netuid, 1.into()); - Subtensor::::set_max_allowed_uids(netuid, 4096); - Subtensor::::set_network_registration_allowed(netuid, true); - - let seed: u32 = 1; - let coldkey: T::AccountId = account("Test", 0, seed); - let hotkey: T::AccountId = account("Alice", 0, seed); - let amount_to_be_staked: u64 = 1_000_000_000; - - Subtensor::::add_balance_to_coldkey_account(&coldkey, amount_to_be_staked); - assert_ok!(Subtensor::::do_burned_registration( - RawOrigin::Signed(coldkey.clone()).into(), - netuid, - hotkey.clone() - )); - - #[extrinsic_call] - _(RawOrigin::Signed(coldkey.clone()), hotkey.clone()); - } - #[benchmark] fn add_stake() { let netuid = NetUid::from(1); @@ -1073,6 +1046,7 @@ mod pallet_benchmarks { Subtensor::::init_new_network(netuid, 1); Subtensor::::set_network_registration_allowed(netuid, true); SubtokenEnabled::::insert(netuid, true); + Subtensor::::set_commit_reveal_weights_enabled(netuid, false); let reg_fee = Subtensor::::get_burn(netuid); Subtensor::::add_balance_to_coldkey_account(&hotkey, reg_fee.to_u64().saturating_mul(2)); @@ -1092,38 +1066,6 @@ mod pallet_benchmarks { ); } - #[benchmark] - fn commit_crv3_weights() { - let hotkey: T::AccountId = whitelisted_caller(); - let netuid = NetUid::from(1); - let vec_commit: Vec = vec![0; MAX_CRV3_COMMIT_SIZE_BYTES as usize]; - let commit: BoundedVec<_, _> = vec_commit.try_into().unwrap(); - let round: u64 = 0; - - Subtensor::::init_new_network(netuid, 1); - Subtensor::::set_network_pow_registration_allowed(netuid, true); - SubtokenEnabled::::insert(netuid, true); - - let reg_fee = Subtensor::::get_burn(netuid); - Subtensor::::add_balance_to_coldkey_account(&hotkey, reg_fee.to_u64().saturating_mul(2)); - - assert_ok!(Subtensor::::burned_register( - RawOrigin::Signed(hotkey.clone()).into(), - netuid, - hotkey.clone() - )); - - Subtensor::::set_commit_reveal_weights_enabled(netuid, true); - - #[extrinsic_call] - _( - RawOrigin::Signed(hotkey.clone()), - netuid, - commit.clone(), - round, - ); - } - #[benchmark] fn decrease_take() { let coldkey: T::AccountId = whitelisted_caller(); @@ -1279,27 +1221,6 @@ mod pallet_benchmarks { ); } - #[benchmark] - fn set_tao_weights() { - let netuid = NetUid::from(1); - let hotkey: T::AccountId = account("A", 0, 6); - let dests = vec![0u16]; - let weights = vec![0u16]; - let version: u64 = 1; - - Subtensor::::init_new_network(netuid, 1); - - #[extrinsic_call] - _( - RawOrigin::None, - netuid, - hotkey.clone(), - dests.clone(), - weights.clone(), - version, - ); - } - #[benchmark] fn swap_hotkey() { let coldkey: T::AccountId = whitelisted_caller(); @@ -1635,4 +1556,13 @@ mod pallet_benchmarks { Subtensor::::get_commit_reveal_weights_version(), ); } + + #[benchmark] + fn set_coldkey_auto_stake_hotkey() { + let coldkey: T::AccountId = whitelisted_caller(); + let hot: T::AccountId = account("A", 0, 1); + + #[extrinsic_call] + _(RawOrigin::Signed(coldkey.clone()), hot.clone()); + } } diff --git a/pallets/subtensor/src/coinbase/root.rs b/pallets/subtensor/src/coinbase/root.rs index fe1878f397..8bb10e0b16 100644 --- a/pallets/subtensor/src/coinbase/root.rs +++ b/pallets/subtensor/src/coinbase/root.rs @@ -414,28 +414,25 @@ impl Pallet { // --- 2. Remove network count. SubnetworkN::::remove(netuid); - // --- 3. Remove network modality storage. - NetworkModality::::remove(netuid); - - // --- 4. Remove netuid from added networks. + // --- 3. Remove netuid from added networks. NetworksAdded::::remove(netuid); - // --- 5. Decrement the network counter. + // --- 4. Decrement the network counter. TotalNetworks::::mutate(|n: &mut u16| *n = n.saturating_sub(1)); - // --- 6. Remove various network-related storages. + // --- 5. Remove various network-related storages. NetworkRegisteredAt::::remove(netuid); - // --- 7. Remove incentive mechanism memory. + // --- 6. Remove incentive mechanism memory. let _ = Uids::::clear_prefix(netuid, u32::MAX, None); let keys = Keys::::iter_prefix(netuid).collect::>(); let _ = Keys::::clear_prefix(netuid, u32::MAX, None); let _ = Bonds::::clear_prefix(netuid, u32::MAX, None); - // --- 8. Removes the weights for this subnet (do not remove). + // --- 7. Removes the weights for this subnet (do not remove). let _ = Weights::::clear_prefix(netuid, u32::MAX, None); - // --- 9. Iterate over stored weights and fill the matrix. + // --- 8. Iterate over stored weights and fill the matrix. for (uid_i, weights_i) in as IterableStorageDoubleMap>>::iter_prefix( NetUid::ROOT, @@ -453,7 +450,7 @@ impl Pallet { Weights::::insert(NetUid::ROOT, uid_i, modified_weights); } - // --- 10. Remove various network-related parameters. + // --- 9. Remove various network-related parameters. Rank::::remove(netuid); Trust::::remove(netuid); Active::::remove(netuid); @@ -470,7 +467,7 @@ impl Pallet { IsNetworkMember::::remove(key, netuid); } - // --- 11. Erase network parameters. + // --- 10. Erase network parameters. Tempo::::remove(netuid); Kappa::::remove(netuid); Difficulty::::remove(netuid); @@ -483,12 +480,12 @@ impl Pallet { POWRegistrationsThisInterval::::remove(netuid); BurnRegistrationsThisInterval::::remove(netuid); - // --- 12. Add the balance back to the owner. + // --- 11. Add the balance back to the owner. Self::add_balance_to_coldkey_account(&owner_coldkey, reserved_amount.into()); Self::set_subnet_locked_balance(netuid, TaoCurrency::ZERO); SubnetOwner::::remove(netuid); - // --- 13. Remove subnet identity if it exists. + // --- 12. Remove subnet identity if it exists. if SubnetIdentitiesV3::::contains_key(netuid) { SubnetIdentitiesV3::::remove(netuid); Self::deposit_event(Event::SubnetIdentityRemoved(netuid)); @@ -565,10 +562,10 @@ impl Pallet { NetworkLastLockCost::::get() } pub fn get_network_last_lock_block() -> u64 { - NetworkLastRegistered::::get() + Self::get_rate_limited_last_block(&RateLimitKey::NetworkLastRegistered) } pub fn set_network_last_lock_block(block: u64) { - NetworkLastRegistered::::set(block); + Self::set_rate_limited_last_block(&RateLimitKey::NetworkLastRegistered, block); } pub fn set_lock_reduction_interval(interval: u64) { NetworkLockReductionInterval::::set(interval); @@ -588,10 +585,13 @@ impl Pallet { let halved_interval: I64F64 = interval.saturating_mul(halving); halved_interval.saturating_to_num::() } - pub fn get_rate_limited_last_block(rate_limit_key: &RateLimitKey) -> u64 { + pub fn get_rate_limited_last_block(rate_limit_key: &RateLimitKey) -> u64 { LastRateLimitedBlock::::get(rate_limit_key) } - pub fn set_rate_limited_last_block(rate_limit_key: &RateLimitKey, block: u64) { - LastRateLimitedBlock::::set(rate_limit_key, block); + pub fn set_rate_limited_last_block(rate_limit_key: &RateLimitKey, block: u64) { + LastRateLimitedBlock::::insert(rate_limit_key, block); + } + pub fn remove_rate_limited_last_block(rate_limit_key: &RateLimitKey) { + LastRateLimitedBlock::::remove(rate_limit_key); } } diff --git a/pallets/subtensor/src/coinbase/run_coinbase.rs b/pallets/subtensor/src/coinbase/run_coinbase.rs index dcdab8072e..7651a4162f 100644 --- a/pallets/subtensor/src/coinbase/run_coinbase.rs +++ b/pallets/subtensor/src/coinbase/run_coinbase.rs @@ -39,13 +39,14 @@ impl Pallet { log::debug!("Subnets to emit to: {subnets_to_emit_to:?}"); // --- 2. Get sum of tao reserves ( in a later version we will switch to prices. ) - let mut total_moving_prices = U96F32::saturating_from_num(0.0); + let mut acc_total_moving_prices = U96F32::saturating_from_num(0.0); // Only get price EMA for subnets that we emit to. for netuid_i in subnets_to_emit_to.iter() { // Get and update the moving price of each subnet adding the total together. - total_moving_prices = - total_moving_prices.saturating_add(Self::get_moving_alpha_price(*netuid_i)); + acc_total_moving_prices = + acc_total_moving_prices.saturating_add(Self::get_moving_alpha_price(*netuid_i)); } + let total_moving_prices = acc_total_moving_prices; log::debug!("total_moving_prices: {total_moving_prices:?}"); // --- 3. Get subnet terms (tao_in, alpha_in, and alpha_out) @@ -183,21 +184,22 @@ impl Pallet { }); } + // Get total TAO on root. + let root_tao: U96F32 = asfloat!(SubnetTAO::::get(NetUid::ROOT)); + log::debug!("root_tao: {root_tao:?}"); + // Get tao_weight + let tao_weight: U96F32 = root_tao.saturating_mul(Self::get_tao_weight()); + log::debug!("tao_weight: {tao_weight:?}"); + // --- 6. Seperate out root dividends in alpha and sell them into tao. // Then accumulate those dividends for later. for netuid_i in subnets_to_emit_to.iter() { // Get remaining alpha out. let alpha_out_i: U96F32 = *alpha_out.get(netuid_i).unwrap_or(&asfloat!(0.0)); log::debug!("alpha_out_i: {alpha_out_i:?}"); - // Get total TAO on root. - let root_tao: U96F32 = asfloat!(SubnetTAO::::get(NetUid::ROOT)); - log::debug!("root_tao: {root_tao:?}"); // Get total ALPHA on subnet. let alpha_issuance: U96F32 = asfloat!(Self::get_alpha_issuance(*netuid_i)); log::debug!("alpha_issuance: {alpha_issuance:?}"); - // Get tao_weight - let tao_weight: U96F32 = root_tao.saturating_mul(Self::get_tao_weight()); - log::debug!("tao_weight: {tao_weight:?}"); // Get root proportional dividends. let root_proportion: U96F32 = tao_weight .checked_div(tao_weight.saturating_add(alpha_issuance)) @@ -239,14 +241,14 @@ impl Pallet { }); } - // --- 7 Update moving prices after using them in the emission calculation. + // --- 7. Update moving prices after using them in the emission calculation. // Only update price EMA for subnets that we emit to. for netuid_i in subnets_to_emit_to.iter() { // Update moving prices after using them above. Self::update_moving_price(*netuid_i); } - // --- 7. Drain pending emission through the subnet based on tempo. + // --- 8. Drain pending emission through the subnet based on tempo. // Run the epoch for *all* subnets, even if we don't emit anything. for &netuid in subnets.iter() { // Reveal matured weights. @@ -509,10 +511,24 @@ impl Pallet { continue; } - // Increase stake for miner. + let owner: T::AccountId = Owner::::get(&hotkey); + let maybe_dest = AutoStakeDestination::::get(&owner); + + // Always stake but only emit event if autostake is set. + let destination = maybe_dest.clone().unwrap_or(hotkey.clone()); + + if let Some(dest) = maybe_dest { + Self::deposit_event(Event::::AutoStakeAdded { + netuid, + destination: dest, + hotkey: hotkey.clone(), + owner: owner.clone(), + incentive, + }); + } Self::increase_stake_for_hotkey_and_coldkey_on_subnet( - &hotkey.clone(), - &Owner::::get(hotkey.clone()), + &destination, + &owner, netuid, incentive, ); @@ -741,10 +757,11 @@ impl Pallet { // Calculate the hotkey's share of the validator emission based on its childkey take let validating_emission: U96F32 = U96F32::saturating_from_num(dividends); let mut remaining_emission: U96F32 = validating_emission; - let childkey_take_proportion: U96F32 = + let burn_take_proportion: U96F32 = Self::get_ck_burn(); + let child_take_proportion: U96F32 = U96F32::saturating_from_num(Self::get_childkey_take(hotkey, netuid)) .safe_div(U96F32::saturating_from_num(u16::MAX)); - log::debug!("Childkey take proportion: {childkey_take_proportion:?} for hotkey {hotkey:?}"); + log::debug!("Childkey take proportion: {child_take_proportion:?} for hotkey {hotkey:?}"); // NOTE: Only the validation emission should be split amongst parents. // Grab the owner of the childkey. @@ -752,7 +769,7 @@ impl Pallet { // Initialize variables to track emission distribution let mut to_parents: u64 = 0; - let mut total_child_emission_take: U96F32 = U96F32::saturating_from_num(0); + let mut total_child_take: U96F32 = U96F32::saturating_from_num(0); // Initialize variables to calculate total stakes from parents let mut total_contribution: U96F32 = U96F32::saturating_from_num(0); @@ -816,23 +833,26 @@ impl Pallet { remaining_emission = remaining_emission.saturating_sub(parent_emission); // Get the childkey take for this parent. - let child_emission_take: U96F32 = if parent_owner == childkey_owner { - // The parent is from the same coldkey, so we don't remove any childkey take. - U96F32::saturating_from_num(0) - } else { - childkey_take_proportion - .saturating_mul(U96F32::saturating_from_num(parent_emission)) + let mut burn_take: U96F32 = U96F32::saturating_from_num(0); + let mut child_take: U96F32 = U96F32::saturating_from_num(0); + if parent_owner != childkey_owner { + // The parent is from a different coldkey, we burn some proportion + burn_take = burn_take_proportion.saturating_mul(parent_emission); + child_take = child_take_proportion.saturating_mul(parent_emission); + parent_emission = parent_emission.saturating_sub(burn_take); + parent_emission = parent_emission.saturating_sub(child_take); + total_child_take = total_child_take.saturating_add(child_take); + + Self::recycle_subnet_alpha( + netuid, + AlphaCurrency::from(burn_take.saturating_to_num::()), + ); }; + log::debug!("burn_takee: {burn_take:?} for hotkey {hotkey:?}"); + log::debug!("child_take: {child_take:?} for hotkey {hotkey:?}"); + log::debug!("parent_emission: {parent_emission:?} for hotkey {hotkey:?}"); + log::debug!("total_child_take: {total_child_take:?} for hotkey {hotkey:?}"); - // Remove the childkey take from the parent's emission. - parent_emission = parent_emission.saturating_sub(child_emission_take); - - // Add the childkey take to the total childkey take tracker. - total_child_emission_take = - total_child_emission_take.saturating_add(child_emission_take); - - log::debug!("Child emission take: {child_emission_take:?} for hotkey {hotkey:?}"); - log::debug!("Parent emission: {parent_emission:?} for hotkey {hotkey:?}"); log::debug!("remaining emission: {remaining_emission:?}"); // Add the parent's emission to the distribution list @@ -850,7 +870,7 @@ impl Pallet { // Calculate the final emission for the hotkey itself. // This includes the take left from the parents and the self contribution. let child_emission = remaining_emission - .saturating_add(total_child_emission_take) + .saturating_add(total_child_take) .saturating_to_num::() .into(); diff --git a/pallets/subtensor/src/epoch/run_epoch.rs b/pallets/subtensor/src/epoch/run_epoch.rs index 2f302c2a5e..7906064780 100644 --- a/pallets/subtensor/src/epoch/run_epoch.rs +++ b/pallets/subtensor/src/epoch/run_epoch.rs @@ -920,6 +920,11 @@ impl Pallet { } }); + Self::deposit_event(Event::IncentiveAlphaEmittedToMiners { + netuid, + emissions: server_emission.clone(), + }); + // Emission tuples ( hotkeys, server_emission, validator_emission ) hotkeys .into_iter() diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index ef41b07c78..db4c385812 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -54,6 +54,7 @@ extern crate alloc; pub const MAX_CRV3_COMMIT_SIZE_BYTES: u32 = 5000; +#[allow(deprecated)] #[deny(missing_docs)] #[import_section(errors::errors)] #[import_section(events::events)] @@ -490,11 +491,6 @@ pub mod pallet { 0 } #[pallet::type_value] - /// Default value for modality. - pub fn DefaultModality() -> u16 { - 0 - } - #[pallet::type_value] /// Default value for hotkeys. pub fn DefaultHotkeys() -> Vec { vec![] @@ -525,11 +521,6 @@ pub mod pallet { T::InitialNetworkImmunityPeriod::get() } #[pallet::type_value] - /// Default value for network last registered. - pub fn DefaultNetworkLastRegistered() -> u64 { - 0 - } - #[pallet::type_value] /// Default value for network min allowed UIDs. pub fn DefaultNetworkMinAllowedUids() -> u16 { T::InitialNetworkMinAllowedUids::get() @@ -867,6 +858,12 @@ pub mod pallet { 50400 } + #[pallet::type_value] + /// Default value for ck burn, 18%. + pub fn DefaultCKBurn() -> u64 { + 0 + } + #[pallet::storage] pub type MinActivityCutoff = StorageValue<_, u16, ValueQuery, DefaultMinActivityCutoff>; @@ -920,6 +917,9 @@ pub mod pallet { /// --- ITEM --> Global weight pub type TaoWeight = StorageValue<_, u64, ValueQuery, DefaultTaoWeight>; #[pallet::storage] + /// --- ITEM --> CK burn + pub type CKBurn = StorageValue<_, u64, ValueQuery, DefaultCKBurn>; + #[pallet::storage] /// --- ITEM ( default_delegate_take ) pub type MaxDelegateTake = StorageValue<_, u16, ValueQuery, DefaultDelegateTake>; #[pallet::storage] @@ -1083,6 +1083,9 @@ pub mod pallet { #[pallet::storage] // --- MAP ( cold ) --> Vec | Returns the vector of hotkeys controlled by this coldkey. pub type OwnedHotkeys = StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; + #[pallet::storage] // --- MAP ( cold ) --> hot | Returns the hotkey a coldkey will autostake to with mining rewards. + pub type AutoStakeDestination = + StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId, OptionQuery>; #[pallet::storage] // --- DMAP ( cold ) --> (block_expected, new_coldkey) | Maps coldkey to the block to swap at and new coldkey. pub type ColdkeySwapScheduled = StorageMap< @@ -1161,10 +1164,6 @@ pub mod pallet { pub type NetworkImmunityPeriod = StorageValue<_, u64, ValueQuery, DefaultNetworkImmunityPeriod>; #[pallet::storage] - /// ITEM( network_last_registered_block ) - pub type NetworkLastRegistered = - StorageValue<_, u64, ValueQuery, DefaultNetworkLastRegistered>; - #[pallet::storage] /// ITEM( min_network_lock_cost ) pub type NetworkMinLockCost = StorageValue<_, TaoCurrency, ValueQuery, DefaultNetworkMinLockCost>; @@ -1197,7 +1196,7 @@ pub mod pallet { #[pallet::storage] /// --- MAP ( RateLimitKey ) --> Block number in which the last rate limited operation occured pub type LastRateLimitedBlock = - StorageMap<_, Identity, RateLimitKey, u64, ValueQuery, DefaultZeroU64>; + StorageMap<_, Identity, RateLimitKey, u64, ValueQuery, DefaultZeroU64>; /// ============================ /// ==== Subnet Locks ===== @@ -1233,10 +1232,6 @@ pub mod pallet { /// --- MAP ( netuid ) --> subnetwork_n (Number of UIDs in the network). pub type SubnetworkN = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultN>; #[pallet::storage] - /// --- MAP ( netuid ) --> modality TEXT: 0, IMAGE: 1, TENSOR: 2 - pub type NetworkModality = - StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultModality>; - #[pallet::storage] /// --- MAP ( netuid ) --> network_is_added pub type NetworksAdded = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultNeworksAdded>; @@ -1654,14 +1649,17 @@ pub mod pallet { u64, ValueQuery, >; + #[deprecated] #[pallet::storage] /// --- MAP ( key ) --> last_block pub type LastTxBlock = StorageMap<_, Identity, T::AccountId, u64, ValueQuery, DefaultLastTxBlock>; + #[deprecated] #[pallet::storage] /// --- MAP ( key ) --> last_tx_block_childkey_take pub type LastTxBlockChildKeyTake = StorageMap<_, Identity, T::AccountId, u64, ValueQuery, DefaultLastTxBlock>; + #[deprecated] #[pallet::storage] /// --- MAP ( key ) --> last_tx_block_delegate_take pub type LastTxBlockDelegateTake = @@ -2042,6 +2040,10 @@ impl> fn is_owner(account_id: &T::AccountId, netuid: NetUid) -> bool { SubnetOwner::::get(netuid) == *account_id } + + fn is_subtoken_enabled(netuid: NetUid) -> bool { + SubtokenEnabled::::get(netuid) + } } impl> @@ -2132,9 +2134,17 @@ impl> /// Enum that defines types of rate limited operations for /// storing last block when this operation occured #[derive(Encode, Decode, Clone, PartialEq, Eq, Debug, TypeInfo)] -pub enum RateLimitKey { +pub enum RateLimitKey { // The setting sn owner hotkey operation is rate limited per netuid SetSNOwnerHotkey(NetUid), + // Subnet registration rate limit + NetworkLastRegistered, + // Last tx block limit per account ID + LastTxBlock(AccountId), + // Last tx block child key limit per account ID + LastTxBlockChildKeyTake(AccountId), + // Last tx block delegate key limit per account ID + LastTxBlockDelegateTake(AccountId), } pub trait ProxyInterface { diff --git a/pallets/subtensor/src/macros/config.rs b/pallets/subtensor/src/macros/config.rs index 3479ad8101..eebff46c6e 100644 --- a/pallets/subtensor/src/macros/config.rs +++ b/pallets/subtensor/src/macros/config.rs @@ -6,6 +6,7 @@ use frame_support::pallet_macros::pallet_section; #[pallet_section] mod config { + use pallet_commitments::GetCommitments; use subtensor_swap_interface::SwapHandler; /// Configure the pallet by specifying the parameters and types on which it depends. @@ -58,6 +59,9 @@ mod config { /// Interface to allow interacting with the proxy pallet. type ProxyInterface: crate::ProxyInterface; + /// Interface to get commitments. + type GetCommitments: GetCommitments; + /// ================================= /// ==== Initial Value Constants ==== /// ================================= @@ -98,6 +102,12 @@ mod config { /// Initial Min Burn. #[pallet::constant] type InitialMinBurn: Get; + /// Min burn upper bound. + #[pallet::constant] + type MinBurnUpperBound: Get; + /// Max burn lower bound. + #[pallet::constant] + type MaxBurnLowerBound: Get; /// Initial adjustment interval. #[pallet::constant] type InitialAdjustmentInterval: Get; diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index 35439479ab..f069ff0aa5 100644 --- a/pallets/subtensor/src/macros/dispatches.rs +++ b/pallets/subtensor/src/macros/dispatches.rs @@ -120,9 +120,9 @@ mod dispatches { /// - On failure for each failed item in the batch. /// #[pallet::call_index(80)] - #[pallet::weight((Weight::from_parts(95_160_000, 0) - .saturating_add(T::DbWeight::get().reads(14)) - .saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))] + #[pallet::weight((Weight::from_parts(95_460_000, 0) + .saturating_add(T::DbWeight::get().reads(14_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)), DispatchClass::Normal, Pays::No))] pub fn batch_set_weights( origin: OriginFor, netuids: Vec>, @@ -186,7 +186,7 @@ mod dispatches { /// - On failure for each failed item in the batch. /// #[pallet::call_index(100)] - #[pallet::weight((Weight::from_parts(82_010_000, 0) + #[pallet::weight((Weight::from_parts(100_500_000, 0) .saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))] pub fn batch_commit_weights( @@ -249,48 +249,6 @@ mod dispatches { Self::do_reveal_weights(origin, netuid, uids, values, salt, version_key) } - /// ---- Used to commit encrypted commit-reveal v3 weight values to later be revealed. - /// - /// # Args: - /// * `origin`: (`::RuntimeOrigin`): - /// - The committing hotkey. - /// - /// * `netuid` (`u16`): - /// - The u16 network identifier. - /// - /// * `commit` (`Vec`): - /// - The encrypted compressed commit. - /// The steps for this are: - /// 1. Instantiate [`WeightsTlockPayload`] - /// 2. Serialize it using the `parity_scale_codec::Encode` trait - /// 3. Encrypt it following the steps (here)[https://github.com/ideal-lab5/tle/blob/f8e6019f0fb02c380ebfa6b30efb61786dede07b/timelock/src/tlock.rs#L283-L336] - /// to produce a [`TLECiphertext`] type. - /// 4. Serialize and compress using the `ark-serialize` `CanonicalSerialize` trait. - /// - /// * reveal_round (`u64`): - /// - The drand reveal round which will be avaliable during epoch `n+1` from the current - /// epoch. - /// - /// # Raises: - /// * `CommitRevealV3Disabled`: - /// - Attempting to commit when the commit-reveal mechanism is disabled. - /// - /// * `TooManyUnrevealedCommits`: - /// - Attempting to commit when the user has more than the allowed limit of unrevealed commits. - /// - #[pallet::call_index(99)] - #[pallet::weight((Weight::from_parts(77_750_000, 0) - .saturating_add(T::DbWeight::get().reads(7_u64)) - .saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))] - pub fn commit_crv3_weights( - origin: T::RuntimeOrigin, - netuid: NetUid, - commit: BoundedVec>, - reveal_round: u64, - ) -> DispatchResult { - Self::do_commit_timelocked_weights(origin, netuid, commit, reveal_round, 4) - } - /// ---- The implementation for batch revealing committed weights. /// /// # Args: @@ -352,118 +310,6 @@ mod dispatches { ) } - /// # Args: - /// * `origin`: (Origin): - /// - The caller, a hotkey who wishes to set their weights. - /// - /// * `netuid` (u16): - /// - The network uid we are setting these weights on. - /// - /// * `hotkey` (T::AccountId): - /// - The hotkey associated with the operation and the calling coldkey. - /// - /// * `dests` (Vec): - /// - The edge endpoint for the weight, i.e. j for w_ij. - /// - /// * 'weights' (Vec): - /// - The u16 integer encoded weights. Interpreted as rational - /// values in the range [0,1]. They must sum to in32::MAX. - /// - /// * 'version_key' ( u64 ): - /// - The network version key to check if the validator is up to date. - /// - /// # Event: - /// - /// * WeightsSet; - /// - On successfully setting the weights on chain. - /// - /// # Raises: - /// - /// * NonAssociatedColdKey; - /// - Attempting to set weights on a non-associated cold key. - /// - /// * 'SubNetworkDoesNotExist': - /// - Attempting to set weights on a non-existent network. - /// - /// * 'NotRootSubnet': - /// - Attempting to set weights on a subnet that is not the root network. - /// - /// * 'WeightVecNotEqualSize': - /// - Attempting to set weights with uids not of same length. - /// - /// * 'UidVecContainInvalidOne': - /// - Attempting to set weights with invalid uids. - /// - /// * 'NotRegistered': - /// - Attempting to set weights from a non registered account. - /// - /// * 'WeightVecLengthIsLow': - /// - Attempting to set weights with fewer weights than min. - /// - /// * 'IncorrectWeightVersionKey': - /// - Attempting to set weights with the incorrect network version key. - /// - /// * 'SettingWeightsTooFast': - /// - Attempting to set weights too fast. - /// - /// * 'WeightVecLengthIsLow': - /// - Attempting to set weights with fewer weights than min. - /// - /// * 'MaxWeightExceeded': - /// - Attempting to set weights with max value exceeding limit. - /// - #[pallet::call_index(8)] - #[pallet::weight((Weight::from_parts(3_176_000, 0) - .saturating_add(T::DbWeight::get().reads(0_u64)) - .saturating_add(T::DbWeight::get().writes(0_u64)), DispatchClass::Normal, Pays::No))] - pub fn set_tao_weights( - _origin: OriginFor, - _netuid: NetUid, - _hotkey: T::AccountId, - _dests: Vec, - _weights: Vec, - _version_key: u64, - ) -> DispatchResult { - // DEPRECATED - // Self::do_set_root_weights(origin, netuid, hotkey, dests, weights, version_key) - // Self::do_set_tao_weights(origin, netuid, hotkey, dests, weights, version_key) - Ok(()) - } - - /// --- Sets the key as a delegate. - /// - /// # Args: - /// * 'origin': (Origin): - /// - The signature of the caller's coldkey. - /// - /// * 'hotkey' (T::AccountId): - /// - The hotkey we are delegating (must be owned by the coldkey.) - /// - /// * 'take' (u64): - /// - The stake proportion that this hotkey takes from delegations. - /// - /// # Event: - /// * DelegateAdded; - /// - On successfully setting a hotkey as a delegate. - /// - /// # Raises: - /// * 'NotRegistered': - /// - The hotkey we are delegating is not registered on the network. - /// - /// * 'NonAssociatedColdKey': - /// - The hotkey we are delegating is not owned by the calling coldket. - /// - #[pallet::call_index(1)] - #[pallet::weight((Weight::from_parts(3_406_000, 0) - .saturating_add(T::DbWeight::get().reads(0)) - .saturating_add(T::DbWeight::get().writes(0)), DispatchClass::Normal, Pays::Yes))] - pub fn become_delegate(_origin: OriginFor, _hotkey: T::AccountId) -> DispatchResult { - // DEPRECATED - // Self::do_become_delegate(origin, hotkey, Self::get_default_delegate_take()) - - Ok(()) - } - /// --- Allows delegates to decrease its take value. /// /// # Args: @@ -777,7 +623,7 @@ mod dispatches { /// - Attempting to set prometheus information withing the rate limit min. /// #[pallet::call_index(40)] - #[pallet::weight((Weight::from_parts(32_310_000, 0) + #[pallet::weight((Weight::from_parts(41_240_000, 0) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Normal, Pays::No))] pub fn serve_axon_tls( @@ -915,7 +761,7 @@ mod dispatches { /// Attempt to adjust the senate membership to include a hotkey #[pallet::call_index(63)] - #[pallet::weight((Weight::from_parts(60_720_000, 0) + #[pallet::weight((Weight::from_parts(58_980_000, 0) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(4)), DispatchClass::Normal, Pays::Yes))] pub fn adjust_senate(origin: OriginFor, hotkey: T::AccountId) -> DispatchResult { @@ -966,7 +812,7 @@ mod dispatches { /// Weight is calculated based on the number of database reads and writes. #[pallet::call_index(71)] #[pallet::weight((Weight::from_parts(161_700_000, 0) - .saturating_add(T::DbWeight::get().reads(14)) + .saturating_add(T::DbWeight::get().reads(15_u64)) .saturating_add(T::DbWeight::get().writes(9)), DispatchClass::Operational, Pays::No))] pub fn swap_coldkey( origin: OriginFor, @@ -1045,7 +891,7 @@ mod dispatches { /// #[pallet::call_index(69)] #[pallet::weight(( - Weight::from_parts(5_912_000, 0) + Weight::from_parts(5_660_000, 0) .saturating_add(T::DbWeight::get().reads(0)) .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Operational, @@ -1195,7 +1041,7 @@ mod dispatches { #[pallet::call_index(59)] #[pallet::weight((Weight::from_parts(235_400_000, 0) .saturating_add(T::DbWeight::get().reads(36)) - .saturating_add(T::DbWeight::get().writes(52)), DispatchClass::Normal, Pays::No))] + .saturating_add(T::DbWeight::get().writes(52)), DispatchClass::Normal, Pays::Yes))] pub fn register_network(origin: OriginFor, hotkey: T::AccountId) -> DispatchResult { Self::do_register_network(origin, &hotkey, 1, None) } @@ -1386,64 +1232,6 @@ mod dispatches { Ok(().into()) } - /// Schedule the dissolution of a network at a specified block number. - /// - /// # Arguments - /// - /// * `origin` - The origin of the call, must be signed by the sender. - /// * `netuid` - The u16 network identifier to be dissolved. - /// - /// # Returns - /// - /// Returns a `DispatchResultWithPostInfo` indicating success or failure of the operation. - /// - /// # Weight - /// - /// Weight is calculated based on the number of database reads and writes. - - #[pallet::call_index(74)] - #[pallet::weight((Weight::from_parts(119_000_000, 0) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(31)), DispatchClass::Normal, Pays::Yes))] - pub fn schedule_dissolve_network( - _origin: OriginFor, - _netuid: NetUid, - ) -> DispatchResultWithPostInfo { - Err(Error::::CallDisabled.into()) - - // let who = ensure_signed(origin)?; - - // let current_block: BlockNumberFor = >::block_number(); - // let duration: BlockNumberFor = DissolveNetworkScheduleDuration::::get(); - // let when: BlockNumberFor = current_block.saturating_add(duration); - - // let call = Call::::dissolve_network { - // coldkey: who.clone(), - // netuid, - // }; - - // let bound_call = T::Preimages::bound(LocalCallOf::::from(call.clone())) - // .map_err(|_| Error::::FailedToSchedule)?; - - // T::Scheduler::schedule( - // DispatchTime::At(when), - // None, - // 63, - // frame_system::RawOrigin::Root.into(), - // bound_call, - // ) - // .map_err(|_| Error::::FailedToSchedule)?; - - // // Emit the SwapScheduled event - // Self::deposit_event(Event::DissolveNetworkScheduled { - // account: who.clone(), - // netuid, - // execution_block: when, - // }); - - // Ok(().into()) - } - /// ---- Set prometheus information for the neuron. /// # Args: /// * 'origin': (Origin): @@ -1540,7 +1328,7 @@ mod dispatches { #[pallet::call_index(79)] #[pallet::weight((Weight::from_parts(234_200_000, 0) .saturating_add(T::DbWeight::get().reads(35)) - .saturating_add(T::DbWeight::get().writes(51)), DispatchClass::Normal, Pays::No))] + .saturating_add(T::DbWeight::get().writes(51)), DispatchClass::Normal, Pays::Yes))] pub fn register_network_with_identity( origin: OriginFor, hotkey: T::AccountId, @@ -1852,7 +1640,7 @@ mod dispatches { /// #[pallet::call_index(89)] #[pallet::weight((Weight::from_parts(377_400_000, 0) - .saturating_add(T::DbWeight::get().reads(30)) + .saturating_add(T::DbWeight::get().reads(30_u64)) .saturating_add(T::DbWeight::get().writes(14)), DispatchClass::Normal, Pays::Yes))] pub fn remove_stake_limit( origin: OriginFor, @@ -2156,8 +1944,8 @@ mod dispatches { /// Emits a `SymbolUpdated` event on success. #[pallet::call_index(112)] #[pallet::weight(( - Weight::from_parts(26_880_000, 0).saturating_add(T::DbWeight::get().reads_writes(4, 1)), - DispatchClass::Operational, + Weight::from_parts(26_200_000, 0).saturating_add(T::DbWeight::get().reads_writes(4, 1)), + DispatchClass::Normal, Pays::Yes ))] pub fn update_symbol( @@ -2201,7 +1989,7 @@ mod dispatches { /// * commit_reveal_version (`u16`): /// - The client (bittensor-drand) version #[pallet::call_index(113)] - #[pallet::weight((Weight::from_parts(64_530_000, 0) + #[pallet::weight((Weight::from_parts(80_690_000, 0) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))] pub fn commit_timelocked_weights( @@ -2219,5 +2007,31 @@ mod dispatches { commit_reveal_version, ) } + + /// Set the autostake destination hotkey for a coldkey. + /// + /// The caller selects a hotkey where all future rewards + /// will be automatically staked. + /// + /// # Args: + /// * `origin` - (::Origin): + /// - The signature of the caller's coldkey. + /// + /// * `hotkey` (T::AccountId): + /// - The hotkey account to designate as the autostake destination. + #[pallet::call_index(114)] + #[pallet::weight((Weight::from_parts(5_170_000, 0) + .saturating_add(T::DbWeight::get().reads(0_u64)) + .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Normal, Pays::No))] + pub fn set_coldkey_auto_stake_hotkey( + origin: T::RuntimeOrigin, + hotkey: T::AccountId, + ) -> DispatchResult { + let coldkey = ensure_signed(origin)?; + + AutoStakeDestination::::insert(coldkey, hotkey.clone()); + + Ok(()) + } } } diff --git a/pallets/subtensor/src/macros/events.rs b/pallets/subtensor/src/macros/events.rs index 2fab5ecdb4..25bf93b730 100644 --- a/pallets/subtensor/src/macros/events.rs +++ b/pallets/subtensor/src/macros/events.rs @@ -413,5 +413,27 @@ mod events { /// - **netuid**: The network identifier. /// - **who**: The account ID of the user revealing the weights. TimelockedWeightsRevealed(NetUid, T::AccountId), + + /// Auto-staking hotkey received stake + AutoStakeAdded { + /// Subnet identifier. + netuid: NetUid, + /// Destination account that received the auto-staked funds. + destination: T::AccountId, + /// Hotkey account whose stake was auto-staked. + hotkey: T::AccountId, + /// Owner (coldkey) account associated with the hotkey. + owner: T::AccountId, + /// Amount of alpha auto-staked. + incentive: AlphaCurrency, + }, + + /// End-of-epoch miner incentive alpha by UID + IncentiveAlphaEmittedToMiners { + /// Subnet identifier. + netuid: NetUid, + /// UID-indexed array of miner incentive alpha; index equals UID. + emissions: Vec, + }, } } diff --git a/pallets/subtensor/src/macros/hooks.rs b/pallets/subtensor/src/macros/hooks.rs index 4bf7a6b115..b43f9422df 100644 --- a/pallets/subtensor/src/macros/hooks.rs +++ b/pallets/subtensor/src/macros/hooks.rs @@ -135,7 +135,11 @@ mod hooks { //Migrate CRV3 to TimelockedCommits .saturating_add(migrations::migrate_crv3_v2_to_timelocked::migrate_crv3_v2_to_timelocked::()) // Migrate to fix root counters - .saturating_add(migrations::migrate_fix_root_tao_and_alpha_in::migrate_fix_root_tao_and_alpha_in::()); + .saturating_add(migrations::migrate_fix_root_tao_and_alpha_in::migrate_fix_root_tao_and_alpha_in::()) + // Migrate last block rate limiting storage items + .saturating_add(migrations::migrate_rate_limiting_last_blocks::migrate_obsolete_rate_limiting_last_blocks_storage::()) + // Migrate remove network modality + .saturating_add(migrations::migrate_remove_network_modality::migrate_remove_network_modality::()); weight } diff --git a/pallets/subtensor/src/migrations/migrate_delete_subnet_21.rs b/pallets/subtensor/src/migrations/migrate_delete_subnet_21.rs index e6a8c72eae..b8b1138b2e 100644 --- a/pallets/subtensor/src/migrations/migrate_delete_subnet_21.rs +++ b/pallets/subtensor/src/migrations/migrate_delete_subnet_21.rs @@ -59,9 +59,6 @@ pub fn migrate_delete_subnet_21() -> Weight { // Remove network count SubnetworkN::::remove(netuid); - // Remove network modality storage - NetworkModality::::remove(netuid); - // Remove netuid from added networks NetworksAdded::::remove(netuid); diff --git a/pallets/subtensor/src/migrations/migrate_delete_subnet_3.rs b/pallets/subtensor/src/migrations/migrate_delete_subnet_3.rs index c479bd613a..289ce6cb36 100644 --- a/pallets/subtensor/src/migrations/migrate_delete_subnet_3.rs +++ b/pallets/subtensor/src/migrations/migrate_delete_subnet_3.rs @@ -61,9 +61,6 @@ pub fn migrate_delete_subnet_3() -> Weight { // Remove network count SubnetworkN::::remove(netuid); - // Remove network modality storage - NetworkModality::::remove(netuid); - // Remove netuid from added networks NetworksAdded::::remove(netuid); diff --git a/pallets/subtensor/src/migrations/migrate_rate_limiting_last_blocks.rs b/pallets/subtensor/src/migrations/migrate_rate_limiting_last_blocks.rs new file mode 100644 index 0000000000..99ce1e3077 --- /dev/null +++ b/pallets/subtensor/src/migrations/migrate_rate_limiting_last_blocks.rs @@ -0,0 +1,161 @@ +use crate::Vec; +use crate::{Config, HasMigrationRun, Pallet}; +use alloc::string::String; +use codec::Decode; +use frame_support::traits::Get; +use frame_support::weights::Weight; +use sp_io::hashing::twox_128; +use sp_io::storage::{clear, get}; + +pub fn migrate_obsolete_rate_limiting_last_blocks_storage() -> Weight { + migrate_network_last_registered::() + .saturating_add(migrate_last_tx_block::()) + .saturating_add(migrate_last_tx_block_childkey_take::()) + .saturating_add(migrate_last_tx_block_delegate_take::()) +} + +pub fn migrate_network_last_registered() -> Weight { + let migration_name = b"migrate_network_last_registered".to_vec(); + let pallet_name = "SubtensorModule"; + let storage_name = "NetworkLastRegistered"; + + migrate_value::(migration_name, pallet_name, storage_name, |limit| { + Pallet::::set_network_last_lock_block(limit); + }) +} + +#[allow(deprecated)] +pub fn migrate_last_tx_block() -> Weight { + let migration_name = b"migrate_last_tx_block".to_vec(); + + migrate_last_block_map::( + migration_name, + || crate::LastTxBlock::::drain().collect::>(), + |account, block| { + Pallet::::set_last_tx_block(&account, block); + }, + ) +} + +#[allow(deprecated)] +pub fn migrate_last_tx_block_childkey_take() -> Weight { + let migration_name = b"migrate_last_tx_block_childkey_take".to_vec(); + + migrate_last_block_map::( + migration_name, + || crate::LastTxBlockChildKeyTake::::drain().collect::>(), + |account, block| { + Pallet::::set_last_tx_block_childkey(&account, block); + }, + ) +} + +#[allow(deprecated)] +pub fn migrate_last_tx_block_delegate_take() -> Weight { + let migration_name = b"migrate_last_tx_block_delegate_take".to_vec(); + + migrate_last_block_map::( + migration_name, + || crate::LastTxBlockDelegateTake::::drain().collect::>(), + |account, block| { + Pallet::::set_last_tx_block_delegate_take(&account, block); + }, + ) +} + +fn migrate_value( + migration_name: Vec, + pallet_name: &str, + storage_name: &str, + set_value: SetValueFunction, +) -> Weight +where + T: Config, + SetValueFunction: Fn(u64 /*limit in blocks*/), +{ + // Initialize the weight with one read operation. + let mut weight = T::DbWeight::get().reads(1); + + // Check if the migration has already run + if HasMigrationRun::::get(&migration_name) { + log::info!("Migration '{migration_name:?}' has already run. Skipping.",); + return weight; + } + log::info!( + "Running migration '{}'", + String::from_utf8_lossy(&migration_name) + ); + + let pallet_name_hash = twox_128(pallet_name.as_bytes()); + let storage_name_hash = twox_128(storage_name.as_bytes()); + let full_key = [pallet_name_hash, storage_name_hash].concat(); + + if let Some(value_bytes) = get(&full_key) { + if let Ok(rate_limit) = Decode::decode(&mut &value_bytes[..]) { + set_value(rate_limit); + } + + clear(&full_key); + } + + weight = weight.saturating_add(T::DbWeight::get().writes(2)); + weight = weight.saturating_add(T::DbWeight::get().reads(1)); + + // Mark the migration as completed + HasMigrationRun::::insert(&migration_name, true); + weight = weight.saturating_add(T::DbWeight::get().writes(1)); + + log::info!( + "Migration '{:?}' completed.", + String::from_utf8_lossy(&migration_name) + ); + + // Return the migration weight. + weight +} + +fn migrate_last_block_map( + migration_name: Vec, + get_values: GetValuesFunction, + set_value: SetValueFunction, +) -> Weight +where + T: Config, + GetValuesFunction: Fn() -> Vec<(T::AccountId, u64)>, // (account, limit in blocks) + SetValueFunction: Fn(T::AccountId, u64), +{ + // Initialize the weight with one read operation. + let mut weight = T::DbWeight::get().reads(1); + + // Check if the migration has already run + if HasMigrationRun::::get(&migration_name) { + log::info!("Migration '{migration_name:?}' has already run. Skipping.",); + return weight; + } + log::info!( + "Running migration '{}'", + String::from_utf8_lossy(&migration_name) + ); + + let key_values = get_values(); + weight = weight.saturating_add(T::DbWeight::get().reads(key_values.len() as u64)); + + for (account, block) in key_values.into_iter() { + set_value(account, block); + + weight = weight.saturating_add(T::DbWeight::get().writes(2)); + weight = weight.saturating_add(T::DbWeight::get().reads(1)); + } + + // Mark the migration as completed + HasMigrationRun::::insert(&migration_name, true); + weight = weight.saturating_add(T::DbWeight::get().writes(1)); + + log::info!( + "Migration '{:?}' completed.", + String::from_utf8_lossy(&migration_name) + ); + + // Return the migration weight. + weight +} diff --git a/pallets/subtensor/src/migrations/migrate_remove_network_modality.rs b/pallets/subtensor/src/migrations/migrate_remove_network_modality.rs new file mode 100644 index 0000000000..c39291d3b4 --- /dev/null +++ b/pallets/subtensor/src/migrations/migrate_remove_network_modality.rs @@ -0,0 +1,64 @@ +use super::*; +use crate::HasMigrationRun; +use frame_support::{storage_alias, traits::Get, weights::Weight}; +use scale_info::prelude::string::String; +use sp_std::vec::Vec; + +/// Module containing deprecated storage format for NetworkModality +pub mod deprecated_network_modality_format { + use super::*; + + #[storage_alias] + pub(super) type NetworkModality = + StorageMap, Identity, NetUid, u16, ValueQuery>; +} + +pub fn migrate_remove_network_modality() -> Weight { + const MIG_NAME: &[u8] = b"migrate_remove_network_modality"; + + // 1 ─ check if we already ran + if HasMigrationRun::::get(MIG_NAME) { + log::info!( + "Migration '{}' already executed - skipping", + String::from_utf8_lossy(MIG_NAME) + ); + return T::DbWeight::get().reads(1); + } + + log::info!("Running migration '{}'", String::from_utf8_lossy(MIG_NAME)); + + let mut total_weight = T::DbWeight::get().reads(1); + + // 2 ─ remove NetworkModality entries for all existing networks + let total_networks = TotalNetworks::::get(); + total_weight = total_weight.saturating_add(T::DbWeight::get().reads(1)); + + // Use raw storage operations to remove NetworkModality entries + // NetworkModality was a StorageMap<_, Identity, NetUid, u16> + let pallet_prefix = sp_io::hashing::twox_128("SubtensorModule".as_bytes()); + let storage_prefix = sp_io::hashing::twox_128("NetworkModality".as_bytes()); + + for netuid in 0..total_networks { + let netuid = NetUid::from(netuid); + let mut key = Vec::new(); + key.extend_from_slice(&pallet_prefix); + key.extend_from_slice(&storage_prefix); + // Identity encoding for netuid + key.extend_from_slice(&netuid.encode()); + + // Clear the storage entry if it exists + sp_io::storage::clear_prefix(&key, None); + total_weight = total_weight.saturating_add(T::DbWeight::get().writes(1)); + } + + // 3 ─ mark migration as done + HasMigrationRun::::insert(MIG_NAME, true); + total_weight = total_weight.saturating_add(T::DbWeight::get().writes(1)); + + log::info!( + "Migration '{}' completed: removed NetworkModality storage for {} networks", + String::from_utf8_lossy(MIG_NAME), + total_networks + ); + total_weight +} diff --git a/pallets/subtensor/src/migrations/mod.rs b/pallets/subtensor/src/migrations/mod.rs index 65dda18125..b7265cc6d0 100644 --- a/pallets/subtensor/src/migrations/mod.rs +++ b/pallets/subtensor/src/migrations/mod.rs @@ -22,7 +22,9 @@ pub mod migrate_init_total_issuance; pub mod migrate_orphaned_storage_items; pub mod migrate_populate_owned_hotkeys; pub mod migrate_rao; +pub mod migrate_rate_limiting_last_blocks; pub mod migrate_remove_commitments_rate_limit; +pub mod migrate_remove_network_modality; pub mod migrate_remove_stake_map; pub mod migrate_remove_total_hotkey_coldkey_stakes_this_interval; pub mod migrate_remove_unused_maps_and_values; diff --git a/pallets/subtensor/src/rpc_info/metagraph.rs b/pallets/subtensor/src/rpc_info/metagraph.rs index 7f9dc46bee..1ad09d4bbb 100644 --- a/pallets/subtensor/src/rpc_info/metagraph.rs +++ b/pallets/subtensor/src/rpc_info/metagraph.rs @@ -4,6 +4,7 @@ use crate::epoch::math::*; use codec::Compact; use frame_support::IterableStorageDoubleMap; use frame_support::pallet_prelude::{Decode, Encode}; +use pallet_commitments::GetCommitments; use substrate_fixed::types::I64F64; use substrate_fixed::types::I96F32; use subtensor_macros::freeze_struct; @@ -109,7 +110,7 @@ pub struct Metagraph { alpha_dividends_per_hotkey: Vec<(AccountId, Compact)>, // List of dividend payout in alpha via subnet. } -#[freeze_struct("7604bd3817c55848")] +#[freeze_struct("56156d51c66190e8")] #[derive(Decode, Encode, PartialEq, Eq, Clone, Debug, TypeInfo)] pub struct SelectiveMetagraph { // Subnet index @@ -210,6 +211,8 @@ pub struct SelectiveMetagraph { // validators validators: Option>>, // List of validators + // commitments + commitments: Option>)>>, // List of commitments } impl SelectiveMetagraph @@ -367,6 +370,9 @@ where self.alpha_dividends_per_hotkey = other.alpha_dividends_per_hotkey.clone() } Some(SelectiveMetagraphIndex::Validators) => self.validators = other.validators.clone(), + Some(SelectiveMetagraphIndex::Commitments) => { + self.commitments = other.commitments.clone() + } None => {} }; } @@ -451,6 +457,7 @@ where tao_dividends_per_hotkey: None, alpha_dividends_per_hotkey: None, validators: None, + commitments: None, } } } @@ -529,6 +536,7 @@ pub enum SelectiveMetagraphIndex { TaoDividendsPerHotkey, AlphaDividendsPerHotkey, Validators, + Commitments, } impl SelectiveMetagraphIndex { @@ -607,6 +615,7 @@ impl SelectiveMetagraphIndex { 70 => Some(SelectiveMetagraphIndex::TaoDividendsPerHotkey), 71 => Some(SelectiveMetagraphIndex::AlphaDividendsPerHotkey), 72 => Some(SelectiveMetagraphIndex::Validators), + 73 => Some(SelectiveMetagraphIndex::Commitments), _ => None, } } @@ -1367,6 +1376,7 @@ impl Pallet { } } Some(SelectiveMetagraphIndex::Validators) => Self::get_validators(netuid), + Some(SelectiveMetagraphIndex::Commitments) => Self::get_commitments(netuid), None => SelectiveMetagraph { // Subnet index netuid: netuid.into(), @@ -1413,6 +1423,25 @@ impl Pallet { ..Default::default() } } + + fn get_commitments(netuid: NetUid) -> SelectiveMetagraph { + let commitments = ::GetCommitments::get_commitments(netuid); + let commitments: Vec<(T::AccountId, Vec>)> = commitments + .iter() + .map(|(account, commitment)| { + let compact_commitment = commitment + .iter() + .map(|c| Compact::from(*c)) + .collect::>>(); + (account.clone(), compact_commitment) + }) + .collect(); + + SelectiveMetagraph { + commitments: Some(commitments), + ..Default::default() + } + } } #[test] @@ -1492,6 +1521,7 @@ fn test_selective_metagraph() { tao_dividends_per_hotkey: None, alpha_dividends_per_hotkey: None, validators: None, + commitments: None, }; // test init value diff --git a/pallets/subtensor/src/rpc_info/subnet_info.rs b/pallets/subtensor/src/rpc_info/subnet_info.rs index d1e0a05419..11d60b2bc9 100644 --- a/pallets/subtensor/src/rpc_info/subnet_info.rs +++ b/pallets/subtensor/src/rpc_info/subnet_info.rs @@ -141,7 +141,6 @@ impl Pallet { let max_allowed_uids = Self::get_max_allowed_uids(netuid); let blocks_since_last_step = Self::get_blocks_since_last_step(netuid); let tempo = Self::get_tempo(netuid); - let network_modality = >::get(netuid); let burn = Compact::from(Self::get_burn(netuid)); // DEPRECATED let network_connect: Vec<[u16; 2]> = Vec::<[u16; 2]>::new(); @@ -163,7 +162,7 @@ impl Pallet { max_allowed_uids: max_allowed_uids.into(), blocks_since_last_step: blocks_since_last_step.into(), tempo: tempo.into(), - network_modality: network_modality.into(), + network_modality: 0_u16.into(), network_connect, emission_values: 0.into(), burn, @@ -210,7 +209,6 @@ impl Pallet { let max_allowed_uids = Self::get_max_allowed_uids(netuid); let blocks_since_last_step = Self::get_blocks_since_last_step(netuid); let tempo = Self::get_tempo(netuid); - let network_modality = >::get(netuid); let burn = Compact::from(Self::get_burn(netuid)); let identity: Option = SubnetIdentitiesV3::::get(netuid); @@ -234,7 +232,7 @@ impl Pallet { max_allowed_uids: max_allowed_uids.into(), blocks_since_last_step: blocks_since_last_step.into(), tempo: tempo.into(), - network_modality: network_modality.into(), + network_modality: 0.into(), network_connect, emission_value: 0.into(), burn, diff --git a/pallets/subtensor/src/staking/add_stake.rs b/pallets/subtensor/src/staking/add_stake.rs index fe90de270a..740d42d09e 100644 --- a/pallets/subtensor/src/staking/add_stake.rs +++ b/pallets/subtensor/src/staking/add_stake.rs @@ -76,6 +76,7 @@ impl Pallet { tao_staked.saturating_to_num::().into(), T::SwapInterface::max_price().into(), true, + false, )?; // Ok and return. @@ -164,7 +165,15 @@ impl Pallet { // 6. Swap the stake into alpha on the subnet and increase counters. // Emit the staking event. - Self::stake_into_subnet(&hotkey, &coldkey, netuid, tao_staked, limit_price, true)?; + Self::stake_into_subnet( + &hotkey, + &coldkey, + netuid, + tao_staked, + limit_price, + true, + false, + )?; // Ok and return. Ok(()) diff --git a/pallets/subtensor/src/staking/helpers.rs b/pallets/subtensor/src/staking/helpers.rs index 7b8d0ba1de..7b1b644e85 100644 --- a/pallets/subtensor/src/staking/helpers.rs +++ b/pallets/subtensor/src/staking/helpers.rs @@ -184,7 +184,7 @@ impl Pallet { ) { // Verify if the account is a nominator account by checking ownership of the hotkey by the coldkey. if !Self::coldkey_owns_hotkey(coldkey, hotkey) { - // If the stake is below the minimum required, it's considered a small nomination and needs to be cleared. + // If the stake is non-zero and below the minimum required, it's considered a small nomination and needs to be cleared. // Log if the stake is below the minimum required let alpha_stake = Self::get_stake_for_hotkey_and_coldkey_on_subnet(hotkey, coldkey, netuid); @@ -192,7 +192,7 @@ impl Pallet { U96F32::saturating_from_num(Self::get_nominator_min_required_stake()) .safe_div(T::SwapInterface::current_alpha_price(netuid)) .saturating_to_num::(); - if alpha_stake < min_alpha_stake.into() { + if alpha_stake > 0.into() && alpha_stake < min_alpha_stake.into() { // Log the clearing of a small nomination // Remove the stake from the nominator account. (this is a more forceful unstake operation which ) // Actually deletes the staking account. @@ -321,4 +321,10 @@ impl Pallet { pub fn is_user_liquidity_enabled(netuid: NetUid) -> bool { T::SwapInterface::is_user_liquidity_enabled(netuid) } + + pub fn recycle_subnet_alpha(netuid: NetUid, amount: AlphaCurrency) { + SubnetAlphaOut::::mutate(netuid, |total| { + *total = total.saturating_sub(amount); + }); + } } diff --git a/pallets/subtensor/src/staking/move_stake.rs b/pallets/subtensor/src/staking/move_stake.rs index c81569e49d..589da2b4b8 100644 --- a/pallets/subtensor/src/staking/move_stake.rs +++ b/pallets/subtensor/src/staking/move_stake.rs @@ -350,6 +350,10 @@ impl Pallet { }; if origin_netuid != destination_netuid { + // Any way to charge fees that works + let drop_fee_origin = origin_netuid == NetUid::ROOT; + let drop_fee_destination = !drop_fee_origin; + // do not pay remove fees to avoid double fees in moves transactions let tao_unstaked = Self::unstake_from_subnet( origin_hotkey, @@ -357,7 +361,7 @@ impl Pallet { origin_netuid, move_amount, T::SwapInterface::min_price().into(), - true, + drop_fee_origin, )?; // Stake the unstaked amount into the destination. @@ -376,6 +380,7 @@ impl Pallet { tao_unstaked, T::SwapInterface::max_price().into(), set_limit, + drop_fee_destination, )?; } diff --git a/pallets/subtensor/src/staking/recycle_alpha.rs b/pallets/subtensor/src/staking/recycle_alpha.rs index cbd5161a4c..4c1bbd0b9f 100644 --- a/pallets/subtensor/src/staking/recycle_alpha.rs +++ b/pallets/subtensor/src/staking/recycle_alpha.rs @@ -1,6 +1,6 @@ use super::*; use crate::{Error, system::ensure_signed}; -use subtensor_runtime_common::{AlphaCurrency, Currency, NetUid}; +use subtensor_runtime_common::{AlphaCurrency, NetUid}; impl Pallet { /// Recycles alpha from a cold/hot key pair, reducing AlphaOut on a subnet @@ -59,9 +59,7 @@ impl Pallet { ); // Recycle means we should decrease the alpha issuance tracker. - SubnetAlphaOut::::mutate(netuid, |total| { - *total = total.saturating_sub(actual_alpha_decrease); - }); + Self::recycle_subnet_alpha(netuid, amount); Self::deposit_event(Event::AlphaRecycled( coldkey, diff --git a/pallets/subtensor/src/staking/remove_stake.rs b/pallets/subtensor/src/staking/remove_stake.rs index c0311f7f33..fd9a974645 100644 --- a/pallets/subtensor/src/staking/remove_stake.rs +++ b/pallets/subtensor/src/staking/remove_stake.rs @@ -281,6 +281,7 @@ impl Pallet { total_tao_unstaked, T::SwapInterface::max_price().into(), false, // no limit for Root subnet + false, )?; // 5. Done and ok. diff --git a/pallets/subtensor/src/staking/stake_utils.rs b/pallets/subtensor/src/staking/stake_utils.rs index 8dff984099..528289ec0e 100644 --- a/pallets/subtensor/src/staking/stake_utils.rs +++ b/pallets/subtensor/src/staking/stake_utils.rs @@ -96,6 +96,11 @@ impl Pallet { // This ensures the result is always between 0 and 1 weight_fixed.safe_div(U96F32::saturating_from_num(u64::MAX)) } + pub fn get_ck_burn() -> U96F32 { + let stored_weight = CKBurn::::get(); + let weight_fixed = U96F32::saturating_from_num(stored_weight); + weight_fixed.safe_div(U96F32::saturating_from_num(u64::MAX)) + } /// Sets the global global weight in storage. /// @@ -117,6 +122,11 @@ impl Pallet { // Update the TaoWeight storage with the new weight value TaoWeight::::set(weight); } + // Set the amount burned on non owned CK + pub fn set_ck_burn(weight: u64) { + // Update the ck burn value. + CKBurn::::set(weight); + } /// Calculates the weighted combination of alpha and global tao for a single hotkey onet a subnet. /// @@ -767,9 +777,10 @@ impl Pallet { tao: TaoCurrency, price_limit: TaoCurrency, set_limit: bool, + drop_fees: bool, ) -> Result { // Swap the tao to alpha. - let swap_result = Self::swap_tao_for_alpha(netuid, tao, price_limit, false)?; + let swap_result = Self::swap_tao_for_alpha(netuid, tao, price_limit, drop_fees)?; ensure!(swap_result.amount_paid_out > 0, Error::::AmountTooLow); diff --git a/pallets/subtensor/src/subnets/registration.rs b/pallets/subtensor/src/subnets/registration.rs index bfde68601d..c8f6b04cb6 100644 --- a/pallets/subtensor/src/subnets/registration.rs +++ b/pallets/subtensor/src/subnets/registration.rs @@ -369,7 +369,7 @@ impl Pallet { // --- 5. Add Balance via faucet. let balance_to_add: u64 = 1_000_000_000_000; - Self::coinbase(100_000_000_000.into()); // We are creating tokens here from the coinbase. + Self::increase_issuance(100_000_000_000.into()); // We are creating tokens here from the coinbase. Self::add_balance_to_coldkey_account(&coldkey, balance_to_add); diff --git a/pallets/subtensor/src/subnets/subnet.rs b/pallets/subtensor/src/subnets/subnet.rs index 17e349c995..38be89cba0 100644 --- a/pallets/subtensor/src/subnets/subnet.rs +++ b/pallets/subtensor/src/subnets/subnet.rs @@ -134,9 +134,8 @@ impl Pallet { // --- 4. Rate limit for network registrations. let current_block = Self::get_current_block_as_u64(); - let last_lock_block = Self::get_network_last_lock_block(); ensure!( - current_block.saturating_sub(last_lock_block) >= NetworkRateLimit::::get(), + Self::passes_rate_limit(&TransactionType::RegisterNetwork, &coldkey), Error::::NetworkTxRateLimitExceeded ); @@ -174,7 +173,7 @@ impl Pallet { log::debug!("SubnetMechanism for netuid {netuid_to_register:?} set to: {mechid:?}"); // --- 12. Set the creation terms. - NetworkLastRegistered::::set(current_block); + Self::set_network_last_lock_block(current_block); NetworkRegisteredAt::::insert(netuid_to_register, current_block); // --- 13. Set the symbol. @@ -237,13 +236,10 @@ impl Pallet { // --- 3. Fill tempo memory item. Tempo::::insert(netuid, tempo); - // --- 4 Fill modality item. - NetworkModality::::insert(netuid, 0); - - // --- 5. Increase total network count. + // --- 4. Increase total network count. TotalNetworks::::mutate(|n| *n = n.saturating_add(1)); - // --- 6. Set all default values **explicitly**. + // --- 5. Set all default values **explicitly**. Self::set_network_registration_allowed(netuid, true); Self::set_max_allowed_uids(netuid, 256); Self::set_max_allowed_validators(netuid, 64); diff --git a/pallets/subtensor/src/subnets/uids.rs b/pallets/subtensor/src/subnets/uids.rs index f5a14c490b..d6b776252e 100644 --- a/pallets/subtensor/src/subnets/uids.rs +++ b/pallets/subtensor/src/subnets/uids.rs @@ -81,7 +81,7 @@ impl Pallet { // 1. Get the next uid. This is always equal to subnetwork_n. let next_uid: u16 = Self::get_subnetwork_n(netuid); log::debug!( - "append_neuron( netuid: {netuid:?} | next_uid: {new_hotkey:?} | new_hotkey: {next_uid:?} ) " + "append_neuron( netuid: {netuid:?} | next_uid: {next_uid:?} | new_hotkey: {new_hotkey:?} ) " ); // 2. Get and increase the uid count. diff --git a/pallets/subtensor/src/swap/swap_coldkey.rs b/pallets/subtensor/src/swap/swap_coldkey.rs index 91da83e4e7..f7f9997183 100644 --- a/pallets/subtensor/src/swap/swap_coldkey.rs +++ b/pallets/subtensor/src/swap/swap_coldkey.rs @@ -178,6 +178,11 @@ impl Pallet { weight.saturating_accrue(T::DbWeight::get().reads_writes(2, 2)); } + if let Some(old_auto_stake_hotkey) = AutoStakeDestination::::get(old_coldkey) { + AutoStakeDestination::::remove(old_coldkey); + AutoStakeDestination::::insert(new_coldkey, old_auto_stake_hotkey); + } + // 4. Swap TotalColdkeyAlpha (DEPRECATED) // for netuid in Self::get_all_subnet_netuids() { // let old_alpha_stake: u64 = TotalColdkeyAlpha::::get(old_coldkey, netuid); diff --git a/pallets/subtensor/src/swap/swap_hotkey.rs b/pallets/subtensor/src/swap/swap_hotkey.rs index e233460e39..0454b1dd16 100644 --- a/pallets/subtensor/src/swap/swap_hotkey.rs +++ b/pallets/subtensor/src/swap/swap_hotkey.rs @@ -64,21 +64,18 @@ impl Pallet { ); // 8. Swap LastTxBlock - // LastTxBlock( hotkey ) --> u64 -- the last transaction block for the hotkey. - let last_tx_block: u64 = LastTxBlock::::get(old_hotkey); - LastTxBlock::::insert(new_hotkey, last_tx_block); + let last_tx_block: u64 = Self::get_last_tx_block(old_hotkey); + Self::set_last_tx_block(new_hotkey, last_tx_block); weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1)); // 9. Swap LastTxBlockDelegateTake - // LastTxBlockDelegateTake( hotkey ) --> u64 -- the last transaction block for the hotkey delegate take. - let last_tx_block_delegate_take: u64 = LastTxBlockDelegateTake::::get(old_hotkey); - LastTxBlockDelegateTake::::insert(new_hotkey, last_tx_block_delegate_take); + let last_tx_block_delegate_take: u64 = Self::get_last_tx_block_delegate_take(old_hotkey); + Self::set_last_tx_block_delegate_take(new_hotkey, last_tx_block_delegate_take); weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1)); // 10. Swap LastTxBlockChildKeyTake - // LastTxBlockChildKeyTake( hotkey ) --> u64 -- the last transaction block for the hotkey child key take. - let last_tx_block_child_key_take: u64 = LastTxBlockChildKeyTake::::get(old_hotkey); - LastTxBlockChildKeyTake::::insert(new_hotkey, last_tx_block_child_key_take); + let last_tx_block_child_key_take: u64 = Self::get_last_tx_block_childkey_take(old_hotkey); + Self::set_last_tx_block_childkey(new_hotkey, last_tx_block_child_key_take); weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1)); // 11. fork for swap hotkey on a specific subnet case after do the common check @@ -197,17 +194,17 @@ impl Pallet { // 6. Swap LastTxBlock // LastTxBlock( hotkey ) --> u64 -- the last transaction block for the hotkey. - LastTxBlock::::remove(old_hotkey); + Self::remove_last_tx_block(old_hotkey); weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 2)); // 7. Swap LastTxBlockDelegateTake // LastTxBlockDelegateTake( hotkey ) --> u64 -- the last transaction block for the hotkey delegate take. - LastTxBlockDelegateTake::::remove(old_hotkey); + Self::remove_last_tx_block_delegate_take(old_hotkey); weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 2)); // 8. Swap LastTxBlockChildKeyTake // LastTxBlockChildKeyTake( hotkey ) --> u64 -- the last transaction block for the hotkey child key take. - LastTxBlockChildKeyTake::::remove(old_hotkey); + Self::remove_last_tx_block_childkey(old_hotkey); weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 2)); // 9. Swap Senate members. diff --git a/pallets/subtensor/src/tests/children.rs b/pallets/subtensor/src/tests/children.rs index 2ffc21ea1d..a0505fa9f3 100644 --- a/pallets/subtensor/src/tests/children.rs +++ b/pallets/subtensor/src/tests/children.rs @@ -2861,6 +2861,7 @@ fn test_childkey_take_drain() { // Add network, register hotkeys, and setup network parameters add_network(netuid, subnet_tempo, 0); + SubtensorModule::set_ck_burn(0); mock::setup_reserves(netuid, (stake * 10_000).into(), (stake * 10_000).into()); register_ok_neuron(netuid, child_hotkey, child_coldkey, 0); register_ok_neuron(netuid, parent_hotkey, parent_coldkey, 1); @@ -2980,6 +2981,7 @@ fn test_parent_child_chain_emission() { let subnet_owner_coldkey = U256::from(1001); let subnet_owner_hotkey = U256::from(1002); let netuid = add_dynamic_network(&subnet_owner_hotkey, &subnet_owner_coldkey); + SubtensorModule::set_ck_burn(0); Tempo::::insert(netuid, 1); // Setup large LPs to prevent slippage @@ -3192,6 +3194,7 @@ fn test_parent_child_chain_epoch() { new_test_ext(1).execute_with(|| { let netuid = NetUid::from(1); add_network(netuid, 1, 0); + SubtensorModule::set_ck_burn(0); // Set owner cut to 0 SubtensorModule::set_subnet_owner_cut(0_u16); @@ -3336,6 +3339,7 @@ fn test_dividend_distribution_with_children() { new_test_ext(1).execute_with(|| { let netuid = NetUid::from(1); add_network(netuid, 1, 0); + SubtensorModule::set_ck_burn(0); mock::setup_reserves( netuid, 1_000_000_000_000_000.into(), @@ -3570,6 +3574,7 @@ fn test_dividend_distribution_with_children() { fn test_dynamic_parent_child_relationships() { new_test_ext(1).execute_with(|| { let netuid = NetUid::from(1); + SubtensorModule::set_ck_burn(0); add_network_disable_commit_reveal(netuid, 1, 0); // Define hotkeys and coldkeys diff --git a/pallets/subtensor/src/tests/coinbase.rs b/pallets/subtensor/src/tests/coinbase.rs index 927f98e2fa..30cef8556f 100644 --- a/pallets/subtensor/src/tests/coinbase.rs +++ b/pallets/subtensor/src/tests/coinbase.rs @@ -1063,6 +1063,7 @@ fn test_drain_alpha_childkey_parentkey() { new_test_ext(1).execute_with(|| { let netuid = NetUid::from(1); add_network(netuid, 1, 0); + SubtensorModule::set_ck_burn(0); let parent = U256::from(1); let child = U256::from(2); let coldkey = U256::from(3); @@ -1238,6 +1239,7 @@ fn test_get_root_children_drain() { let alpha = NetUid::from(1); add_network(NetUid::ROOT, 1, 0); add_network(alpha, 1, 0); + SubtensorModule::set_ck_burn(0); // Set TAO weight to 1. SubtensorModule::set_tao_weight(u64::MAX); // Set TAO weight to 1. // Create keys. @@ -1399,6 +1401,7 @@ fn test_get_root_children_drain_half_proportion() { let alpha = NetUid::from(1); add_network(NetUid::ROOT, 1, 0); add_network(alpha, 1, 0); + SubtensorModule::set_ck_burn(0); // Set TAO weight to 1. SubtensorModule::set_tao_weight(u64::MAX); // Set TAO weight to 1. // Create keys. @@ -1576,6 +1579,7 @@ fn test_get_root_children_drain_with_half_take() { add_network(alpha, 1, 0); // Set TAO weight to 1. SubtensorModule::set_tao_weight(u64::MAX); // Set TAO weight to 1. + SubtensorModule::set_ck_burn(0); // Create keys. let cold_alice = U256::from(0); let cold_bob = U256::from(1); @@ -2749,3 +2753,173 @@ fn test_coinbase_v3_liquidity_update() { assert!(liquidity_before < liquidity_after); }); } + +// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --package pallet-subtensor --lib -- tests::coinbase::test_drain_alpha_childkey_parentkey_with_burn --exact --show-output --nocapture +#[test] +fn test_drain_alpha_childkey_parentkey_with_burn() { + new_test_ext(1).execute_with(|| { + let netuid = NetUid::from(1); + add_network(netuid, 1, 0); + let parent = U256::from(1); + let child = U256::from(2); + let coldkey = U256::from(3); + let stake_before = AlphaCurrency::from(1_000_000_000); + register_ok_neuron(netuid, child, coldkey, 0); + SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet( + &parent, + &coldkey, + netuid, + stake_before, + ); + mock_set_children_no_epochs(netuid, &parent, &[(u64::MAX, child)]); + + // Childkey take is 10% + ChildkeyTake::::insert(child, netuid, u16::MAX / 10); + + let burn_rate = SubtensorModule::get_ck_burn(); + let parent_stake_before = SubtensorModule::get_stake_for_hotkey_on_subnet(&parent, netuid); + let child_stake_before = SubtensorModule::get_stake_for_hotkey_on_subnet(&child, netuid); + + let pending_alpha = AlphaCurrency::from(1_000_000_000); + SubtensorModule::drain_pending_emission( + netuid, + pending_alpha, + TaoCurrency::ZERO, + AlphaCurrency::ZERO, + AlphaCurrency::ZERO, + ); + let parent_stake_after = SubtensorModule::get_stake_for_hotkey_on_subnet(&parent, netuid); + let child_stake_after = SubtensorModule::get_stake_for_hotkey_on_subnet(&child, netuid); + + let expected_ck_burn = I96F32::from_num(pending_alpha) + * I96F32::from_num(9.0 / 10.0) + * I96F32::from_num(burn_rate); + + let expected_total = I96F32::from_num(pending_alpha) - expected_ck_burn; + let parent_ratio = (I96F32::from_num(pending_alpha) * I96F32::from_num(9.0 / 10.0) + - expected_ck_burn) + / expected_total; + let child_ratio = (I96F32::from_num(pending_alpha) / I96F32::from_num(10)) / expected_total; + + let expected = + I96F32::from_num(stake_before) + I96F32::from_num(pending_alpha) * parent_ratio; + log::info!( + "expected: {:?}, parent_stake_after: {:?}", + expected.to_num::(), + parent_stake_after + ); + + close( + expected.to_num::(), + parent_stake_after.into(), + 3_000_000, + ); + let expected = I96F32::from_num(u64::from(pending_alpha)) * child_ratio; + close( + expected.to_num::(), + child_stake_after.into(), + 3_000_000, + ); + }); +} + +#[test] +fn test_incentive_is_autostaked_to_owner_destination() { + new_test_ext(1).execute_with(|| { + let subnet_owner_ck = U256::from(0); + let subnet_owner_hk = U256::from(1); + + let miner_ck = U256::from(10); + let miner_hk = U256::from(11); + let dest_hk = U256::from(12); + + Owner::::insert(miner_hk, miner_ck); + Owner::::insert(dest_hk, miner_ck); + OwnedHotkeys::::insert(miner_ck, vec![miner_hk, dest_hk]); + + let netuid = add_dynamic_network(&subnet_owner_hk, &subnet_owner_ck); + + Uids::::insert(netuid, miner_hk, 1); + Uids::::insert(netuid, dest_hk, 2); + + // Set autostake destination for the miner's coldkey + assert_ok!(SubtensorModule::set_coldkey_auto_stake_hotkey( + RuntimeOrigin::signed(miner_ck), + dest_hk, + )); + + assert_eq!( + SubtensorModule::get_stake_for_hotkey_on_subnet(&miner_hk, netuid), + 0.into() + ); + assert_eq!( + SubtensorModule::get_stake_for_hotkey_on_subnet(&dest_hk, netuid), + 0.into() + ); + + // Distribute an incentive to the miner hotkey + let mut incentives: BTreeMap = BTreeMap::new(); + let incentive: AlphaCurrency = 10_000_000u64.into(); + incentives.insert(miner_hk, incentive); + + SubtensorModule::distribute_dividends_and_incentives( + netuid, + AlphaCurrency::ZERO, // owner_cut + incentives, + BTreeMap::new(), // alpha_dividends + BTreeMap::new(), // tao_dividends + ); + + // Expect the stake to land on the destination hotkey (not the original miner hotkey) + assert_eq!( + SubtensorModule::get_stake_for_hotkey_on_subnet(&miner_hk, netuid), + 0.into() + ); + assert_eq!( + SubtensorModule::get_stake_for_hotkey_on_subnet(&dest_hk, netuid), + incentive + ); + }); +} + +#[test] +fn test_incentive_goes_to_hotkey_when_no_autostake_destination() { + new_test_ext(1).execute_with(|| { + let subnet_owner_ck = U256::from(0); + let subnet_owner_hk = U256::from(1); + + let miner_ck = U256::from(20); + let miner_hk = U256::from(21); + + Owner::::insert(miner_hk, miner_ck); + OwnedHotkeys::::insert(miner_ck, vec![miner_hk]); + + let netuid = add_dynamic_network(&subnet_owner_hk, &subnet_owner_ck); + + Uids::::insert(netuid, miner_hk, 1); + + assert_eq!( + SubtensorModule::get_stake_for_hotkey_on_subnet(&miner_hk, netuid), + 0.into() + ); + + // Distribute an incentive to the miner hotkey + let mut incentives: BTreeMap = BTreeMap::new(); + let incentive: AlphaCurrency = 5_000_000u64.into(); + incentives.insert(miner_hk, incentive); + + SubtensorModule::distribute_dividends_and_incentives( + netuid, + AlphaCurrency::ZERO, // owner_cut + incentives, + BTreeMap::new(), // alpha_dividends + BTreeMap::new(), // tao_dividends + ); + + // With no autostake destination, the incentive should be staked to the original hotkey + assert_eq!( + SubtensorModule::get_stake_for_hotkey_on_subnet(&miner_hk, netuid), + incentive + ); + }); +} diff --git a/pallets/subtensor/src/tests/migration.rs b/pallets/subtensor/src/tests/migration.rs index e93aab7669..d67b86e42d 100644 --- a/pallets/subtensor/src/tests/migration.rs +++ b/pallets/subtensor/src/tests/migration.rs @@ -821,6 +821,206 @@ fn test_migrate_remove_commitments_rate_limit() { }); } +#[test] +fn test_migrate_network_last_registered() { + new_test_ext(1).execute_with(|| { + // ------------------------------ + // Step 1: Simulate Old Storage Entry + // ------------------------------ + const MIGRATION_NAME: &str = "migrate_network_last_registered"; + + let pallet_name = "SubtensorModule"; + let storage_name = "NetworkLastRegistered"; + let pallet_name_hash = twox_128(pallet_name.as_bytes()); + let storage_name_hash = twox_128(storage_name.as_bytes()); + let prefix = [pallet_name_hash, storage_name_hash].concat(); + + let mut full_key = prefix.clone(); + + let original_value: u64 = 123; + put_raw(&full_key, &original_value.encode()); + + let stored_before = get_raw(&full_key).expect("Expected RateLimit to exist"); + assert_eq!( + u64::decode(&mut &stored_before[..]).expect("Failed to decode RateLimit"), + original_value + ); + + assert!( + !HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should not have run yet" + ); + + // ------------------------------ + // Step 2: Run the Migration + // ------------------------------ + let weight = crate::migrations::migrate_rate_limiting_last_blocks:: + migrate_obsolete_rate_limiting_last_blocks_storage::(); + + assert!( + HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should be marked as completed" + ); + + // ------------------------------ + // Step 3: Verify Migration Effects + // ------------------------------ + + assert_eq!( + SubtensorModule::get_network_last_lock_block(), + original_value + ); + assert_eq!( + get_raw(&full_key), + None, + "RateLimit storage should have been cleared" + ); + + assert!(!weight.is_zero(), "Migration weight should be non-zero"); + }); +} + +#[allow(deprecated)] +#[test] +fn test_migrate_last_block_tx() { + new_test_ext(1).execute_with(|| { + // ------------------------------ + // Step 1: Simulate Old Storage Entry + // ------------------------------ + const MIGRATION_NAME: &str = "migrate_last_tx_block"; + + let test_account: U256 = U256::from(1); + let original_value: u64 = 123; + + LastTxBlock::::insert(test_account, original_value); + + assert!( + !HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should not have run yet" + ); + + // ------------------------------ + // Step 2: Run the Migration + // ------------------------------ + let weight = crate::migrations::migrate_rate_limiting_last_blocks:: + migrate_obsolete_rate_limiting_last_blocks_storage::(); + + assert!( + HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should be marked as completed" + ); + + // ------------------------------ + // Step 3: Verify Migration Effects + // ------------------------------ + + assert_eq!( + SubtensorModule::get_last_tx_block(&test_account), + original_value + ); + assert!( + !LastTxBlock::::contains_key(test_account), + "RateLimit storage should have been cleared" + ); + + assert!(!weight.is_zero(), "Migration weight should be non-zero"); + }); +} + +#[allow(deprecated)] +#[test] +fn test_migrate_last_tx_block_childkey_take() { + new_test_ext(1).execute_with(|| { + // ------------------------------ + // Step 1: Simulate Old Storage Entry + // ------------------------------ + const MIGRATION_NAME: &str = "migrate_last_tx_block_childkey_take"; + + let test_account: U256 = U256::from(1); + let original_value: u64 = 123; + + LastTxBlockChildKeyTake::::insert(test_account, original_value); + + assert!( + !HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should not have run yet" + ); + + // ------------------------------ + // Step 2: Run the Migration + // ------------------------------ + let weight = crate::migrations::migrate_rate_limiting_last_blocks:: + migrate_obsolete_rate_limiting_last_blocks_storage::(); + + assert!( + HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should be marked as completed" + ); + + // ------------------------------ + // Step 3: Verify Migration Effects + // ------------------------------ + + assert_eq!( + SubtensorModule::get_last_tx_block_childkey_take(&test_account), + original_value + ); + assert!( + !LastTxBlockChildKeyTake::::contains_key(test_account), + "RateLimit storage should have been cleared" + ); + + assert!(!weight.is_zero(), "Migration weight should be non-zero"); + }); +} + +#[allow(deprecated)] +#[test] +fn test_migrate_last_tx_block_delegate_take() { + new_test_ext(1).execute_with(|| { + // ------------------------------ + // Step 1: Simulate Old Storage Entry + // ------------------------------ + const MIGRATION_NAME: &str = "migrate_last_tx_block_delegate_take"; + + let test_account: U256 = U256::from(1); + let original_value: u64 = 123; + + LastTxBlockDelegateTake::::insert(test_account, original_value); + + assert!( + !HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should not have run yet" + ); + + // ------------------------------ + // Step 2: Run the Migration + // ------------------------------ + let weight = crate::migrations::migrate_rate_limiting_last_blocks:: + migrate_last_tx_block_delegate_take::(); + + assert!( + HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should be marked as completed" + ); + + // ------------------------------ + // Step 3: Verify Migration Effects + // ------------------------------ + + assert_eq!( + SubtensorModule::get_last_tx_block_delegate_take(&test_account), + original_value + ); + assert!( + !LastTxBlockDelegateTake::::contains_key(test_account), + "RateLimit storage should have been cleared" + ); + + assert!(!weight.is_zero(), "Migration weight should be non-zero"); + }); +} + #[test] fn test_migrate_fix_root_subnet_tao() { new_test_ext(1).execute_with(|| { @@ -1375,3 +1575,120 @@ fn test_migrate_crv3_v2_to_timelocked() { assert_eq!(round2, round); }); } + +#[test] +fn test_migrate_remove_network_modality() { + new_test_ext(1).execute_with(|| { + // ------------------------------ + // 0. Constants / helpers + // ------------------------------ + const MIGRATION_NAME: &str = "migrate_remove_network_modality"; + + // Create multiple networks to test + let netuids: [NetUid; 3] = [1.into(), 2.into(), 3.into()]; + for netuid in netuids.iter() { + add_network(*netuid, 1, 0); + } + + // Set initial storage version to 7 (below target) + StorageVersion::new(7).put::>(); + assert_eq!( + Pallet::::on_chain_storage_version(), + StorageVersion::new(7) + ); + + // ------------------------------ + // 1. Simulate NetworkModality entries using deprecated storage alias + // ------------------------------ + // We need to manually create storage entries that would exist for NetworkModality + // Since NetworkModality was a StorageMap<_, Identity, NetUid, u16>, we simulate this + let pallet_prefix = twox_128("SubtensorModule".as_bytes()); + let storage_prefix = twox_128("NetworkModality".as_bytes()); + + // Create NetworkModality entries for each network + for (i, netuid) in netuids.iter().enumerate() { + let mut key = Vec::new(); + key.extend_from_slice(&pallet_prefix); + key.extend_from_slice(&storage_prefix); + // Identity encoding for netuid + key.extend_from_slice(&netuid.encode()); + + let modality_value: u16 = (i as u16) + 1; // Different values for testing + put_raw(&key, &modality_value.encode()); + + // Verify the entry was created + let stored_value = get_raw(&key).expect("NetworkModality entry should exist"); + assert_eq!( + u16::decode(&mut &stored_value[..]).expect("Failed to decode modality"), + modality_value + ); + } + + assert!( + !HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should not have run yet" + ); + + // ------------------------------ + // 2. Run migration + // ------------------------------ + let weight = + crate::migrations::migrate_remove_network_modality::migrate_remove_network_modality::< + Test, + >(); + + // ------------------------------ + // 3. Verify migration effects + // ------------------------------ + assert!( + HasMigrationRun::::get(MIGRATION_NAME.as_bytes().to_vec()), + "Migration should be marked as run" + ); + + // Verify weight is non-zero + assert!(!weight.is_zero(), "Migration weight should be non-zero"); + + // Verify weight calculation: 1 read (version check) + 1 read (total networks) + N writes (removal) + 1 write (version update) + let expected_weight = ::DbWeight::get().reads(2) + + ::DbWeight::get().writes(netuids.len() as u64 + 1); + assert_eq!( + weight, expected_weight, + "Weight calculation should be correct" + ); + }); +} + +#[test] +fn test_migrate_remove_network_modality_already_run() { + new_test_ext(1).execute_with(|| { + const MIGRATION_NAME: &str = "migrate_remove_network_modality"; + + // Mark migration as already run + HasMigrationRun::::insert(MIGRATION_NAME.as_bytes().to_vec(), true); + + // Set storage version to 8 (target version) + StorageVersion::new(8).put::>(); + assert_eq!( + Pallet::::on_chain_storage_version(), + StorageVersion::new(8) + ); + + // Run migration + let weight = + crate::migrations::migrate_remove_network_modality::migrate_remove_network_modality::< + Test, + >(); + + // Should only have read weight for checking migration status + let expected_weight = ::DbWeight::get().reads(1); + assert_eq!( + weight, expected_weight, + "Second run should only read the migration flag" + ); + + // Verify migration is still marked as run + assert!(HasMigrationRun::::get( + MIGRATION_NAME.as_bytes().to_vec() + )); + }); +} diff --git a/pallets/subtensor/src/tests/mock.rs b/pallets/subtensor/src/tests/mock.rs index 8aa6fe6cdd..28da96687a 100644 --- a/pallets/subtensor/src/tests/mock.rs +++ b/pallets/subtensor/src/tests/mock.rs @@ -183,6 +183,8 @@ parameter_types! { pub const InitialBurn: u64 = 0; pub const InitialMinBurn: u64 = 500_000; pub const InitialMaxBurn: u64 = 1_000_000_000; + pub const MinBurnUpperBound: TaoCurrency = TaoCurrency::new(1_000_000_000); // 1 TAO + pub const MaxBurnLowerBound: TaoCurrency = TaoCurrency::new(100_000_000); // 0.1 TAO pub const InitialValidatorPruneLen: u64 = 0; pub const InitialScalingLawPower: u16 = 50; pub const InitialMaxAllowedValidators: u16 = 100; @@ -429,6 +431,8 @@ impl crate::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type MinBurnUpperBound = MinBurnUpperBound; + type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; type InitialSenateRequiredStakePercentage = InitialSenateRequiredStakePercentage; type InitialNetworkImmunityPeriod = InitialNetworkImmunityPeriod; @@ -454,6 +458,7 @@ impl crate::Config for Test { type HotkeySwapOnSubnetInterval = HotkeySwapOnSubnetInterval; type ProxyInterface = FakeProxier; type LeaseDividendsDistributionInterval = LeaseDividendsDistributionInterval; + type GetCommitments = (); } // Swap-related parameter types @@ -965,6 +970,7 @@ pub fn increase_stake_on_coldkey_hotkey_account( tao_staked, ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); } diff --git a/pallets/subtensor/src/tests/move_stake.rs b/pallets/subtensor/src/tests/move_stake.rs index 46f2a77e27..e49903aa86 100644 --- a/pallets/subtensor/src/tests/move_stake.rs +++ b/pallets/subtensor/src/tests/move_stake.rs @@ -35,6 +35,7 @@ fn test_do_move_success() { stake_amount, ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -111,6 +112,7 @@ fn test_do_move_different_subnets() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -180,6 +182,7 @@ fn test_do_move_nonexistent_subnet() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -283,6 +286,7 @@ fn test_do_move_nonexistent_destination_hotkey() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -347,6 +351,7 @@ fn test_do_move_partial_stake() { total_stake.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -415,6 +420,7 @@ fn test_do_move_multiple_times() { initial_stake.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = @@ -486,6 +492,7 @@ fn test_do_move_wrong_origin() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -552,6 +559,7 @@ fn test_do_move_same_hotkey_fails() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = @@ -602,6 +610,7 @@ fn test_do_move_event_emission() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -662,6 +671,7 @@ fn test_do_move_storage_updates() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -728,6 +738,7 @@ fn test_move_full_amount_same_netuid() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -795,6 +806,7 @@ fn test_do_move_max_values() { max_stake.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -900,6 +912,7 @@ fn test_do_transfer_success() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -1008,6 +1021,7 @@ fn test_do_transfer_insufficient_stake() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1048,6 +1062,7 @@ fn test_do_transfer_wrong_origin() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1085,6 +1100,7 @@ fn test_do_transfer_minimum_stake_check() { stake_amount, ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1132,6 +1148,7 @@ fn test_do_transfer_different_subnets() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1197,6 +1214,7 @@ fn test_do_swap_success() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha_before = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -1304,6 +1322,7 @@ fn test_do_swap_insufficient_stake() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1338,6 +1357,7 @@ fn test_do_swap_wrong_origin() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1375,6 +1395,7 @@ fn test_do_swap_minimum_stake_check() { total_stake, ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1410,6 +1431,7 @@ fn test_do_swap_same_subnet() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1454,6 +1476,7 @@ fn test_do_swap_partial_stake() { total_stake_tao.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let total_stake_alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -1505,6 +1528,7 @@ fn test_do_swap_storage_updates() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1564,6 +1588,7 @@ fn test_do_swap_multiple_times() { initial_stake.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -1634,6 +1659,7 @@ fn test_do_swap_allows_non_owned_hotkey() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha_before = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -1781,6 +1807,7 @@ fn test_transfer_stake_rate_limited() { stake_amount.into(), ::SwapInterface::max_price().into(), true, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -1825,6 +1852,7 @@ fn test_transfer_stake_doesnt_limit_destination_coldkey() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -1870,6 +1898,7 @@ fn test_swap_stake_limits_destination_netuid() { stake_amount.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); let alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet( diff --git a/pallets/subtensor/src/tests/staking.rs b/pallets/subtensor/src/tests/staking.rs index 8345d24fff..38895348cc 100644 --- a/pallets/subtensor/src/tests/staking.rs +++ b/pallets/subtensor/src/tests/staking.rs @@ -864,6 +864,7 @@ fn test_remove_stake_insufficient_liquidity() { amount_staked.into(), ::SwapInterface::max_price().into(), false, + false, ) .unwrap(); @@ -4481,6 +4482,7 @@ fn test_stake_into_subnet_ok() { amount.into(), TaoCurrency::MAX, false, + false, )); let fee_rate = pallet_subtensor_swap::FeeRate::::get(NetUid::from(netuid)) as f64 / u16::MAX as f64; @@ -4534,6 +4536,7 @@ fn test_stake_into_subnet_low_amount() { amount.into(), TaoCurrency::MAX, false, + false, )); let expected_stake = AlphaCurrency::from(((amount as f64) * 0.997 / current_price) as u64); @@ -4581,6 +4584,7 @@ fn test_unstake_from_subnet_low_amount() { amount.into(), TaoCurrency::MAX, false, + false, )); // Remove stake @@ -4694,6 +4698,7 @@ fn test_unstake_from_subnet_prohibitive_limit() { amount.into(), TaoCurrency::MAX, false, + false, )); // Remove stake @@ -4769,6 +4774,7 @@ fn test_unstake_full_amount() { amount.into(), TaoCurrency::MAX, false, + false, )); // Remove stake diff --git a/pallets/subtensor/src/tests/swap_coldkey.rs b/pallets/subtensor/src/tests/swap_coldkey.rs index 54bdc253ce..59792d5602 100644 --- a/pallets/subtensor/src/tests/swap_coldkey.rs +++ b/pallets/subtensor/src/tests/swap_coldkey.rs @@ -2493,8 +2493,12 @@ fn test_coldkey_in_swap_schedule_prevents_funds_usage() { &TxBaseImplication(()), TransactionSource::External, ); - // Should pass, not in list. - assert_ok!(result); + // Should fail + assert_eq!( + // Should get an invalid transaction error + result.unwrap_err(), + CustomTransactionError::ColdkeyInSwapSchedule.into() + ); // Remove stake limit let call = RuntimeCall::SubtensorModule(SubtensorCall::remove_stake_limit { @@ -2513,7 +2517,27 @@ fn test_coldkey_in_swap_schedule_prevents_funds_usage() { &TxBaseImplication(()), TransactionSource::External, ); - // Should pass, not in list. + // Should fail + assert_eq!( + // Should get an invalid transaction error + result.unwrap_err(), + CustomTransactionError::ColdkeyInSwapSchedule.into() + ); + + // Schedule swap should succeed + let call = RuntimeCall::SubtensorModule(SubtensorCall::schedule_swap_coldkey { + new_coldkey: hotkey, + }); + let result = extension.validate( + RawOrigin::Signed(who).into(), + &call.clone(), + &info, + 10, + (), + &TxBaseImplication(()), + TransactionSource::External, + ); + // Should be ok assert_ok!(result); }); } diff --git a/pallets/subtensor/src/tests/swap_hotkey.rs b/pallets/subtensor/src/tests/swap_hotkey.rs index 5a9ebf5127..dae5a3f176 100644 --- a/pallets/subtensor/src/tests/swap_hotkey.rs +++ b/pallets/subtensor/src/tests/swap_hotkey.rs @@ -1033,7 +1033,7 @@ fn test_swap_hotkey_error_cases() { // Set up initial state Owner::::insert(old_hotkey, coldkey); TotalNetworks::::put(1); - LastTxBlock::::insert(coldkey, 0); + SubtensorModule::set_last_tx_block(&coldkey, 0); // Test not enough balance let swap_cost = SubtensorModule::get_key_swap_cost(); @@ -1429,11 +1429,11 @@ fn test_swap_hotkey_swap_rate_limits() { let child_key_take_block = 8910; // Set the last tx block for the old hotkey - LastTxBlock::::insert(old_hotkey, last_tx_block); + SubtensorModule::set_last_tx_block(&old_hotkey, last_tx_block); // Set the last delegate take block for the old hotkey - LastTxBlockDelegateTake::::insert(old_hotkey, delegate_take_block); + SubtensorModule::set_last_tx_block_delegate_take(&old_hotkey, delegate_take_block); // Set last childkey take block for the old hotkey - LastTxBlockChildKeyTake::::insert(old_hotkey, child_key_take_block); + SubtensorModule::set_last_tx_block_childkey(&old_hotkey, child_key_take_block); // Perform the swap assert_ok!(SubtensorModule::do_swap_hotkey( @@ -1444,13 +1444,16 @@ fn test_swap_hotkey_swap_rate_limits() { )); // Check for new hotkey - assert_eq!(LastTxBlock::::get(new_hotkey), last_tx_block); assert_eq!( - LastTxBlockDelegateTake::::get(new_hotkey), + SubtensorModule::get_last_tx_block(&new_hotkey), + last_tx_block + ); + assert_eq!( + SubtensorModule::get_last_tx_block_delegate_take(&new_hotkey), delegate_take_block ); assert_eq!( - LastTxBlockChildKeyTake::::get(new_hotkey), + SubtensorModule::get_last_tx_block_childkey_take(&new_hotkey), child_key_take_block ); }); diff --git a/pallets/subtensor/src/tests/swap_hotkey_with_subnet.rs b/pallets/subtensor/src/tests/swap_hotkey_with_subnet.rs index 314f72c2bd..349c28903a 100644 --- a/pallets/subtensor/src/tests/swap_hotkey_with_subnet.rs +++ b/pallets/subtensor/src/tests/swap_hotkey_with_subnet.rs @@ -1026,7 +1026,7 @@ fn test_swap_hotkey_error_cases() { // Set up initial state Owner::::insert(old_hotkey, coldkey); TotalNetworks::::put(1); - LastTxBlock::::insert(coldkey, 0); + SubtensorModule::set_last_tx_block(&coldkey, 0); // Test not enough balance let swap_cost = SubtensorModule::get_key_swap_cost(); @@ -1437,11 +1437,11 @@ fn test_swap_hotkey_swap_rate_limits() { SubtensorModule::add_balance_to_coldkey_account(&coldkey, u64::MAX); // Set the last tx block for the old hotkey - LastTxBlock::::insert(old_hotkey, last_tx_block); + SubtensorModule::set_last_tx_block(&old_hotkey, last_tx_block); // Set the last delegate take block for the old hotkey - LastTxBlockDelegateTake::::insert(old_hotkey, delegate_take_block); + SubtensorModule::set_last_tx_block_delegate_take(&old_hotkey, delegate_take_block); // Set last childkey take block for the old hotkey - LastTxBlockChildKeyTake::::insert(old_hotkey, child_key_take_block); + SubtensorModule::set_last_tx_block_childkey(&old_hotkey, child_key_take_block); // Perform the swap System::set_block_number(System::block_number() + HotkeySwapOnSubnetInterval::get()); @@ -1453,13 +1453,16 @@ fn test_swap_hotkey_swap_rate_limits() { ),); // Check for new hotkey - assert_eq!(LastTxBlock::::get(new_hotkey), last_tx_block); assert_eq!( - LastTxBlockDelegateTake::::get(new_hotkey), + SubtensorModule::get_last_tx_block(&new_hotkey), + last_tx_block + ); + assert_eq!( + SubtensorModule::get_last_tx_block_delegate_take(&new_hotkey), delegate_take_block ); assert_eq!( - LastTxBlockChildKeyTake::::get(new_hotkey), + SubtensorModule::get_last_tx_block_childkey_take(&new_hotkey), child_key_take_block ); }); @@ -1557,7 +1560,6 @@ fn test_swap_hotkey_registered_on_other_subnet() { // Set up initial state Owner::::insert(old_hotkey, coldkey); TotalNetworks::::put(1); - LastTxBlock::::insert(coldkey, 0); let initial_balance = SubtensorModule::get_key_swap_cost().to_u64() + 1000; SubtensorModule::add_balance_to_coldkey_account(&coldkey, initial_balance); diff --git a/pallets/subtensor/src/tests/weights.rs b/pallets/subtensor/src/tests/weights.rs index 4784c6b00e..d25a3eb34f 100644 --- a/pallets/subtensor/src/tests/weights.rs +++ b/pallets/subtensor/src/tests/weights.rs @@ -62,119 +62,6 @@ fn test_set_weights_dispatch_info_ok() { }); } -// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --package pallet-subtensor --lib -- tests::weights::test_set_rootweights_validate --exact --show-output --nocapture -#[test] -fn test_set_rootweights_validate() { - // Testing the signed extension validate function - // correctly filters this transaction. - - new_test_ext(0).execute_with(|| { - let dests = vec![1, 1]; - let weights = vec![1, 1]; - let netuid = NetUid::from(1); - let version_key: u64 = 0; - let coldkey = U256::from(0); - let hotkey: U256 = U256::from(1); // Add the hotkey field - assert_ne!(hotkey, coldkey); // Ensure hotkey is NOT the same as coldkey !!! - let fee: u64 = 0; // FIXME: DefaultStakingFee is deprecated - - let who = coldkey; // The coldkey signs this transaction - - let call = RuntimeCall::SubtensorModule(SubtensorCall::set_tao_weights { - netuid, - dests, - weights, - version_key, - hotkey, // Include the hotkey field - }); - - // Create netuid - add_network(netuid, 1, 0); - // Register the hotkey - SubtensorModule::append_neuron(netuid, &hotkey, 0); - crate::Owner::::insert(hotkey, coldkey); - - SubtensorModule::add_balance_to_coldkey_account(&hotkey, u64::MAX); - - let min_stake = TaoCurrency::from(500_000_000_000); - // Set the minimum stake - SubtensorModule::set_stake_threshold(min_stake.into()); - - // Verify stake is less than minimum - assert!(SubtensorModule::get_total_stake_for_hotkey(&hotkey) < min_stake); - let info: DispatchInfo = - DispatchInfoOf::<::RuntimeCall>::default(); - - let extension = SubtensorTransactionExtension::::new(); - // Submit to the signed extension validate function - let result_no_stake = extension.validate( - RawOrigin::Signed(who).into(), - &call.clone(), - &info, - 10, - (), - &TxBaseImplication(()), - TransactionSource::External, - ); - // Should fail - assert_eq!( - // Should get an invalid transaction error - result_no_stake.unwrap_err(), - CustomTransactionError::StakeAmountTooLow.into() - ); - - // Increase the stake to be equal to the minimum - assert_ok!(SubtensorModule::do_add_stake( - RuntimeOrigin::signed(hotkey), - hotkey, - netuid, - min_stake + fee.into() - )); - - // Verify stake is equal to minimum - assert_eq!( - SubtensorModule::get_total_stake_for_hotkey(&hotkey), - min_stake - ); - - // Submit to the signed extension validate function - let result_min_stake = extension.validate( - RawOrigin::Signed(who).into(), - &call.clone(), - &info, - 10, - (), - &TxBaseImplication(()), - TransactionSource::External, - ); - // Now the call should pass - assert_ok!(result_min_stake); - - // Try with more stake than minimum - assert_ok!(SubtensorModule::do_add_stake( - RuntimeOrigin::signed(hotkey), - hotkey, - netuid, - DefaultMinStake::::get() * 10.into() - )); - - // Verify stake is more than minimum - assert!(SubtensorModule::get_total_stake_for_hotkey(&hotkey) > min_stake); - - let result_more_stake = extension.validate( - RawOrigin::Signed(who).into(), - &call.clone(), - &info, - 10, - (), - &TxBaseImplication(()), - TransactionSource::External, - ); - // The call should still pass - assert_ok!(result_more_stake); - }); -} - // SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --package pallet-subtensor --lib -- tests::weights::test_commit_weights_dispatch_info_ok --exact --show-output --nocapture #[test] fn test_commit_weights_dispatch_info_ok() { diff --git a/pallets/subtensor/src/transaction_extension.rs b/pallets/subtensor/src/transaction_extension.rs index deb42efabf..064a242f91 100644 --- a/pallets/subtensor/src/transaction_extension.rs +++ b/pallets/subtensor/src/transaction_extension.rs @@ -1,5 +1,6 @@ use crate::{ BalancesCall, Call, ColdkeySwapScheduled, Config, CustomTransactionError, Error, Pallet, + TransactionType, }; use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::dispatch::{DispatchInfo, PostDispatchInfo}; @@ -120,6 +121,16 @@ where return Ok((Default::default(), None, origin)); }; + // Verify ColdkeySwapScheduled map for coldkey + match call.is_sub_type() { + // Whitelist + Some(Call::schedule_swap_coldkey { .. }) => {} + _ => { + if ColdkeySwapScheduled::::contains_key(who) { + return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); + } + } + } match call.is_sub_type() { Some(Call::commit_weights { netuid, .. }) => { if Self::check_weights_min_stake(who, *netuid) { @@ -213,27 +224,6 @@ where Err(CustomTransactionError::StakeAmountTooLow.into()) } } - Some(Call::set_tao_weights { netuid, hotkey, .. }) => { - if Self::check_weights_min_stake(hotkey, *netuid) { - Ok((Default::default(), Some(who.clone()), origin)) - } else { - Err(CustomTransactionError::StakeAmountTooLow.into()) - } - } - Some(Call::commit_crv3_weights { - netuid, - reveal_round, - .. - }) => { - if Self::check_weights_min_stake(who, *netuid) { - if *reveal_round < pallet_drand::LastStoredRound::::get() { - return Err(CustomTransactionError::InvalidRevealRound.into()); - } - Ok((Default::default(), Some(who.clone()), origin)) - } else { - Err(CustomTransactionError::StakeAmountTooLow.into()) - } - } Some(Call::commit_timelocked_weights { netuid, reveal_round, @@ -248,54 +238,7 @@ where Err(CustomTransactionError::StakeAmountTooLow.into()) } } - Some(Call::add_stake { .. }) => { - if ColdkeySwapScheduled::::contains_key(who) { - return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); - } - - Ok((Default::default(), Some(who.clone()), origin)) - } - Some(Call::add_stake_limit { .. }) => { - if ColdkeySwapScheduled::::contains_key(who) { - return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); - } - - Ok((Default::default(), Some(who.clone()), origin)) - } - Some(Call::remove_stake { .. }) => Ok((Default::default(), Some(who.clone()), origin)), - Some(Call::remove_stake_limit { .. }) => { - Ok((Default::default(), Some(who.clone()), origin)) - } - Some(Call::move_stake { .. }) => { - if ColdkeySwapScheduled::::contains_key(who) { - return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); - } - Ok((Default::default(), Some(who.clone()), origin)) - } - Some(Call::transfer_stake { .. }) => { - if ColdkeySwapScheduled::::contains_key(who) { - return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); - } - - Ok((Default::default(), Some(who.clone()), origin)) - } - Some(Call::swap_stake { .. }) => { - if ColdkeySwapScheduled::::contains_key(who) { - return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); - } - Ok((Default::default(), Some(who.clone()), origin)) - } - Some(Call::swap_stake_limit { .. }) => { - if ColdkeySwapScheduled::::contains_key(who) { - return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); - } - Ok((Default::default(), Some(who.clone()), origin)) - } Some(Call::register { netuid, .. } | Call::burned_register { netuid, .. }) => { - if ColdkeySwapScheduled::::contains_key(who) { - return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); - } - let registrations_this_interval = Pallet::::get_registrations_this_interval(*netuid); let max_registrations_per_interval = @@ -308,13 +251,6 @@ where Ok((Default::default(), Some(who.clone()), origin)) } - Some(Call::dissolve_network { .. }) => { - if ColdkeySwapScheduled::::contains_key(who) { - Err(CustomTransactionError::ColdkeyInSwapSchedule.into()) - } else { - Ok((Default::default(), Some(who.clone()), origin)) - } - } Some(Call::serve_axon { netuid, version, @@ -342,20 +278,14 @@ where ) .map(|validity| (validity, Some(who.clone()), origin.clone())) } - _ => { - if let Some( - BalancesCall::transfer_keep_alive { .. } - | BalancesCall::transfer_all { .. } - | BalancesCall::transfer_allow_death { .. }, - ) = call.is_sub_type() - { - if ColdkeySwapScheduled::::contains_key(who) { - return Err(CustomTransactionError::ColdkeyInSwapSchedule.into()); - } + Some(Call::register_network { .. }) => { + if !Pallet::::passes_rate_limit(&TransactionType::RegisterNetwork, who) { + return Err(CustomTransactionError::RateLimitExceeded.into()); } Ok((Default::default(), Some(who.clone()), origin)) } + _ => Ok((Default::default(), Some(who.clone()), origin)), } } diff --git a/pallets/subtensor/src/utils/misc.rs b/pallets/subtensor/src/utils/misc.rs index 9fd6d27de7..f64962f094 100644 --- a/pallets/subtensor/src/utils/misc.rs +++ b/pallets/subtensor/src/utils/misc.rs @@ -273,7 +273,7 @@ impl Pallet { pub fn burn_tokens(amount: TaoCurrency) { TotalIssuance::::put(TotalIssuance::::get().saturating_sub(amount)); } - pub fn coinbase(amount: TaoCurrency) { + pub fn increase_issuance(amount: TaoCurrency) { TotalIssuance::::put(TotalIssuance::::get().saturating_add(amount)); } diff --git a/pallets/subtensor/src/utils/rate_limiting.rs b/pallets/subtensor/src/utils/rate_limiting.rs index eeb5b96ddb..de75086ea1 100644 --- a/pallets/subtensor/src/utils/rate_limiting.rs +++ b/pallets/subtensor/src/utils/rate_limiting.rs @@ -119,14 +119,6 @@ impl Pallet { } } - /// Set the block number of the last transaction for a specific key, and transaction type - pub fn set_last_transaction_block(key: &T::AccountId, tx_type: &TransactionType, block: u64) { - match tx_type { - TransactionType::RegisterNetwork => Self::set_network_last_lock_block(block), - _ => Self::set_last_transaction_block_on_subnet(key, NetUid::ROOT, tx_type, block), - } - } - /// Set the block number of the last transaction for a specific hotkey, network, and transaction type pub fn set_last_transaction_block_on_subnet( key: &T::AccountId, @@ -146,20 +138,39 @@ impl Pallet { } } + pub fn remove_last_tx_block(key: &T::AccountId) { + Self::remove_rate_limited_last_block(&RateLimitKey::LastTxBlock(key.clone())) + } pub fn set_last_tx_block(key: &T::AccountId, block: u64) { - LastTxBlock::::insert(key, block) + Self::set_rate_limited_last_block(&RateLimitKey::LastTxBlock(key.clone()), block); } pub fn get_last_tx_block(key: &T::AccountId) -> u64 { - LastTxBlock::::get(key) + Self::get_rate_limited_last_block(&RateLimitKey::LastTxBlock(key.clone())) + } + + pub fn remove_last_tx_block_delegate_take(key: &T::AccountId) { + Self::remove_rate_limited_last_block(&RateLimitKey::LastTxBlockDelegateTake(key.clone())) } pub fn set_last_tx_block_delegate_take(key: &T::AccountId, block: u64) { - LastTxBlockDelegateTake::::insert(key, block) + Self::set_rate_limited_last_block( + &RateLimitKey::LastTxBlockDelegateTake(key.clone()), + block, + ); } pub fn get_last_tx_block_delegate_take(key: &T::AccountId) -> u64 { - LastTxBlockDelegateTake::::get(key) + Self::get_rate_limited_last_block(&RateLimitKey::LastTxBlockDelegateTake(key.clone())) } pub fn get_last_tx_block_childkey_take(key: &T::AccountId) -> u64 { - LastTxBlockChildKeyTake::::get(key) + Self::get_rate_limited_last_block(&RateLimitKey::LastTxBlockChildKeyTake(key.clone())) + } + pub fn remove_last_tx_block_childkey(key: &T::AccountId) { + Self::remove_rate_limited_last_block(&RateLimitKey::LastTxBlockChildKeyTake(key.clone())) + } + pub fn set_last_tx_block_childkey(key: &T::AccountId, block: u64) { + Self::set_rate_limited_last_block( + &RateLimitKey::LastTxBlockChildKeyTake(key.clone()), + block, + ); } pub fn exceeds_tx_rate_limit(prev_tx_block: u64, current_block: u64) -> bool { let rate_limit: u64 = Self::get_tx_rate_limit(); diff --git a/pallets/swap/src/mock.rs b/pallets/swap/src/mock.rs index 78a8f925c8..7a07cc7007 100644 --- a/pallets/swap/src/mock.rs +++ b/pallets/swap/src/mock.rs @@ -36,7 +36,7 @@ pub const OK_HOTKEY_ACCOUNT_ID_RICH: AccountId = 1005; pub const NOT_SUBNET_OWNER: AccountId = 666; pub const NON_EXISTENT_NETUID: u16 = 999; pub const WRAPPING_FEES_NETUID: u16 = 124; - +pub const SUBTOKEN_DISABLED_NETUID: u16 = 13579; parameter_types! { pub const BlockHashCount: u64 = 250; pub const SS58Prefix: u8 = 42; @@ -115,6 +115,11 @@ impl SubnetInfo for MockLiquidityProvider { fn is_owner(account_id: &AccountId, _netuid: NetUid) -> bool { *account_id != NOT_SUBNET_OWNER } + + // Only disable one subnet for testing + fn is_subtoken_enabled(netuid: NetUid) -> bool { + netuid.inner() != SUBTOKEN_DISABLED_NETUID + } } pub struct MockBalanceOps; diff --git a/pallets/swap/src/pallet/mod.rs b/pallets/swap/src/pallet/mod.rs index 894099de7f..442c4852aa 100644 --- a/pallets/swap/src/pallet/mod.rs +++ b/pallets/swap/src/pallet/mod.rs @@ -269,6 +269,9 @@ mod pallet { /// User liquidity operations are disabled for this subnet UserLiquidityDisabled, + + /// The subnet does not have subtoken enabled + SubtokenDisabled, } #[pallet::call] @@ -366,6 +369,11 @@ mod pallet { Error::::SubNetworkDoesNotExist ); + ensure!( + T::SubnetInfo::is_subtoken_enabled(netuid.into()), + Error::::SubtokenDisabled + ); + let (position_id, tao, alpha) = Self::do_add_liquidity( netuid.into(), &coldkey, @@ -489,6 +497,11 @@ mod pallet { Error::::SubNetworkDoesNotExist ); + ensure!( + T::SubnetInfo::is_subtoken_enabled(netuid.into()), + Error::::SubtokenDisabled + ); + // Add or remove liquidity let result = Self::do_modify_position(netuid, &coldkey, &hotkey, position_id, liquidity_delta)?; diff --git a/pallets/swap/src/pallet/tests.rs b/pallets/swap/src/pallet/tests.rs index 845acd957a..396bd656be 100644 --- a/pallets/swap/src/pallet/tests.rs +++ b/pallets/swap/src/pallet/tests.rs @@ -1944,3 +1944,40 @@ fn test_less_price_movement() { }); }); } + +#[test] +fn test_swap_subtoken_disabled() { + new_test_ext().execute_with(|| { + let netuid = NetUid::from(SUBTOKEN_DISABLED_NETUID); // Use a netuid not used elsewhere + let price_low = 0.1; + let price_high = 0.2; + let tick_low = price_to_tick(price_low); + let tick_high = price_to_tick(price_high); + let liquidity = 1_000_000_u64; + + assert_ok!(Pallet::::maybe_initialize_v3(netuid)); + + assert_noop!( + Pallet::::add_liquidity( + RuntimeOrigin::signed(OK_COLDKEY_ACCOUNT_ID), + OK_HOTKEY_ACCOUNT_ID, + netuid, + tick_low, + tick_high, + liquidity, + ), + Error::::SubtokenDisabled + ); + + assert_noop!( + Pallet::::modify_position( + RuntimeOrigin::signed(OK_COLDKEY_ACCOUNT_ID), + OK_HOTKEY_ACCOUNT_ID, + netuid, + PositionId::from(0), + liquidity as i64, + ), + Error::::SubtokenDisabled + ); + }); +} diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index c2f5caa432..8aca06dc5d 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -175,6 +175,8 @@ parameter_types! { pub const InitialBurn: u64 = 0; pub const InitialMinBurn: u64 = 500_000; pub const InitialMaxBurn: u64 = 1_000_000_000; + pub const MinBurnUpperBound: TaoCurrency = TaoCurrency::new(1_000_000_000); // 1 TAO + pub const MaxBurnLowerBound: TaoCurrency = TaoCurrency::new(100_000_000); // 0.1 TAO pub const InitialValidatorPruneLen: u64 = 0; pub const InitialScalingLawPower: u16 = 50; pub const InitialMaxAllowedValidators: u16 = 100; @@ -263,6 +265,8 @@ impl pallet_subtensor::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type MinBurnUpperBound = MinBurnUpperBound; + type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; type InitialSenateRequiredStakePercentage = InitialSenateRequiredStakePercentage; type InitialNetworkImmunityPeriod = InitialNetworkImmunityPeriod; @@ -288,6 +292,7 @@ impl pallet_subtensor::Config for Test { type HotkeySwapOnSubnetInterval = HotkeySwapOnSubnetInterval; type ProxyInterface = (); type LeaseDividendsDistributionInterval = LeaseDividendsDistributionInterval; + type GetCommitments = (); } parameter_types! { diff --git a/precompiles/Cargo.toml b/precompiles/Cargo.toml index 4045408268..79f70f6005 100644 --- a/precompiles/Cargo.toml +++ b/precompiles/Cargo.toml @@ -11,7 +11,6 @@ repository = "https://github.com/opentensor/subtensor/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { workspace = true, features = ["derive"] } ed25519-dalek = { workspace = true, features = ["alloc"] } fp-evm.workspace = true frame-support.workspace = true @@ -44,7 +43,6 @@ workspace = true [features] default = ["std"] std = [ - "codec/std", "ed25519-dalek/std", "fp-evm/std", "frame-support/std", diff --git a/precompiles/src/alpha.rs b/precompiles/src/alpha.rs index 42261674d9..29f7cab568 100644 --- a/precompiles/src/alpha.rs +++ b/precompiles/src/alpha.rs @@ -90,6 +90,13 @@ where Ok(U256::from(tao_weight)) } + #[precompile::public("getCKBurn()")] + #[precompile::view] + fn get_ck_burn(_handle: &mut impl PrecompileHandle) -> EvmResult { + let ck_burn = pallet_subtensor::CKBurn::::get(); + Ok(U256::from(ck_burn)) + } + #[precompile::public("simSwapTaoForAlpha(uint16,uint64)")] #[precompile::view] fn sim_swap_tao_for_alpha( diff --git a/precompiles/src/solidity/alpha.abi b/precompiles/src/solidity/alpha.abi index 06975d5e61..14d6eb66dc 100644 --- a/precompiles/src/solidity/alpha.abi +++ b/precompiles/src/solidity/alpha.abi @@ -313,5 +313,18 @@ ], "stateMutability": "view", "type": "function" + }, + { + "inputs": [], + "name": "getCKBurn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" } ] \ No newline at end of file diff --git a/precompiles/src/solidity/alpha.sol b/precompiles/src/solidity/alpha.sol index e66dcf00d9..c99252ff48 100644 --- a/precompiles/src/solidity/alpha.sol +++ b/precompiles/src/solidity/alpha.sol @@ -94,4 +94,8 @@ interface IAlpha { /// @dev Returns the sum of alpha prices for all subnets. /// @return The sum of alpha prices. function getSumAlphaPrice() external view returns (uint256); + + /// @dev Returns the CK burn rate. + /// @return The CK burn rate. + function getCKBurn() external view returns (uint256); } diff --git a/precompiles/src/solidity/subnet.abi b/precompiles/src/solidity/subnet.abi index 805c0057d9..f2d97e1f90 100644 --- a/precompiles/src/solidity/subnet.abi +++ b/precompiles/src/solidity/subnet.abi @@ -1046,5 +1046,8 @@ "outputs": [], "stateMutability": "payable", "type": "function" + }, + { + "inputs" } ] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 60687d3a30..aee1e04895 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -83,13 +83,13 @@ pub use frame_support::{ }; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; +use pallet_commitments::GetCommitments; pub use pallet_timestamp::Call as TimestampCall; use pallet_transaction_payment::{ConstFeeMultiplier, Multiplier}; -use subtensor_transaction_fee::{SubtensorTxFeeHandler, TransactionFeeHandler}; - #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; pub use sp_runtime::{Perbill, Permill}; +use subtensor_transaction_fee::{SubtensorTxFeeHandler, TransactionFeeHandler}; use core::marker::PhantomData; @@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 306, + spec_version: 315, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -398,7 +398,6 @@ impl Contains for SafeModeWhitelistedCalls { | RuntimeCall::Timestamp(_) | RuntimeCall::SubtensorModule( pallet_subtensor::Call::set_weights { .. } - | pallet_subtensor::Call::set_tao_weights { .. } | pallet_subtensor::Call::serve_axon { .. } ) | RuntimeCall::Commitments(pallet_commitments::Call::set_commitment { .. }) @@ -733,7 +732,6 @@ impl InstanceFilter for ProxyType { | RuntimeCall::SubtensorModule(pallet_subtensor::Call::root_register { .. }) | RuntimeCall::SubtensorModule(pallet_subtensor::Call::burned_register { .. }) | RuntimeCall::Triumvirate(..) - | RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_tao_weights { .. }) | RuntimeCall::Sudo(..) ), ProxyType::Triumvirate => matches!( @@ -771,10 +769,7 @@ impl InstanceFilter 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_tao_weights { .. }) - ), + ProxyType::RootWeights => false, // deprecated ProxyType::ChildKeys => matches!( c, RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_children { .. }) @@ -1068,6 +1063,13 @@ impl OnMetadataCommitment for ResetBondsOnCommit { fn on_metadata_commitment(_: NetUid, _: &AccountId) {} } +pub struct GetCommitmentsStruct; +impl GetCommitments for GetCommitmentsStruct { + fn get_commitments(netuid: NetUid) -> Vec<(AccountId, Vec)> { + pallet_commitments::Pallet::::get_commitments(netuid) + } +} + impl pallet_commitments::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; @@ -1137,6 +1139,8 @@ parameter_types! { pub const SubtensorInitialBurn: u64 = 100_000_000; // 0.1 tao pub const SubtensorInitialMinBurn: u64 = 500_000; // 500k RAO pub const SubtensorInitialMaxBurn: u64 = 100_000_000_000; // 100 tao + pub const MinBurnUpperBound: TaoCurrency = TaoCurrency::new(1_000_000_000); // 1 TAO + pub const MaxBurnLowerBound: TaoCurrency = TaoCurrency::new(100_000_000); // 0.1 TAO pub const SubtensorInitialTxRateLimit: u64 = 1000; pub const SubtensorInitialTxDelegateTakeRateLimit: u64 = 216000; // 30 days at 12 seconds per block pub const SubtensorInitialTxChildKeyTakeRateLimit: u64 = INITIAL_CHILDKEY_TAKE_RATELIMIT; @@ -1210,6 +1214,8 @@ impl pallet_subtensor::Config for Runtime { type InitialBurn = SubtensorInitialBurn; type InitialMaxBurn = SubtensorInitialMaxBurn; type InitialMinBurn = SubtensorInitialMinBurn; + type MinBurnUpperBound = MinBurnUpperBound; + type MaxBurnLowerBound = MaxBurnLowerBound; type InitialTxRateLimit = SubtensorInitialTxRateLimit; type InitialTxDelegateTakeRateLimit = SubtensorInitialTxDelegateTakeRateLimit; type InitialTxChildKeyTakeRateLimit = SubtensorInitialTxChildKeyTakeRateLimit; @@ -1239,6 +1245,7 @@ impl pallet_subtensor::Config for Runtime { type HotkeySwapOnSubnetInterval = HotkeySwapOnSubnetInterval; type ProxyInterface = Proxier; type LeaseDividendsDistributionInterval = LeaseDividendsDistributionInterval; + type GetCommitments = GetCommitmentsStruct; } parameter_types! { diff --git a/scripts/benchmark_action.sh b/scripts/benchmark_action.sh index 50b2a3a014..105cbe9bf5 100755 --- a/scripts/benchmark_action.sh +++ b/scripts/benchmark_action.sh @@ -13,10 +13,13 @@ declare -A DISPATCH_PATHS=( THRESHOLD=20 MAX_RETRIES=3 -AUTO_COMMIT="${AUTO_COMMIT_WEIGHTS:-0}" + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" RUNTIME_WASM="$SCRIPT_DIR/../target/production/wbuild/node-subtensor-runtime/node_subtensor_runtime.compact.compressed.wasm" +PATCH_DIR="$SCRIPT_DIR/../.bench_patch" +mkdir -p "$PATCH_DIR" + die() { echo "❌ $1" >&2; exit 1; } digits_only() { echo "${1//[^0-9]/}"; } dec() { local d; d=$(digits_only "$1"); echo "$((10#${d:-0}))"; } @@ -32,7 +35,8 @@ patch_weight() { FN="$1" NEWV="$2" perl -0777 -i -pe ' my $n=$ENV{NEWV}; my $hit=0; $hit+=s|(pub\s+fn\s+\Q$ENV{FN}\E\s*[^{}]*?Weight::from_parts\(\s*)[0-9A-Za-z_]+|$1$n|s; - $hit+=s|(\#\s*\[pallet::weight[^\]]*?Weight::from_parts\(\s*)[0-9A-Za-z_]+(?=[^\]]*?\]\s*pub\s+fn\s+\Q$ENV{FN}\E\b)|$1$n|s; + # attribute replacement allowing intermediate attributes (e.g., call_index) before pub fn + $hit+=s|(\#\s*\[pallet::weight[^\]]*?Weight::from_parts\(\s*)[0-9A-Za-z_]+(?=[^\]]*\](?:\s*#\[[^\]]*\])*\s*pub\s+fn\s+\Q$ENV{FN}\E\b)|$1$n|s; END{exit $hit?0:1} ' "$3" || log_warn "patch_weight: no substitution for $1" after=$(sha1sum "$3" | cut -d' ' -f1); [[ "$before" != "$after" ]] @@ -51,36 +55,56 @@ patch_reads_writes() { my $W=$neww eq "" ? $w : u64($neww); return "$pre$R$mid$W$post"; }; - $h+=s|(pub\s+fn\s+\Q$ENV{FN}\E\s*[^{}]*?reads_writes\(\s*)([^,]+)(\s*,\s*)([^)]+)|&$rw_sub($1,$2,$3,$4,"")|e; - $h+=s|(\#\s*\[pallet::weight[^\]]*?reads_writes\(\s*)([^,]+)(\s*,\s*)([^)]+)(?=[^\]]*?\]\s*pub\s+fn\s+\Q$ENV{FN}\E\b)|&$rw_sub($1,$2,$3,$4,"")|e; - $h+=s|(pub\s+fn\s+\Q$ENV{FN}\E\s*[^{}]*?\.reads\(\s*)([^)]+)|$1.($newr eq "" ? $2 : u64($newr))|e; - $h+=s|(\#\s*\[pallet::weight[^\]]*?\.reads\(\s*)([^)]+)(?=[^\]]*?\]\s*pub\s+fn\s+\Q$ENV{FN}\E\b)|$1.($newr eq "" ? $2 : u64($newr))|e; - $h+=s|(pub\s+fn\s+\Q$ENV{FN}\E\s*[^{}]*?\.writes\(\s*)([^)]+)|$1.($neww eq "" ? $2 : u64($neww))|e; - $h+=s|(\#\s*\[pallet::weight[^\]]*?\.writes\(\s*)([^)]+)(?=[^\]]*?\]\s*pub\s+fn\s+\Q$ENV{FN}\E\b)|$1.($neww eq "" ? $2 : u64($neww))|e; + # In-body: reads_writes(...) + $h+=s|(pub\s+fn\s+\Q$ENV{FN}\E\s*[^{}]*?reads_writes\(\s*)([^,]+)(\s*,\s*)([^)]+)|&$rw_sub($1,$2,$3,$4,"")|sge; + # In-body: .reads(...) and .writes(...) + $h+=s|(pub\s+fn\s+\Q$ENV{FN}\E\s*[^{}]*?\.reads\(\s*)([^)]+)|$1.($newr eq "" ? $2 : u64($newr))|sge; + $h+=s|(pub\s+fn\s+\Q$ENV{FN}\E\s*[^{}]*?\.writes\(\s*)([^)]+)|$1.($neww eq "" ? $2 : u64($neww))|sge; + + # Attribute: reads_writes(...), tolerate other attributes between ] and pub fn + $h+=s|(\#\s*\[pallet::weight[^\]]*?reads_writes\(\s*)([^,]+)(\s*,\s*)([^)]+)(?=[^\]]*\](?:\s*#\[[^\]]*\])*\s*pub\s+fn\s+\Q$ENV{FN}\E\b)|&$rw_sub($1,$2,$3,$4,"")|sge; + # Attribute: .reads(...) and .writes(...), tolerate other attributes between ] and pub fn + $h+=s|(\#\s*\[pallet::weight[^\]]*?\.reads\(\s*)([^)]+)(?=[^\]]*\](?:\s*#\[[^\]]*\])*\s*pub\s+fn\s+\Q$ENV{FN}\E\b)|$1.($newr eq "" ? $2 : u64($newr))|sge; + $h+=s|(\#\s*\[pallet::weight[^\]]*?\.writes\(\s*)([^)]+)(?=[^\]]*\](?:\s*#\[[^\]]*\])*\s*pub\s+fn\s+\Q$ENV{FN}\E\b)|$1.($neww eq "" ? $2 : u64($neww))|sge; + END{exit $h?0:1} ' "$4" || log_warn "patch_reads_writes: no substitution for $1" after=$(sha1sum "$4" | cut -d' ' -f1); [[ "$before" != "$after" ]] } -git_commit_and_push() { - local msg="$1" - local branch; branch=$(git symbolic-ref --quiet --short HEAD || true) - [[ -z "$branch" ]] && die "Not on a branch - cannot push" - - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" +write_patch_artifacts_and_fail() { git add "${PATCHED_FILES[@]}" || true - if git diff --cached --quiet; then - echo "ℹ️ No staged changes after patching."; git status --short; return - fi - - echo "==== diff preview ===="; git diff --cached --stat - git diff --cached | head -n 40 || true - echo "======================" + { + echo "Head SHA: $(git rev-parse HEAD)" + echo + echo "==== Benchmark summary ====" + printf '%s\n' "${GLOBAL_SUMMARY[@]}" || true + echo + echo "==== Diffstat ====" + git diff --cached --stat || true + } > "$PATCH_DIR/summary.txt" + + git diff --cached --binary > "$PATCH_DIR/benchmark_patch.diff" || true + + echo "📦 Prepared patch at: $PATCH_DIR/benchmark_patch.diff" + echo "ℹ️ Add the 'apply-benchmark-patch' label to this PR to have CI apply & commit it." + exit 2 +} - git commit -m "$msg" - git push origin "HEAD:$branch" || die "Push to '${branch}' failed." +write_summary_only_and_fail() { + { + echo "Head SHA: $(git rev-parse HEAD)" + echo + echo "==== Benchmark summary ====" + printf '%s\n' "${GLOBAL_SUMMARY[@]}" || true + echo + echo "No auto-patch was generated for the mismatched extrinsics." + echo "Manual update may be required." + } > "$PATCH_DIR/summary.txt" + + echo "⚠️ No patch could be auto-generated. See .bench_patch/summary.txt." + exit 2 } echo "Building runtime-benchmarks…" @@ -91,6 +115,8 @@ echo " Will benchmark pallets: ${PALLET_LIST[*]}" echo "─────────────────────────────────────────────" PATCHED_FILES=() +GLOBAL_SUMMARY=() +ANY_FAILURE=0 ################################################################################ # Benchmark loop @@ -155,13 +181,15 @@ for pallet in "${PALLET_LIST[@]}"; do done < "$TMP"; flush echo; printf ' %s\n' "${summary[@]}" + GLOBAL_SUMMARY+=("${summary[@]}") + (( fail == 0 )) && { echo "✅ '$pallet' within tolerance."; break; } printf ' ❌ %s\n' "${failures[@]}" (( attempt < MAX_RETRIES )) && { echo "→ Retrying …"; (( attempt++ )); continue; } - echo "❌ '$pallet' still failing; patching …" - [[ "$AUTO_COMMIT" != "1" ]] && die "AUTO_COMMIT_WEIGHTS disabled." + echo "❌ '$pallet' still failing; patching (prepare-only) …" + ANY_FAILURE=1 changed=0 for fn in $(printf "%s\n" "${!new_weight[@]}" "${!new_reads[@]}" "${!new_writes[@]}" | sort -u); do @@ -179,11 +207,14 @@ for pallet in "${PALLET_LIST[@]}"; do done ################################################################################ -# Commit & push patches +# Fail if any mismatch; upload artifacts in workflow step ################################################################################ -if (( ${#PATCHED_FILES[@]} )); then - echo -e "\n📦 Committing patched files …" - git_commit_and_push "auto-update benchmark weights" +if (( ANY_FAILURE )); then + if (( ${#PATCHED_FILES[@]} )); then + write_patch_artifacts_and_fail + else + write_summary_only_and_fail + fi fi echo -e "\n══════════════════════════════════════"