Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
bbb22e8
impl SubnetProtocolAlpha
JohnReedV May 7, 2026
8344515
bump spec
JohnReedV May 7, 2026
311fcc5
bump spec again
JohnReedV May 7, 2026
9b91b4b
Merge branch 'devnet-ready' into chain-buy-cache
JohnReedV May 7, 2026
ea9ed53
Merge branch 'devnet-ready' into chain-buy-cache
JohnReedV May 8, 2026
695a6d8
auto-update benchmark weights
github-actions[bot] May 15, 2026
bb33770
Merge branch 'devnet-ready' into chain-buy-cache
JohnReedV May 15, 2026
de0e9f2
auto-update benchmark weights
github-actions[bot] May 15, 2026
76aa1b8
add min stake const
open-junius May 21, 2026
4b9fe16
commit Cargo.lock
open-junius May 21, 2026
0095574
Merge branch 'devnet-ready' into add-min-stake-const
open-junius May 22, 2026
20b8401
Merge branch 'devnet-ready' into chain-buy-cache
JohnReedV May 26, 2026
a502595
Only allow target address OR call for crowdloan, not both.
l0r1s May 26, 2026
a0712c6
Added max crowdloan contribution per contributor
l0r1s May 26, 2026
ac88155
Fix benchmark_all script
l0r1s May 26, 2026
1713f83
Merge branch 'devnet-ready' into crowdloan-fixes
l0r1s May 26, 2026
429e4ad
Bump spec version to 410
l0r1s May 26, 2026
9ffc6d7
Rename + add weights
l0r1s May 27, 2026
aeb7cda
Merge branch 'devnet-ready' into crowdloan-fixes
l0r1s May 27, 2026
36c6545
Bump spec version to 411
l0r1s May 27, 2026
91540c5
Add new runtime api method
thewhaleking May 27, 2026
056c31f
Add tests
thewhaleking May 27, 2026
5fbfe15
cargo fmt
thewhaleking May 27, 2026
31a1ba4
Added freeze_struct hashes
thewhaleking May 27, 2026
5360566
Clippy warnings
thewhaleking May 27, 2026
c04cc7f
Bump specVersion
thewhaleking May 27, 2026
790b957
Added docs (as per PR checklist)
thewhaleking May 27, 2026
130767b
Fix benchmarks + tests
l0r1s May 27, 2026
abe1688
expect used in benchmarks
l0r1s May 27, 2026
72cff1a
Merge branch 'devnet-ready' into crowdloan-fixes
l0r1s May 27, 2026
b4d4389
Bump spec version to 412
l0r1s May 27, 2026
636e94c
Merge branch 'devnet-ready' into add-min-stake-const
open-junius May 28, 2026
9fe4e8c
bump version
open-junius May 28, 2026
2e29f0d
Merge branch 'devnet-ready' into feat/thewhaleking/hyperparams-v4
thewhaleking May 28, 2026
e2570d0
Bump specVersion
thewhaleking May 28, 2026
2d5a139
Merge pull request #2684 from opentensor/add-min-stake-const
open-junius May 28, 2026
668181b
PR feedback
thewhaleking May 28, 2026
d2ba8cb
commit Cargo.lock
thewhaleking May 28, 2026
549b840
Remove deprecated hyperparams, add new ones.
thewhaleking May 28, 2026
868f63d
cargo fmt
thewhaleking May 28, 2026
85598fa
Merge branch 'devnet-ready' into feat/thewhaleking/hyperparams-v4
thewhaleking May 28, 2026
6e4fb80
Merge pull request #2697 from opentensor/crowdloan-fixes
l0r1s May 29, 2026
8ba1aa5
Merge pull request #2699 from opentensor/feat/thewhaleking/hyperparam…
JohnReedV May 29, 2026
9fef2d6
trigger CI
JohnReedV May 31, 2026
c4f9623
Merge branch 'devnet-ready' into chain-buy-cache
JohnReedV May 31, 2026
646b742
conflict
JohnReedV May 31, 2026
32df63c
fix wieghts
JohnReedV May 31, 2026
255390f
auto-update benchmark weights
github-actions[bot] May 31, 2026
66cee25
trigger CI
JohnReedV May 31, 2026
075bafc
Merge remote-tracking branch 'origin/devnet-ready' into devnet
sam0x17 Jun 1, 2026
26585d7
Merge pull request #2645 from opentensor/chain-buy-cache
sam0x17 Jun 1, 2026
11ad813
bump spec version
sam0x17 Jun 1, 2026
e3aed62
Merge remote-tracking branch 'origin/devnet-ready' into devnet
sam0x17 Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions chain-extensions/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ parameter_types! {
pub const InitialTxChildKeyTakeRateLimit: u64 = 1; // 1 block take rate limit for testing
pub const InitialBurn: u64 = 0;
pub const InitialMinBurn: u64 = 500_000;
pub const InitialMinStake: u64 = 2_000_000;
pub const InitialMaxBurn: u64 = 1_000_000_000;
pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO
pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO
Expand Down Expand Up @@ -398,6 +399,7 @@ impl pallet_subtensor::Config for Test {
type InitialBurn = InitialBurn;
type InitialMaxBurn = InitialMaxBurn;
type InitialMinBurn = InitialMinBurn;
type InitialMinStake = InitialMinStake;
type MinBurnUpperBound = MinBurnUpperBound;
type MaxBurnLowerBound = MaxBurnLowerBound;
type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration;
Expand Down
2 changes: 1 addition & 1 deletion contract-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions contract-tests/test/alphaPool.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import * as assert from "assert";
import * as chai from "chai";
import { devnet } from "@polkadot-api/descriptors";
import { u8aToHex } from "@polkadot/util";
import { getDevnetApi, getRandomSubstrateKeypair } from "../src/substrate"
import { generateRandomEthersWallet, getPublicClient } from "../src/utils";
import { ETH_LOCAL_URL } from "../src/config";
import { devnet } from "@polkadot-api/descriptors"
import { PublicClient } from "viem";
import * as assert from "assert";
import { ethers } from "ethers";
import { TypedApi } from "polkadot-api";
import { ALPHA_POOL_CONTRACT_ABI, ALPHA_POOL_CONTRACT_BYTECODE } from "../src/contracts/alphaPool";
import { PublicClient } from "viem";
import { convertH160ToPublicKey, convertH160ToSS58, convertPublicKeyToSs58, toViemAddress } from "../src/address-utils";
import { forceSetBalanceToEthAddress, disableWhiteListCheck, addNewSubnetwork, forceSetBalanceToSs58Address, startCall, burnedRegister, getStake } from "../src/subtensor";
import { ethers } from "ethers"
import { tao } from "../src/balance-math";
import { ETH_LOCAL_URL } from "../src/config";
import { ALPHA_POOL_CONTRACT_ABI, ALPHA_POOL_CONTRACT_BYTECODE } from "../src/contracts/alphaPool";
import { ISTAKING_V2_ADDRESS, IStakingV2ABI } from "../src/contracts/staking";
import { getDevnetApi, getRandomSubstrateKeypair } from "../src/substrate";
import { addNewSubnetwork, burnedRegister, disableWhiteListCheck, forceSetBalanceToEthAddress, forceSetBalanceToSs58Address, getStake, startCall } from "../src/subtensor";
import { generateRandomEthersWallet, getPublicClient } from "../src/utils";
// import { KeyPair } from "@polkadot-labs/hdkd-helpers";
describe("bridge token contract deployment", () => {
// init eth part
Expand All @@ -29,6 +28,8 @@ describe("bridge token contract deployment", () => {
publicClient = await getPublicClient(ETH_LOCAL_URL)
api = await getDevnetApi()

let value = await api.constants.SubtensorModule.InitialMinStake;

await forceSetBalanceToSs58Address(api, convertPublicKeyToSs58(hotkey.publicKey))
await forceSetBalanceToSs58Address(api, convertPublicKeyToSs58(coldkey.publicKey))
await addNewSubnetwork(api, hotkey, coldkey)
Expand Down
24 changes: 12 additions & 12 deletions contract-tests/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
dependencies:
"@jridgewell/trace-mapping" "0.3.9"

"@esbuild/darwin-arm64@0.25.12":
"@esbuild/linux-x64@0.25.12":
version "0.25.12"
resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz"
integrity sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==
resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz"
integrity sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==

"@ethereumjs/rlp@^10.0.0":
version "10.1.0"
Expand Down Expand Up @@ -255,7 +255,7 @@
integrity sha512-cgA9fh8dfBai9b46XaaQmj9vwzyHStQjc/xrAvQksgF6SqvZ0yAfxVqLvGrsz/Xi3dsAdKLg09PybC7MUAMv9w==

"@polkadot-api/descriptors@file:.papi/descriptors":
version "0.1.0-autogenerated.5063582544821983772"
version "0.1.0-autogenerated.9947536328969970535"
resolved "file:.papi/descriptors"

"@polkadot-api/ink-contracts@^0.4.1", "@polkadot-api/ink-contracts@>=0.4.0", "@polkadot-api/ink-contracts@0.4.3":
Expand Down Expand Up @@ -950,10 +950,15 @@
tslib "^2.8.0"
ws "^8.18.0"

"@rollup/rollup-darwin-arm64@4.53.3":
"@rollup/rollup-linux-x64-gnu@4.53.3":
version "4.53.3"
resolved "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz"
integrity sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==
resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz"
integrity sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==

"@rollup/rollup-linux-x64-musl@4.53.3":
version "4.53.3"
resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz"
integrity sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==

"@rx-state/core@^0.1.4":
version "0.1.4"
Expand Down Expand Up @@ -1655,11 +1660,6 @@ fs.promises.exists@^1.1.4:
resolved "https://registry.npmjs.org/fs.promises.exists/-/fs.promises.exists-1.1.4.tgz"
integrity sha512-lJzUGWbZn8vhGWBedA+RYjB/BeJ+3458ljUfmplqhIeb6ewzTFWNPCR1HCiYCkXV9zxcHz9zXkJzMsEgDLzh3Q==

fsevents@~2.3.2:
version "2.3.3"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==

function-bind@^1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
Expand Down
2 changes: 2 additions & 0 deletions eco-tests/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ parameter_types! {
pub const InitialTxChildKeyTakeRateLimit: u64 = 1; // 1 block take rate limit for testing
pub const InitialBurn: u64 = 0;
pub const InitialMinBurn: u64 = 500_000;
pub const InitialMinStake: u64 = 2_000_000;
pub const InitialMaxBurn: u64 = 1_000_000_000;
pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO
pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO
Expand Down Expand Up @@ -281,6 +282,7 @@ impl pallet_subtensor::Config for Test {
type InitialBurn = InitialBurn;
type InitialMaxBurn = InitialMaxBurn;
type InitialMinBurn = InitialMinBurn;
type InitialMinStake = InitialMinStake;
type MinBurnUpperBound = MinBurnUpperBound;
type MaxBurnLowerBound = MaxBurnLowerBound;
type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration;
Expand Down
2 changes: 2 additions & 0 deletions pallets/admin-utils/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ parameter_types! {
pub const InitialTxChildKeyTakeRateLimit: u64 = 0; // Disable rate limit for testing
pub const InitialBurn: TaoBalance = TaoBalance::new(0);
pub const InitialMinBurn: TaoBalance = TaoBalance::new(500_000);
pub const InitialMinStake: TaoBalance = TaoBalance::new(2_000_000);
pub const InitialMaxBurn: TaoBalance = TaoBalance::new(1_000_000_000);
pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO
pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO
Expand Down Expand Up @@ -205,6 +206,7 @@ impl pallet_subtensor::Config for Test {
type InitialBurn = InitialBurn;
type InitialMaxBurn = InitialMaxBurn;
type InitialMinBurn = InitialMinBurn;
type InitialMinStake = InitialMinStake;
type MinBurnUpperBound = MinBurnUpperBound;
type MaxBurnLowerBound = MaxBurnLowerBound;
type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration;
Expand Down
20 changes: 12 additions & 8 deletions pallets/crowdloan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,44 @@

## Overview

A pallet that enables the creation and management of generic crowdloans for transferring funds and executing an arbitrary call.
A pallet that enables the creation and management of generic crowdloans for transferring funds or executing an arbitrary call.

Users of this pallet can create a crowdloan by providing a deposit, a cap, an end block, an optional target address and an optional call.
Users of this pallet can create a crowdloan by providing a deposit, a cap, an end block, and exactly one of a target address or a call.

Users can contribute to a crowdloan by providing funds to the crowdloan they choose to support. The contribution can be withdrawn while the crowdloan is not finalized.

Once the crowdloan is finalized, the funds will be transferred to the target address if provided; otherwise, the end user is expected to transfer them manually on-chain if the call is a pallet extrinsic. The call will be dispatched with the current crowdloan ID stored as a temporary item.
Once the crowdloan is finalized, it follows the single configured finalization route. If a target address was provided, the raised funds are transferred to that account. If a call was provided, the call is dispatched with the creator origin and the current crowdloan ID stored as a temporary item.

Crowdloans cannot be created with both a target address and a call, or with neither. Finalization also checks this invariant before transferring funds or dispatching a call, which protects any invalid legacy or manually-written storage state.

If the crowdloan fails to reach the cap, the creator can decide to refund all contributors and dissolve the crowdloan. The initial deposit will be refunded.

*The call or target address provided when creating the crowdloan is guaranteed to never change. Only the minimum contribution, end block and cap can be updated from the crowdloan creator.*
*The call or target address provided when creating the crowdloan is guaranteed to never change. Only the minimum contribution, maximum contribution, end block and cap can be updated from the crowdloan creator.*

## Interface

- `create`: Create a crowdloan that will raise funds up to a maximum cap and if successful, will transfer funds to the target address if provided and/or dispatch the call (using creator origin). The initial deposit will be transfered to the crowdloan account and will be refunded in case the crowdloan fails to raise the cap. Additionally, the creator will pay for the execution of the call.
- `create`: Create a crowdloan that will raise funds up to a maximum cap and if successful, will transfer funds to the target address or dispatch the call (using creator origin). Exactly one of target address or call must be provided; both and neither are invalid. The initial deposit will be transferred to the crowdloan account and will be refunded in case the crowdloan fails to raise the cap. Additionally, the creator will pay for the execution of the call.

- `contribute`: Contribute to an active crowdloan. The contribution will be transfered to the crowdloan account and will be refunded if the crowdloan fails to raise the cap. If the contribution would raise the amount above the cap, the contribution will be set to the amount that is left to be raised.
- `contribute`: Contribute to an active crowdloan. The contribution will be transferred to the crowdloan account and will be refunded if the crowdloan fails to raise the cap. If the contribution would raise the amount above the cap, the contribution will be set to the amount that is left to be raised.

- `withdraw`: Withdraw a contribution from an active (not yet finalized or dissolved) crowdloan. Only contributions over the deposit can be withdrawn by the creator.

- `refund`: Try to refund all contributors (excluding the creator) up to the limit defined by a runtime parameter *RefundContributorsLimit* (currently set to 5). If the limit is reached, the call will stop and the crowdloan will be marked as partially refunded. It may be needed to dispatch this call multiple times to refund all contributors.

The following functions are only callable by the creator of the crowdloan:

- `finalize`: Finalize a successful crowdloan. The call will transfer the raised amount to the target address if it was provided when the crowdloan was created and dispatch the call that was provided using the creator origin.
- `finalize`: Finalize a successful crowdloan. Finalization uses exactly one route: it transfers the raised amount to the target address if one was configured, otherwise it dispatches the configured call using the creator origin. Invalid configurations with both or neither fail before side effects.

- `dissolve`: Dissolve a crowdloan. The crowdloan will be removed from the storage. All contributions must have been refunded before the crowdloan can be dissolved (except the creator's one).

- `update_min_contribution`: Update the minimum contribution of a non-finalized crowdloan.
- `update_min_contribution`: Update the minimum contribution of a non-finalized crowdloan. If a maximum contribution is configured, the new minimum contribution must not exceed it.

- `update_end`: Update the end block of a non-finalized crowdloan.

- `update_cap`: Update the cap of a non-finalized crowdloan.

- `set_max_contribution`: Set or clear the maximum cumulative contribution allowed per contributor for a non-finalized crowdloan.

## Integration with subnet leasing (from the subtensor pallet)

The `crowdloan` pallet can be used to create a crowdloan that will be used to register a new leased network through a crowdloan using the `register_leased_network` extrinsic from the `subtensor` pallet as a call parameter to the crowdloan pallet `create` extrinsic. A new subnet will be registered paying the lock cost using the crowdloan funds and a proxy will be created for the beneficiary to operate the subnet.
Expand Down
Loading
Loading