From ebfba9434796cf1394f64095ca968b1d35fa6e55 Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 12 Aug 2025 21:34:16 +0800 Subject: [PATCH 01/12] add remove case in wrap contract --- evm-tests/src/contracts/stakeWrap.sol | 15 ++++++++++ evm-tests/src/contracts/stakeWrap.ts | 29 ++++++++++++++++++- .../test/staking.precompile.wrap.test.ts | 23 ++++++++++++++- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/evm-tests/src/contracts/stakeWrap.sol b/evm-tests/src/contracts/stakeWrap.sol index 78f3e9f999..c5c9f7ae53 100644 --- a/evm-tests/src/contracts/stakeWrap.sol +++ b/evm-tests/src/contracts/stakeWrap.sol @@ -62,4 +62,19 @@ contract StakeWrap { (bool success, ) = ISTAKING_ADDRESS.call{gas: gasleft()}(data); require(success, "addStakeLimit call failed"); } + + function removeStake( + bytes32 hotkey, + uint256 netuid, + uint256 amount + ) external { + bytes memory data = abi.encodeWithSelector( + Staking.removeStake.selector, + hotkey, + amount, + netuid + ); + (bool success, ) = ISTAKING_ADDRESS.call{gas: gasleft()}(data); + require(success, "addStake call failed"); + } } diff --git a/evm-tests/src/contracts/stakeWrap.ts b/evm-tests/src/contracts/stakeWrap.ts index 16434addc8..a6a24bdb21 100644 --- a/evm-tests/src/contracts/stakeWrap.ts +++ b/evm-tests/src/contracts/stakeWrap.ts @@ -4,6 +4,29 @@ export const abi = [ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hotkey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "netuid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "removeStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -59,8 +82,12 @@ export const abi = [ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" } ]; // compiled with 0.8.20 -export const bytecode = "608060405234801561000f575f80fd5b5061069e8061001d5f395ff3fe60806040526004361061002c575f3560e01c80632daedd521461003757806390b9d5341461005f57610033565b3661003357005b5f80fd5b348015610042575f80fd5b5061005d60048036038101906100589190610357565b610087565b005b34801561006a575f80fd5b50610085600480360381019061008091906103dc565b6101b7565b005b5f631fc9b14160e01b8483856040516024016100a593929190610471565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a8360405161012d9190610512565b5f604051808303815f8787f1925050503d805f8114610167576040519150601f19603f3d011682016040523d82523d5f602084013e61016c565b606091505b50509050806101b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a790610582565b60405180910390fd5b5050505050565b5f635beb6b7460e01b86848685896040516024016101d99594939291906105af565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a836040516102619190610512565b5f604051808303815f8787f1925050503d805f811461029b576040519150601f19603f3d011682016040523d82523d5f602084013e6102a0565b606091505b50509050806102e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102db9061064a565b60405180910390fd5b50505050505050565b5f80fd5b5f819050919050565b610303816102f1565b811461030d575f80fd5b50565b5f8135905061031e816102fa565b92915050565b5f819050919050565b61033681610324565b8114610340575f80fd5b50565b5f813590506103518161032d565b92915050565b5f805f6060848603121561036e5761036d6102ed565b5b5f61037b86828701610310565b935050602061038c86828701610343565b925050604061039d86828701610343565b9150509250925092565b5f8115159050919050565b6103bb816103a7565b81146103c5575f80fd5b50565b5f813590506103d6816103b2565b92915050565b5f805f805f60a086880312156103f5576103f46102ed565b5b5f61040288828901610310565b955050602061041388828901610343565b945050604061042488828901610343565b935050606061043588828901610343565b9250506080610446888289016103c8565b9150509295509295909350565b61045c816102f1565b82525050565b61046b81610324565b82525050565b5f6060820190506104845f830186610453565b6104916020830185610462565b61049e6040830184610462565b949350505050565b5f81519050919050565b5f81905092915050565b5f5b838110156104d75780820151818401526020810190506104bc565b5f8484015250505050565b5f6104ec826104a6565b6104f681856104b0565b93506105068185602086016104ba565b80840191505092915050565b5f61051d82846104e2565b915081905092915050565b5f82825260208201905092915050565b7f6164645374616b652063616c6c206661696c65640000000000000000000000005f82015250565b5f61056c601483610528565b915061057782610538565b602082019050919050565b5f6020820190508181035f83015261059981610560565b9050919050565b6105a9816103a7565b82525050565b5f60a0820190506105c25f830188610453565b6105cf6020830187610462565b6105dc6040830186610462565b6105e960608301856105a0565b6105f66080830184610462565b9695505050505050565b7f6164645374616b654c696d69742063616c6c206661696c6564000000000000005f82015250565b5f610634601983610528565b915061063f82610600565b602082019050919050565b5f6020820190508181035f83015261066181610628565b905091905056fea264697066735822122083351bec20bd75de90a1b6e405922bedadf9ff260c02f34ef9dbb5ee1bda11cd64736f6c63430008140033" +export const bytecode = "6080604052348015600e575f5ffd5b506107e78061001c5f395ff3fe608060405260043610610037575f3560e01c80632daedd52146100425780637d691e301461006a57806390b9d534146100925761003e565b3661003e57005b5f5ffd5b34801561004d575f5ffd5b50610068600480360381019061006391906104ba565b6100ba565b005b348015610075575f5ffd5b50610090600480360381019061008b91906104ba565b6101ea565b005b34801561009d575f5ffd5b506100b860048036038101906100b3919061053f565b61031a565b005b5f631fc9b14160e01b8483856040516024016100d8939291906105d4565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a83604051610160919061065b565b5f604051808303815f8787f1925050503d805f811461019a576040519150601f19603f3d011682016040523d82523d5f602084013e61019f565b606091505b50509050806101e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101da906106cb565b60405180910390fd5b5050505050565b5f637d691e3060e01b848385604051602401610208939291906105d4565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a83604051610290919061065b565b5f604051808303815f8787f1925050503d805f81146102ca576040519150601f19603f3d011682016040523d82523d5f602084013e6102cf565b606091505b5050905080610313576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030a906106cb565b60405180910390fd5b5050505050565b5f635beb6b7460e01b868486858960405160240161033c9594939291906106f8565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a836040516103c4919061065b565b5f604051808303815f8787f1925050503d805f81146103fe576040519150601f19603f3d011682016040523d82523d5f602084013e610403565b606091505b5050905080610447576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043e90610793565b60405180910390fd5b50505050505050565b5f5ffd5b5f819050919050565b61046681610454565b8114610470575f5ffd5b50565b5f813590506104818161045d565b92915050565b5f819050919050565b61049981610487565b81146104a3575f5ffd5b50565b5f813590506104b481610490565b92915050565b5f5f5f606084860312156104d1576104d0610450565b5b5f6104de86828701610473565b93505060206104ef868287016104a6565b9250506040610500868287016104a6565b9150509250925092565b5f8115159050919050565b61051e8161050a565b8114610528575f5ffd5b50565b5f8135905061053981610515565b92915050565b5f5f5f5f5f60a0868803121561055857610557610450565b5b5f61056588828901610473565b9550506020610576888289016104a6565b9450506040610587888289016104a6565b9350506060610598888289016104a6565b92505060806105a98882890161052b565b9150509295509295909350565b6105bf81610454565b82525050565b6105ce81610487565b82525050565b5f6060820190506105e75f8301866105b6565b6105f460208301856105c5565b61060160408301846105c5565b949350505050565b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f61063582610609565b61063f8185610613565b935061064f81856020860161061d565b80840191505092915050565b5f610666828461062b565b915081905092915050565b5f82825260208201905092915050565b7f6164645374616b652063616c6c206661696c65640000000000000000000000005f82015250565b5f6106b5601483610671565b91506106c082610681565b602082019050919050565b5f6020820190508181035f8301526106e2816106a9565b9050919050565b6106f28161050a565b82525050565b5f60a08201905061070b5f8301886105b6565b61071860208301876105c5565b61072560408301866105c5565b61073260608301856106e9565b61073f60808301846105c5565b9695505050505050565b7f6164645374616b654c696d69742063616c6c206661696c6564000000000000005f82015250565b5f61077d601983610671565b915061078882610749565b602082019050919050565b5f6020820190508181035f8301526107aa81610771565b905091905056fea264697066735822122071b79d865c1a277a5c7a45dcea9fe84a941f14667654af515610dfd55d3a6fe764736f6c634300081e0033" diff --git a/evm-tests/test/staking.precompile.wrap.test.ts b/evm-tests/test/staking.precompile.wrap.test.ts index 01b605beb5..077f78a42b 100644 --- a/evm-tests/test/staking.precompile.wrap.test.ts +++ b/evm-tests/test/staking.precompile.wrap.test.ts @@ -76,10 +76,31 @@ describe("Test staking precompile add from deployed contract", () => { const tx = await deployedContract.stake( hotkey.publicKey, netuid, - tao(2000), + tao(2), ); await tx.wait(); + const stake = await api.query.SubtensorModule.Alpha.getValue( + convertPublicKeyToSs58(hotkey.publicKey), + convertH160ToSS58(contract.target.toString()), + netuid + ) + console.log(" == before remove stake is ", stake) + + const tx2 = await deployedContract.removeStake( + hotkey.publicKey, + netuid, + tao(1), + ); + await tx2.wait(); + + const stake2 = await api.query.SubtensorModule.Alpha.getValue( + convertPublicKeyToSs58(hotkey.publicKey), + convertH160ToSS58(contract.target.toString()), + netuid + ) + console.log(" == after remove stake is ", stake2) + }); it("Staker add stake limit", async () => { From 501e6e354c6e9543c25bf415e10773811904e714 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 12 Aug 2025 15:20:40 +0000 Subject: [PATCH 02/12] auto-update benchmark weights --- pallets/subtensor/src/macros/dispatches.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index 1f9d85d08b..510dc06ca9 100644 --- a/pallets/subtensor/src/macros/dispatches.rs +++ b/pallets/subtensor/src/macros/dispatches.rs @@ -827,7 +827,7 @@ mod dispatches { /// - The ip type v4 or v6. /// #[pallet::call_index(5)] - #[pallet::weight((Weight::from_parts(30_170_000, 0) + #[pallet::weight((Weight::from_parts(22_850_000, 0) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Normal, Pays::No))] pub fn serve_prometheus( @@ -1045,7 +1045,7 @@ mod dispatches { /// #[pallet::call_index(69)] #[pallet::weight(( - Weight::from_parts(3_630_000, 0) + Weight::from_parts(4_770_000, 0) .saturating_add(T::DbWeight::get().reads(0)) .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Operational, From a6307b17f1682e7f58c3b758084bd59ec3d56cc8 Mon Sep 17 00:00:00 2001 From: open-junius Date: Wed, 13 Aug 2025 19:56:08 +0800 Subject: [PATCH 03/12] remove stake is ok --- .../test/staking.precompile.wrap.test.ts | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/evm-tests/test/staking.precompile.wrap.test.ts b/evm-tests/test/staking.precompile.wrap.test.ts index 077f78a42b..e4d666adf1 100644 --- a/evm-tests/test/staking.precompile.wrap.test.ts +++ b/evm-tests/test/staking.precompile.wrap.test.ts @@ -18,7 +18,6 @@ import { } from "../src/subtensor"; import { ethers } from "ethers"; import { generateRandomEthersWallet } from "../src/utils"; -import { log } from "console"; import { abi, bytecode } from "../src/contracts/stakeWrap"; @@ -47,14 +46,13 @@ describe("Test staking precompile add from deployed contract", () => { console.log("will test in subnet: ", netuid); }); - it("Staker add stake", async () => { + it("Staker add and remove stake", async () => { let netuid = (await api.query.SubtensorModule.TotalNetworks.getValue()) - 1; const contractFactory = new ethers.ContractFactory(abi, bytecode, wallet1) const contract = await contractFactory.deploy() await contract.waitForDeployment() - // stake will remove the balance from contract, need transfer token to deployed contract const ethTransfer = { to: contract.target.toString(), @@ -64,9 +62,6 @@ describe("Test staking precompile add from deployed contract", () => { const txResponse = await wallet1.sendTransaction(ethTransfer) await txResponse.wait(); - const balance = await api.query.System.Account.getValue(convertH160ToSS58(contract.target.toString())) - console.log(" == balance is ", balance.data.free) - const deployedContract = new ethers.Contract( contract.target.toString(), abi, @@ -80,13 +75,6 @@ describe("Test staking precompile add from deployed contract", () => { ); await tx.wait(); - const stake = await api.query.SubtensorModule.Alpha.getValue( - convertPublicKeyToSs58(hotkey.publicKey), - convertH160ToSS58(contract.target.toString()), - netuid - ) - console.log(" == before remove stake is ", stake) - const tx2 = await deployedContract.removeStake( hotkey.publicKey, netuid, @@ -94,13 +82,6 @@ describe("Test staking precompile add from deployed contract", () => { ); await tx2.wait(); - const stake2 = await api.query.SubtensorModule.Alpha.getValue( - convertPublicKeyToSs58(hotkey.publicKey), - convertH160ToSS58(contract.target.toString()), - netuid - ) - console.log(" == after remove stake is ", stake2) - }); it("Staker add stake limit", async () => { From 67908b67a71b7577cc2b560f586d842f24f67766 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 13 Aug 2025 13:44:47 +0000 Subject: [PATCH 04/12] auto-update benchmark weights --- pallets/subtensor/src/macros/dispatches.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index d7e9b9ab1e..c53bb8a078 100644 --- a/pallets/subtensor/src/macros/dispatches.rs +++ b/pallets/subtensor/src/macros/dispatches.rs @@ -413,7 +413,7 @@ mod dispatches { /// - Attempting to set weights with max value exceeding limit. /// #[pallet::call_index(8)] - #[pallet::weight((Weight::from_parts(2_684_000, 0) + #[pallet::weight((Weight::from_parts(2_083_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( @@ -1575,7 +1575,7 @@ mod dispatches { /// * `TxRateLimitExceeded`: /// - Thrown if key has hit transaction rate limit #[pallet::call_index(83)] - #[pallet::weight((Weight::from_parts(28_910_000, 0) + #[pallet::weight((Weight::from_parts(22_070_000, 0) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(0)), DispatchClass::Operational, Pays::Yes))] pub fn unstake_all(origin: OriginFor, hotkey: T::AccountId) -> DispatchResult { @@ -1608,7 +1608,7 @@ mod dispatches { /// * `TxRateLimitExceeded`: /// - Thrown if key has hit transaction rate limit #[pallet::call_index(84)] - #[pallet::weight((Weight::from_parts(395_800_000, 0) + #[pallet::weight((Weight::from_parts(291_900_000, 0) .saturating_add(T::DbWeight::get().reads(33)) .saturating_add(T::DbWeight::get().writes(16)), DispatchClass::Operational, Pays::Yes))] pub fn unstake_all_alpha(origin: OriginFor, hotkey: T::AccountId) -> DispatchResult { @@ -2075,7 +2075,7 @@ mod dispatches { /// at which or better (higher) the staking should execute. /// Without limit_price it remove all the stake similar to `remove_stake` extrinsic #[pallet::call_index(103)] - #[pallet::weight((Weight::from_parts(421_500_000, 10142) + #[pallet::weight((Weight::from_parts(313_200_000, 10142) .saturating_add(T::DbWeight::get().reads(30_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)), DispatchClass::Normal, Pays::Yes))] pub fn remove_stake_full_limit( @@ -2156,7 +2156,7 @@ mod dispatches { /// Emits a `SymbolUpdated` event on success. #[pallet::call_index(112)] #[pallet::weight(( - Weight::from_parts(28_910_000, 0).saturating_add(T::DbWeight::get().reads_writes(4, 1)), + Weight::from_parts(19_600_000, 0).saturating_add(T::DbWeight::get().reads_writes(4, 1)), DispatchClass::Operational, Pays::Yes ))] From bb1f5e97bb1fe50b71feb4920e6be664bd5f1580 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 14 Aug 2025 10:14:17 +0000 Subject: [PATCH 05/12] auto-update benchmark weights --- pallets/subtensor/src/macros/dispatches.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index 76ae53905b..550c25fc1f 100644 --- a/pallets/subtensor/src/macros/dispatches.rs +++ b/pallets/subtensor/src/macros/dispatches.rs @@ -693,7 +693,7 @@ mod dispatches { /// - Attempting to set prometheus information withing the rate limit min. /// #[pallet::call_index(4)] - #[pallet::weight((Weight::from_parts(36_090_000, 0) + #[pallet::weight((Weight::from_parts(25_630_000, 0) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Normal, Pays::No))] pub fn serve_axon( @@ -1609,8 +1609,8 @@ mod dispatches { /// - Thrown if key has hit transaction rate limit #[pallet::call_index(84)] #[pallet::weight((Weight::from_parts(294_800_000, 0) - .saturating_add(T::DbWeight::get().reads(33)) - .saturating_add(T::DbWeight::get().writes(16)), DispatchClass::Operational, Pays::Yes))] + .saturating_add(T::DbWeight::get().reads(38_u64)) + .saturating_add(T::DbWeight::get().writes(21_u64)), DispatchClass::Operational, Pays::Yes))] pub fn unstake_all_alpha(origin: OriginFor, hotkey: T::AccountId) -> DispatchResult { Self::do_unstake_all_alpha(origin, hotkey) } @@ -1723,8 +1723,8 @@ mod dispatches { #[pallet::call_index(87)] #[pallet::weight(( Weight::from_parts(274_400_000, 0) - .saturating_add(T::DbWeight::get().reads(32)) - .saturating_add(T::DbWeight::get().writes(17)), + .saturating_add(T::DbWeight::get().reads(37_u64)) + .saturating_add(T::DbWeight::get().writes(22_u64)), DispatchClass::Operational, Pays::Yes ))] @@ -1896,8 +1896,8 @@ mod dispatches { #[pallet::call_index(90)] #[pallet::weight(( Weight::from_parts(330_400_000, 0) - .saturating_add(T::DbWeight::get().reads(32)) - .saturating_add(T::DbWeight::get().writes(17)), + .saturating_add(T::DbWeight::get().reads(37_u64)) + .saturating_add(T::DbWeight::get().writes(22_u64)), DispatchClass::Operational, Pays::Yes ))] From 64dc420f542bfbaa9f42e8ab5f88061b94c463bf Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 18 Aug 2025 09:51:51 +0800 Subject: [PATCH 06/12] add only owner modifier --- evm-tests/src/contracts/stakeWrap.sol | 27 +++++++++++++++++++++++---- evm-tests/src/contracts/stakeWrap.ts | 15 ++++++++++++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/evm-tests/src/contracts/stakeWrap.sol b/evm-tests/src/contracts/stakeWrap.sol index c5c9f7ae53..c7d11d42a0 100644 --- a/evm-tests/src/contracts/stakeWrap.sol +++ b/evm-tests/src/contracts/stakeWrap.sol @@ -15,13 +15,32 @@ interface Staking { ) external; function addStake(bytes32 hotkey, uint256 amount, uint256 netuid) external; + + function removeStake( + bytes32 hotkey, + uint256 amount, + uint256 netuid + ) external; } contract StakeWrap { - constructor() {} + address public owner; + constructor() { + owner = msg.sender; + } + + modifier onlyOwner() { + require(msg.sender == owner, "Only owner can call this function"); + _; + } + receive() external payable {} - function stake(bytes32 hotkey, uint256 netuid, uint256 amount) external { + function stake( + bytes32 hotkey, + uint256 netuid, + uint256 amount + ) external onlyOwner { // can't call precompile like this way, the call never go to runtime precompile //Staking(ISTAKING_ADDRESS).addStake(hotkey, amount, netuid); @@ -41,7 +60,7 @@ contract StakeWrap { uint256 limitPrice, uint256 amount, bool allowPartial - ) external { + ) external onlyOwner { // can't call precompile like this way, the call never go to runtime precompile // Staking(ISTAKING_ADDRESS).addStakeLimit( // hotkey, @@ -67,7 +86,7 @@ contract StakeWrap { bytes32 hotkey, uint256 netuid, uint256 amount - ) external { + ) external onlyOwner { bytes memory data = abi.encodeWithSelector( Staking.removeStake.selector, hotkey, diff --git a/evm-tests/src/contracts/stakeWrap.ts b/evm-tests/src/contracts/stakeWrap.ts index a6a24bdb21..07853470a1 100644 --- a/evm-tests/src/contracts/stakeWrap.ts +++ b/evm-tests/src/contracts/stakeWrap.ts @@ -4,6 +4,19 @@ export const abi = [ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -90,4 +103,4 @@ export const abi = [ ]; // compiled with 0.8.20 -export const bytecode = "6080604052348015600e575f5ffd5b506107e78061001c5f395ff3fe608060405260043610610037575f3560e01c80632daedd52146100425780637d691e301461006a57806390b9d534146100925761003e565b3661003e57005b5f5ffd5b34801561004d575f5ffd5b50610068600480360381019061006391906104ba565b6100ba565b005b348015610075575f5ffd5b50610090600480360381019061008b91906104ba565b6101ea565b005b34801561009d575f5ffd5b506100b860048036038101906100b3919061053f565b61031a565b005b5f631fc9b14160e01b8483856040516024016100d8939291906105d4565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a83604051610160919061065b565b5f604051808303815f8787f1925050503d805f811461019a576040519150601f19603f3d011682016040523d82523d5f602084013e61019f565b606091505b50509050806101e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101da906106cb565b60405180910390fd5b5050505050565b5f637d691e3060e01b848385604051602401610208939291906105d4565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a83604051610290919061065b565b5f604051808303815f8787f1925050503d805f81146102ca576040519150601f19603f3d011682016040523d82523d5f602084013e6102cf565b606091505b5050905080610313576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030a906106cb565b60405180910390fd5b5050505050565b5f635beb6b7460e01b868486858960405160240161033c9594939291906106f8565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a836040516103c4919061065b565b5f604051808303815f8787f1925050503d805f81146103fe576040519150601f19603f3d011682016040523d82523d5f602084013e610403565b606091505b5050905080610447576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043e90610793565b60405180910390fd5b50505050505050565b5f5ffd5b5f819050919050565b61046681610454565b8114610470575f5ffd5b50565b5f813590506104818161045d565b92915050565b5f819050919050565b61049981610487565b81146104a3575f5ffd5b50565b5f813590506104b481610490565b92915050565b5f5f5f606084860312156104d1576104d0610450565b5b5f6104de86828701610473565b93505060206104ef868287016104a6565b9250506040610500868287016104a6565b9150509250925092565b5f8115159050919050565b61051e8161050a565b8114610528575f5ffd5b50565b5f8135905061053981610515565b92915050565b5f5f5f5f5f60a0868803121561055857610557610450565b5b5f61056588828901610473565b9550506020610576888289016104a6565b9450506040610587888289016104a6565b9350506060610598888289016104a6565b92505060806105a98882890161052b565b9150509295509295909350565b6105bf81610454565b82525050565b6105ce81610487565b82525050565b5f6060820190506105e75f8301866105b6565b6105f460208301856105c5565b61060160408301846105c5565b949350505050565b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f61063582610609565b61063f8185610613565b935061064f81856020860161061d565b80840191505092915050565b5f610666828461062b565b915081905092915050565b5f82825260208201905092915050565b7f6164645374616b652063616c6c206661696c65640000000000000000000000005f82015250565b5f6106b5601483610671565b91506106c082610681565b602082019050919050565b5f6020820190508181035f8301526106e2816106a9565b9050919050565b6106f28161050a565b82525050565b5f60a08201905061070b5f8301886105b6565b61071860208301876105c5565b61072560408301866105c5565b61073260608301856106e9565b61073f60808301846105c5565b9695505050505050565b7f6164645374616b654c696d69742063616c6c206661696c6564000000000000005f82015250565b5f61077d601983610671565b915061078882610749565b602082019050919050565b5f6020820190508181035f8301526107aa81610771565b905091905056fea264697066735822122071b79d865c1a277a5c7a45dcea9fe84a941f14667654af515610dfd55d3a6fe764736f6c634300081e0033" +export const bytecode = "6080604052348015600e575f5ffd5b50335f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ad08061005b5f395ff3fe608060405260043610610042575f3560e01c80632daedd521461004d5780637d691e30146100755780638da5cb5b1461009d57806390b9d534146100c757610049565b3661004957005b5f5ffd5b348015610058575f5ffd5b50610073600480360381019061006e91906106bd565b6100ef565b005b348015610080575f5ffd5b5061009b600480360381019061009691906106bd565b6102ad565b005b3480156100a8575f5ffd5b506100b161046b565b6040516100be919061074c565b60405180910390f35b3480156100d2575f5ffd5b506100ed60048036038101906100e8919061079a565b61048f565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461017d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017490610891565b60405180910390fd5b5f631fc9b14160e01b84838560405160240161019b939291906108cd565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a836040516102239190610954565b5f604051808303815f8787f1925050503d805f811461025d576040519150601f19603f3d011682016040523d82523d5f602084013e610262565b606091505b50509050806102a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029d906109b4565b60405180910390fd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461033b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033290610891565b60405180910390fd5b5f637d691e3060e01b848385604051602401610359939291906108cd565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a836040516103e19190610954565b5f604051808303815f8787f1925050503d805f811461041b576040519150601f19603f3d011682016040523d82523d5f602084013e610420565b606091505b5050905080610464576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045b906109b4565b60405180910390fd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461051d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051490610891565b60405180910390fd5b5f635beb6b7460e01b868486858960405160240161053f9594939291906109e1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f61080573ffffffffffffffffffffffffffffffffffffffff165a836040516105c79190610954565b5f604051808303815f8787f1925050503d805f8114610601576040519150601f19603f3d011682016040523d82523d5f602084013e610606565b606091505b505090508061064a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064190610a7c565b60405180910390fd5b50505050505050565b5f5ffd5b5f819050919050565b61066981610657565b8114610673575f5ffd5b50565b5f8135905061068481610660565b92915050565b5f819050919050565b61069c8161068a565b81146106a6575f5ffd5b50565b5f813590506106b781610693565b92915050565b5f5f5f606084860312156106d4576106d3610653565b5b5f6106e186828701610676565b93505060206106f2868287016106a9565b9250506040610703868287016106a9565b9150509250925092565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6107368261070d565b9050919050565b6107468161072c565b82525050565b5f60208201905061075f5f83018461073d565b92915050565b5f8115159050919050565b61077981610765565b8114610783575f5ffd5b50565b5f8135905061079481610770565b92915050565b5f5f5f5f5f60a086880312156107b3576107b2610653565b5b5f6107c088828901610676565b95505060206107d1888289016106a9565b94505060406107e2888289016106a9565b93505060606107f3888289016106a9565b925050608061080488828901610786565b9150509295509295909350565b5f82825260208201905092915050565b7f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f5f8201527f6e00000000000000000000000000000000000000000000000000000000000000602082015250565b5f61087b602183610811565b915061088682610821565b604082019050919050565b5f6020820190508181035f8301526108a88161086f565b9050919050565b6108b881610657565b82525050565b6108c78161068a565b82525050565b5f6060820190506108e05f8301866108af565b6108ed60208301856108be565b6108fa60408301846108be565b949350505050565b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f61092e82610902565b610938818561090c565b9350610948818560208601610916565b80840191505092915050565b5f61095f8284610924565b915081905092915050565b7f6164645374616b652063616c6c206661696c65640000000000000000000000005f82015250565b5f61099e601483610811565b91506109a98261096a565b602082019050919050565b5f6020820190508181035f8301526109cb81610992565b9050919050565b6109db81610765565b82525050565b5f60a0820190506109f45f8301886108af565b610a0160208301876108be565b610a0e60408301866108be565b610a1b60608301856109d2565b610a2860808301846108be565b9695505050505050565b7f6164645374616b654c696d69742063616c6c206661696c6564000000000000005f82015250565b5f610a66601983610811565b9150610a7182610a32565b602082019050919050565b5f6020820190508181035f830152610a9381610a5a565b905091905056fea2646970667358221220f8ad692d7919fb10f08e5311c64a0aa705a4e665689967633c2ddade5398076664736f6c634300081e0033" From 204e27562451d559e35aed5ac2ec519d8cb62f2d Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 18 Aug 2025 09:57:13 +0800 Subject: [PATCH 07/12] bump runtime version --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 16af31170e..d2b7ed9831 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -213,7 +213,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: 302, + spec_version: 303, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 1e325af5cc8f776f4e7e410229f9f798aa0a1e35 Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 18 Aug 2025 10:30:13 +0800 Subject: [PATCH 08/12] commit Cargo.lock --- pallets/subtensor/src/macros/dispatches.rs | 4 ---- pallets/subtensor/src/utils/misc.rs | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index c266eed79e..414b5d9acf 100644 --- a/pallets/subtensor/src/macros/dispatches.rs +++ b/pallets/subtensor/src/macros/dispatches.rs @@ -1895,11 +1895,7 @@ mod dispatches { /// May emit a `StakeSwapped` event on success. #[pallet::call_index(90)] #[pallet::weight(( -<<<<<<< HEAD - Weight::from_parts(330_400_000, 0) -======= Weight::from_parts(411_500_000, 0) ->>>>>>> devnet-ready .saturating_add(T::DbWeight::get().reads(37_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)), DispatchClass::Operational, diff --git a/pallets/subtensor/src/utils/misc.rs b/pallets/subtensor/src/utils/misc.rs index c7b93535f3..007ede9389 100644 --- a/pallets/subtensor/src/utils/misc.rs +++ b/pallets/subtensor/src/utils/misc.rs @@ -1,7 +1,7 @@ use super::*; -use crate::{ - Error, - system::{ensure_root, ensure_signed, ensure_signed_or_root, pallet_prelude::BlockNumberFor}, +use crate::Error; +use crate::system::{ + ensure_root, ensure_signed, ensure_signed_or_root, pallet_prelude::BlockNumberFor, }; use safe_math::*; use sp_core::Get; From bb57d798678d031a5b20c3b6f984849275a85e64 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 18 Aug 2025 04:40:53 +0000 Subject: [PATCH 09/12] auto-update benchmark weights --- pallets/subtensor/src/macros/dispatches.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index 414b5d9acf..66bf481420 100644 --- a/pallets/subtensor/src/macros/dispatches.rs +++ b/pallets/subtensor/src/macros/dispatches.rs @@ -693,7 +693,7 @@ mod dispatches { /// - Attempting to set prometheus information withing the rate limit min. /// #[pallet::call_index(4)] - #[pallet::weight((Weight::from_parts(25_630_000, 0) + #[pallet::weight((Weight::from_parts(34_500_000, 0) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Normal, Pays::No))] pub fn serve_axon( From 485b95fdd0cda81617224b3dc46b59239d8379bc Mon Sep 17 00:00:00 2001 From: open-junius Date: Fri, 29 Aug 2025 22:29:04 +0800 Subject: [PATCH 10/12] bump versoin --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 00cc24b411..679e5e55b2 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -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: 307, + spec_version: 308, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From d84daecbbf3eaafdff40ddfef37b98e69aed1cd5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 29 Aug 2025 16:39:28 +0000 Subject: [PATCH 11/12] auto-update benchmark weights --- pallets/subtensor/src/macros/dispatches.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index aed0c150de..60f407c33f 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(18_910_000, 0) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(0_u64)), DispatchClass::Normal, Pays::No))] pub fn batch_set_weights( origin: OriginFor, netuids: Vec>, From d38f34aa949f24b2a1e77f8443f5c8382ad31a8c Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 16 Sep 2025 20:44:24 +0800 Subject: [PATCH 12/12] bump version --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index d49d5147e9..aa87c52a19 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -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: 316, + spec_version: 317, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,