Skip to content

Merge with devnet-ready #1707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
472a914
Merge pull request #1576 from opentensor/devnet-ready
sam0x17 Apr 29, 2025
74d7f99
Merge pull request #1617 from opentensor/devnet-ready
sam0x17 May 8, 2025
81cd50b
Merge pull request #1627 from opentensor/devnet-ready
sam0x17 May 12, 2025
9f84e14
Merge pull request #1581 from opentensor/devnet
sam0x17 May 13, 2025
b041691
init solution
open-junius May 15, 2025
4a6d525
call dispatch
open-junius May 15, 2025
9fe7c7d
Merge pull request #1642 from opentensor/devnet-ready
sam0x17 May 15, 2025
ae85913
Add missing trait bounds
keithtensor May 15, 2025
ee7bad9
Merge pull request #1644 from opentensor/devnet
sam0x17 May 15, 2025
fb9ca43
evm test part
open-junius May 16, 2025
da050d8
test is done
open-junius May 17, 2025
33a0e80
Merge branch 'devnet-ready' into any-call-any-query
open-junius May 17, 2025
8270040
clean up code
open-junius May 17, 2025
1f9fbb1
clean up code
open-junius May 17, 2025
919c9e0
remove contract definition
open-junius May 17, 2025
b855e7d
format code
open-junius May 17, 2025
00d7ca7
cargo clippy
open-junius May 17, 2025
7094c4f
not include the descriptos
open-junius May 17, 2025
6b53c5f
revert lock file
open-junius May 17, 2025
227220b
revert unnecessary change
open-junius May 17, 2025
a615482
revert unnecessary change
open-junius May 17, 2025
dd8d8ab
cargo fix
open-junius May 17, 2025
cf56ee2
use hash function to get the key
open-junius May 18, 2025
7904b10
add generate call data process
open-junius May 18, 2025
9948aa6
merge with taraget branch
open-junius May 19, 2025
70a77f5
Merge pull request #1653 from opentensor/devnet-ready
sam0x17 May 20, 2025
26267f5
Merge pull request #1655 from opentensor/devnet
sam0x17 May 20, 2025
5505242
change the default registration to 0.1 TAO
open-junius May 25, 2025
842108c
allow axon ip as 0
open-junius May 26, 2025
493832f
add more tests
open-junius May 26, 2025
f27d155
update version
open-junius May 26, 2025
417f1bb
Merge pull request #1690 from opentensor/devnet-ready
sam0x17 May 27, 2025
cad0ebc
Merge remote-tracking branch 'origin/devnet-ready' into devnet
sam0x17 May 28, 2025
d5a161b
Merge pull request #1692 from opentensor/devnet
sam0x17 May 28, 2025
a689d98
update to rust 1.87
sam0x17 May 28, 2025
c921529
allow clippy large error
sam0x17 May 28, 2025
a6f5f42
hotfix rust version
sam0x17 May 28, 2025
9fe45c5
Merge remote-tracking branch 'origin/devnet' into testnet
sam0x17 May 28, 2025
2afb91c
Merge remote-tracking branch 'origin/testnet' into rust-1.87
sam0x17 May 28, 2025
17f32d3
Merge pull request #1693 from opentensor/rust-1.87
sam0x17 May 28, 2025
64b2813
remove if with error
basfroman May 28, 2025
7581c73
bumping spec_version
basfroman May 28, 2025
e7cfc83
add mirror for `apt-get update`
basfroman May 29, 2025
e1cf60a
Merge branch 'devnet-ready' into any-call-any-query
open-junius May 29, 2025
2429c38
Merge branch 'devnet-ready' into reduce-registration-fee
open-junius May 29, 2025
48519ac
Merge branch 'devnet-ready' into allow-ip-as-0
open-junius May 29, 2025
a22c14a
Merge pull request #1696 from opentensor/fix/roman/fix-drand-for-loca…
sam0x17 May 29, 2025
f7d2435
Fix migration weights
shamil-gadelshin May 30, 2025
bef974e
Merge pull request #1639 from opentensor/any-call-any-query
open-junius May 30, 2025
19bedbb
Merge pull request #1700 from opentensor/fix-migration-weights
sam0x17 May 30, 2025
0df94a2
Merge pull request #1681 from opentensor/reduce-registration-fee
sam0x17 May 30, 2025
98c4e86
Merge pull request #1682 from opentensor/allow-ip-as-0
sam0x17 May 30, 2025
e44a2b9
Merge branch 'devnet-ready' into sasha/feat/uniswapv3-lp
ales-otf Jun 2, 2025
41fdb3d
Move pallet tests into a separate file
ales-otf Jun 2, 2025
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
Prev Previous commit
Next Next commit
clean up code
  • Loading branch information
open-junius committed May 17, 2025
commit 8270040007f7d5af6a8342935ffb85dd75c1baae
2 changes: 1 addition & 1 deletion evm-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts": {
"test": "mocha --timeout 999999 --file src/setup.ts --require ts-node/register test/runtime*test.ts"
"test": "mocha --timeout 999999 --retries 3 --file src/setup.ts --require ts-node/register test/*test.ts"
},
"keywords": [],
"author": "",
Expand Down
21 changes: 2 additions & 19 deletions evm-tests/test/runtime.call.precompile.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@



import * as assert from "assert";

import { getAliceSigner, getDevnetApi } from "../src/substrate"
import { generateRandomEthersWallet, getPublicClient } from "../src/utils";
import { IDISPATCH_ADDRESS, ISTORAGE_QUERY_ADDRESS, ETH_LOCAL_URL } from "../src/config";
import { devnet } from "@polkadot-api/descriptors"
import { hexToBigInt, hexToNumber, PublicClient } from "viem";
import { hexToNumber, PublicClient } from "viem";
import { PolkadotSigner, TypedApi } from "polkadot-api";
import { convertPublicKeyToSs58 } from "../src/address-utils"
import { forceSetBalanceToEthAddress, setMaxChildkeyTake } from "../src/subtensor";

describe("Test the dispatch precompile", () => {
let publicClient: PublicClient;
// init eth part
const wallet1 = generateRandomEthersWallet();

let api: TypedApi<typeof devnet>
let alice: PolkadotSigner;

Expand All @@ -25,8 +19,6 @@ describe("Test the dispatch precompile", () => {
api = await getDevnetApi()
alice = await getAliceSigner()
await forceSetBalanceToEthAddress(api, wallet1.address)

console.log("wallet1 address: ", wallet1.address)
})

it("Dispatch transfer call via precompile contract works correctly", async () => {
Expand All @@ -35,8 +27,6 @@ describe("Test the dispatch precompile", () => {
const transferAmount = BigInt(1000000000);
const transferCall = "0x050300d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d02286bee"
const aliceBalance = (await api.query.System.Account.getValue( convertPublicKeyToSs58(alice.publicKey))).data.free

console.log("alice balance before transfer: ", aliceBalance.toString())
const txResponse = await wallet1.sendTransaction({
to: IDISPATCH_ADDRESS,
data: transferCall,
Expand All @@ -53,16 +43,12 @@ describe("Test the dispatch precompile", () => {
it("Storage query call via precompile contract works correctly", async () => {
let maxChildkeyTake = 257;
await setMaxChildkeyTake(api, maxChildkeyTake)
// sudo_set_max_childkey_take
// 0x658faa385070e074c85bf6b568cf0555f14f14d903e9994045ff1902b3e513dc
// key for min child key take
// key for min child key take

const storageQuery = "0x658faa385070e074c85bf6b568cf0555dba018859cab7e989f77669457b394be"

api.query.SubtensorModule.MaxChildkeyTake.getValue();

// api.apis.

const rawCallResponse = await publicClient.call({
to: ISTORAGE_QUERY_ADDRESS,
data: storageQuery,
Expand All @@ -73,8 +59,5 @@ describe("Test the dispatch precompile", () => {
}
let value = hexToNumber(rawResultData);
assert.equal(value, maxChildkeyTake, "value should be 257")



})
});
44 changes: 1 addition & 43 deletions pallets/subtensor/src/tests/batch_tx.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use crate::MaxChildkeyTake;

use super::mock::*;
use frame_support::{StorageHasher, Twox128, assert_ok, traits::Currency};
use frame_support::{assert_ok, traits::Currency};
use frame_system::Config;
use sp_core::U256;
use sp_io::hashing::twox_128;
// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --package pallet-subtensor --lib -- tests::batch_tx::test_batch_txs --exact --show-output --nocapture
#[test]
fn test_batch_txs() {
Expand Down Expand Up @@ -35,42 +32,3 @@ fn test_batch_txs() {
assert_eq!(Balances::total_balance(&charlie), 2_000_000_000);
});
}

// [101, 143, 170, 56, 80, 112, 224, 116, 200, 91, 246, 181, 104, 207, 5, 85, 219, 160, 24, 133, 156, 171, 126, 152, 159, 119, 102, 148, 87, 179, 148, 190]
#[test]
fn test_batch_txs2() {
let alice = U256::from(0);
let bob = U256::from(1);
let charlie = U256::from(2);
let initial_balances = vec![
(alice, 8_000_000_000),
(bob, 1_000_000_000),
(charlie, 1_000_000_000),
];
test_ext_with_balances(initial_balances).execute_with(|| {
let init_value = SubtensorModule::get_max_childkey_take();
log::error!("Storage value: {:?}", init_value);

SubtensorModule::set_max_childkey_take(1000);

// let mut final_key = [0u8; 32];
// final_key[16..].copy_from_slice(twox_128(b"Subtensor"));
// final_key[..16].copy_from_slice(twox_128(b"MaxChildkeyTake"));
let final_key = [twox_128(b"SubtensorModule"), twox_128(b"MaxChildkeyTake")].concat();
log::error!("Storage value: {:?}", final_key);

let hash_key = MaxChildkeyTake::<Test>::hashed_key();
log::error!("Storage value: {:?}", hash_key);
// let key = [
// 101, 143, 170, 56, 80, 112, 224, 116, 200, 91, 246, 181, 104, 207, 5, 85, 219, 160, 24,
// 133, 156, 171, 126, 152, 159, 119, 102, 148, 87, 179, 148, 190,
// ];
let value = sp_io::storage::get(&final_key[..]);
log::error!("Storage value: {:?}", value);
assert_eq!(value, None);

sp_io::storage::set(&final_key[..], &[0u8; 32][..]);
let init_value = SubtensorModule::get_max_childkey_take();
log::error!("Storage value: {:?}", init_value);
});
}
13 changes: 0 additions & 13 deletions precompiles/src/storage_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,12 @@ where
<<R as frame_system::Config>::Lookup as StaticLookup>::Source: From<R::AccountId>,
{
fn execute(handle: &mut impl PrecompileHandle) -> fp_evm::PrecompileResult {
log::error!("StorageQueryPrecompile::execute {} {}", file!(), line!());

let input = handle.input();
let data = sp_io::storage::get(&input[..]);
log::error!(
"============================= StorageQueryPrecompile::execute {:?} {:?}",
input,
data
);

log::error!("StorageQueryPrecompile::execute {} {}", file!(), line!());

match data {
Some(value) => {
let result = value.to_vec();
log::error!(
"============================= StorageQueryPrecompile::execute {:?}",
result
);

Ok(PrecompileOutput {
exit_status: ExitSucceed::Returned,
Expand Down
Loading